-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate chol(A, Val{:U/:L}) and move documentation to method definitions #13680
Conversation
-1 on this. Defaulting to upper storage always felt like the wrong default in matlab. I could maybe get behind switching from |
Once there are free transposes this would not seem to be a big problem and the physicists and numerical mathematicians convention of conjugating (and transposing) the first factor agrees with the fact that we as well only have one - the physicists' - dot product. On the other hand especially in stochastic applications the lower triangular factor is the more natural object, where variance is defined as E X X'. Hard to call, but in the end, |
Maybe, but it doesn't matter which one you choose and therefore it is not worth the trouble to change the default. It also happens that MATLAB and R use the upper version. For the fun of it, I did some archeology, and it is a very old decision in Julia. See bb1ae75#diff-af7f0b18d31ef100c07d8bf23b112ff6R115. It's from the time when files with Julia code were in the root folder and had extension I think it is better to simplify the method instead of giving unnecessary options. The rest of your comment is about unexported methods. For unexported methods, the balance between cleaning up and avoiding breakages should be quite different. Using |
Important distinction - Or comparing to the other closely related API's around |
I think the reason for using the upper triangular factor in statistical computing in general and in S, the predecessor language to R, is because the triangular matrix |
b0a26cc
to
8a0a6bf
Compare
8a0a6bf
to
6457fec
Compare
I can live with this version. |
Deprecate chol(A, Val{:U/:L}) and move documentation to method definitions
if uplo == :U | ||
Cholesky(chol!(A, UpperTriangular).data, 'U') | ||
else | ||
Cholesky(chol!(A, UpperTriangular).data, 'U') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, was this supposed to be Cholesky(chol!(A, LowerTriangular).data, 'L')
? Definitely missing test coverage if so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I'm really surprised that it is not covered. I'll fix that now.
I've just learned that LINPACK only supports the upper triangular version of the Cholesky which could be the reason why MATLAB and R decided to use the |
It was resently brought up on the mailing list that the syntax for getting the lower triangular version of the Cholesky,
chol(A, Val{:L})
, is "ugly and confusing".In 0.3 the syntax was
chol(A,:L)
which is simpler, but because theTriangular
type was split intoLowerTriangular
andUpperTriangular
, it was necessary to introduce two different method signatures for creating theLower
and theUpper
version of the Cholesky factor. This let to JuliaLang/LinearAlgebra.jl#268.In this PR I follow the idea from 3. in JuliaLang/LinearAlgebra.jl#268 and remove the second argument from
chol
. The reason for this is that theLower
and theUpper
versions are in fact the exact same factorization,A=◣*◥
, and the only difference is if the lower or the upper part is used for storage. Therefore, it is only a matter of transposing the result to get the other version and if this is done as part of a multiplication of solve, then this is essensially free.