I'm interested in computing the log of the determinant of a large, sparse, complex (floating point) matrix. My first thought is to use an LU decomposition, i.e.:
srand(123)
A=complex.(rand(3,3), rand(3,3))
LUF=lufact(A)
LUFs=lufact(sparse(A))
if round(det(LUFs[:L])*det(LUFs[:U])-det(A[LUFs[:p], LUFs[:q]]), 5)==0
println("Sparse LU determinant is correct\n")
else
println("Sparse LU determinant is NOT correct\n")
end
which will always print out the "NOT correct" option. Furthermore,
round.(LUFs[:L]*LUFs[:U], 5)==round.(A[LUFs[:p], LUFs[:q]], 5)
always comes out as false.
If instead I try to directly use
logdet(LUFs)
or
logdet(sparse(A))
I get an error:
LoadError: MethodError: no method matching
logabsdet(::Base.SparseArrays.UMFPACK.UmfpackLU{Complex{Float64},Int64})
Closest candidates are:
logabsdet(!Matched::Base.LinAlg.UnitUpperTriangular{T,S} where S<:
(AbstractArray{T,2} where T)) where T at linalg/triangular.jl:2184
logabsdet(!Matched::Base.LinAlg.UnitLowerTriangular{T,S} where S<:
(AbstractArray{T,2} where T)) where T at linalg/triangular.jl:2185
logabsdet(!Matched::Union{LowerTriangular{T,S} where S<:
(AbstractArray{T,2} where T), UpperTriangular{T,S} where S<:
(AbstractArray{T,2} where T)}) where T at linalg/triangular.jl:2189
...
while loading...
I'm not sure if it's something wrong in the way I've coded it (I'm a beginner transitioning from matlab), or if there's something wrong with my Julia install (though I have replicated these results on another computer). Any pointers you could give me would be great!