-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Cholesky type stability #1117
base: master
Are you sure you want to change the base?
Cholesky type stability #1117
Conversation
Collecting on CuArrays is a bad idea generally. Is there an mwe to show the value in fixing the instability? |
Indeed -- hence my desire to find a better way to do this that doesn't involve
In my application, I have a call to |
Is this branch needed at all? What's returned here goes back into the adjoint of cholesky, presumably. Does it read the wrong triangle at all? Maybe something like |
What's the type of julia> using LinearAlgebra
julia> A = rand(2, 2);
julia> typeof(triu(A)) === typeof(tril(A)) === Matrix{Float64}
true
julia> typeof(triu(UpperTriangular(A))) === typeof(tril(UpperTriangular(A))) === UpperTriangular{Float64,Matrix{Float64}}
true
julia> typeof(triu(LowerTriangular(A))) === typeof(tril(LowerTriangular(A))) === LowerTriangular{Float64,Matrix{Float64}}
true |
Related: JuliaLang/julia#42920 - question on whether we could have
are you using PDMats.chol_lower? |
The methods for
literal_getproperty
on the Cholesky factorisation are type-unstable. This instability stems from the value ofuplo
not being known at compile time as it's dynamic.The only way that I can see around this is to ensure that we arrive at the same type for the
factors
field regardless whetheruplo
is:L
or:U
.I'm not 100% happy with using
collect
-- it feels like it'll be a bad option for things likeCuArray
s, to which this rule does in principle apply I believe. @oxinabox @mcabbott @DhairyaLGandhi @devmotion any thoughts on another way of achieving the same thing?Note: this should not prevent us moving forward with #1114 as this doesn't interfere with the rrule for
cholesky
itself.