I’m having issues running cholfact
on a sparse tridiagonal matrix (Julia v0.6) which works in matlab. When I try to factor L
:
L = spdiagm((-1.*v,10.*v,-1.*v),(-1,0,1))
println(typeof(L))
cholfact(L)
I get:
SparseMatrixCSC{Float64,Int64}
Base.LinAlg.PosDefException(0)
Stacktrace:
[1] #cholfact!#8(::Float64, ::Function, ::Base.SparseArrays.CHOLMOD.Factor{Float64}, ::Base.SparseArrays.CHOLMOD.Sparse{Float64}) at ./sparse/cholmod.jl:1360
[2] (::Base.LinAlg.#kw##cholfact!)(::Array{Any,1}, ::Base.LinAlg.#cholfact!, ::Base.SparseArrays.CHOLMOD.Factor{Float64}, ::Base.SparseArrays.CHOLMOD.Sparse{Float64}) at ./<missing>:0
[3] #cholfact#10(::Float64, ::Array{Int64,1}, ::Function, ::Base.SparseArrays.CHOLMOD.Sparse{Float64}) at ./sparse/cholmod.jl:1398
[4] #cholfact#11(::Array{Any,1}, ::Function, ::SparseMatrixCSC{Float64,Int64}) at ./sparse/cholmod.jl:1438
[5] cholfact(::SparseMatrixCSC{Float64,Int64}) at ./sparse/cholmod.jl:1438
[6] include_string(::String, ::String) at ./loading.jl:515
However, the following works:
L2 = sparse(rand(5,5))
println(typeof(L2))
L3 = L'*L
println(typeof(L3))
cholfact(L3)
and both L2
and L3
are of type SparseMatrixCSC{Float64,Int64}
.