Hi,
I am lost why this operation does not work…
u=[4. 0.; 0. 4.]
cholesky(u)*[1.;0.]
it seems it has to do that with the special matrix type of Cholesky. Should I transform this type back to normal matrix?
thanks a lot for your help.
Hi,
I am lost why this operation does not work…
u=[4. 0.; 0. 4.]
cholesky(u)*[1.;0.]
it seems it has to do that with the special matrix type of Cholesky. Should I transform this type back to normal matrix?
thanks a lot for your help.
u=[4. 0.; 0. 4.]
cholesky(u).U * [1.;0.] # Upper Triangular or F.L for lower triangular
thanks a lot! I assumed that cholesky(u) by default gives upper triangular
If it just gave an ordinary matrix, this would lose the information that it was a Cholesky factorization. By returning a special Cholesky
type, it can be used in place of the original matrix for things like solving systems of equations \
:
julia> A = rand(3,3); A = A'A # random SPD matrix
3×3 Array{Float64,2}:
0.227769 0.306165 0.155967
0.306165 1.00758 0.484895
0.155967 0.484895 0.967645
julia> C = cholesky(A)
Cholesky{Float64,Array{Float64,2}}
U factor:
3×3 UpperTriangular{Float64,Array{Float64,2}}:
0.477252 0.641517 0.326802
⋅ 0.772035 0.35652
⋅ ⋅ 0.856586
julia> C \ [3,4,5] # solve Ax = [3,4,5]
3-element Array{Float64,1}:
12.98633638730901
-1.9180590129375255
4.035174666757661
julia> A * ans
3-element Array{Float64,1}:
2.9999999999999996
4.0
5.000000000000001