linear algebra - How to use the in-place version of cholfact() in Julia? -
i need solve ax = b, a symmetric positiv semi-definite matrix. can efficiently implemented using cholesky decomposition. because matrix a @ to the lowest degree have dimensions 25000 x 25000, cannot waste memory. hence want utilize in-place version of julia's cholfact:
cholfact!(a, :u, pivot = true)
compared
f = cholfact(a, :u, pivot = true)
this save gigabytes of memory.
however after computation, a
of type matrix float64
, while f
has type choleskypivoted{float64}
. far understand in-place version loses essential information, such pivot vector f.piv
. how can compute cholesky decomposition correctly whithout wasting memory?
you want combine these two:
f = cholfact!(a, :u, pivot = true)
this returns choleskypivoted
, indeed want. using cholfact!
, you're saying don't care whether a
gets destroyed in process. consequently, utilize memory allocated a
storing factorization (thus destroying a
).
afterwards, should utilize f
, not a
, because a
has been destroyed. internally, f
contain reference a
, since it's storing factorization in a
. may clearer if examine how choleskypivoted
represented; a
used ul
field.
linear-algebra julia-lang
No comments:
Post a Comment