I'm new at Julia-Lang and I'm trying to solve a symmetric tridiagonal system in Julia several times, so I, assemble my matrix as
SymTridiagonal( e ,ones(L-4) )
what changes in my system is the right-hand side. So I tried to use Chris Rackauckas solution on this thread, which I quote:
Just do X=lufact(X) and then X\b
The thing is that when I do that I get
ERROR: LoadError: MethodError: no method matching lufact!(::SymTridiagonal{Float64})
lufact!(!Matched::Union{Base.ReshapedArray{T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64},2,A,MI}
So my question is: What is the right way to make the imput to lufact! function
The default factorization for
SymTridiagonal
matrices is LDLt (obtained fromldltfact
), instead of LU (obtained fromlufact
). If you just want to solve the systemAx=b
whereA
is aSymTridiagonal
it is enough to doand julia will dispatch to
ldltfact
to solve the problem. If you want to be explicit about it (or want to use the factorization for something else) you can useIf specifically need an LU-factorization you can use
as pointed out in the comments, but it is more efficient to use
ldltfact
in this case.