# LDLt factorization for sparse matrix

I am trying to compute the LDLt factorization for sparse matrix, which is symmetric and positive definite, and get the L and D factors.

I tried many things, but I don’t yet have a solution. For example,

``````julia> C=ldlt(xss)
SuiteSparse.CHOLMOD.Factor{Float64}
type:    LDLt
method:  simplicial
maxnnz:  4073497
nnz:     1363617
success: true
``````

returns

``````julia> C.L
SuiteSparse.CHOLMOD.FactorComponent{Float64,:L}
type:    LDLt
method:  simplicial
maxnnz:  4073497
nnz:     1363617
success: true

julia> C.D
SuiteSparse.CHOLMOD.FactorComponent{Float64,:D}
type:    LDLt
method:  simplicial
maxnnz:  4073497
nnz:     1363617
success: true
``````

and

``````julia> sparse(C.L)
ERROR: SuiteSparse.CHOLMOD.CHOLMODException("sparse: supported only for :LD on LDLt factorizations")
``````

I can get sparse(C.LD), but I need separately L & D.

Any ideas much appreciated!

1 Like

I think I’ve found it, the LD is the invperm of F.p indices

``````F=ldlt(xss)
LD=sparse(F.LD)
iok=invperm(F.p)
LDiok=LD[iok,iok]
``````

and afterwards, D is the diag(LD) and L the LD with 1s in the diagonal

1 Like

Same here, what is the current status of this? It really should have an interface for L and D seperately.