gonum / matrix

Matrix packages for the Go language [DEPRECATED]
446 stars 53 forks source link

mat64: should Dense.SolveCholesky/Vec really return an error? #374

Closed vladimir-ch closed 8 years ago

vladimir-ch commented 8 years ago

If a matrix is positive definite, its Cholesky decomposition exists and the matrix is non-singular. Cholesky.Factorize returns a bool that indicates that. Dense.SolveCholesky returns an error if the matrix is ill-conditioned, but 1) the decomposition exists so it is not strictly speaking an error to use for a solve, only the result will be useless 2) it makes it seem that the error somehow depends on the combination of a and b which is not true. What is the reasoning behind the current design?

btracey commented 8 years ago

Yes it should. The cholesky factorization only fails if the matrix is exactly singular. This may not happen even if the matrix is exactly singular given floating point error. This is different for linear solve where it may not be exactly singular, but dangerously close. Secondly, the future may add functions like rank one to update the factorization without going through the original matrix. This could cause the matrix to become approximately singular

vladimir-ch commented 8 years ago

Thanks, makes sense especially with respect to the updates. Speaking about updates, I have Cholesky.RankOne almost finished which is also the reason why I'm looking at Cholesky. I hope to submit sometime next week.