I want to solve a system of equation Ax = b using A\b where A and b are sparse matrix and vector. Also matrix A is symmetric positive definite. However I got an error says:
“ERROR: LoadError: MethodError: no method matching lu!(::SparseMatrixCSC{Float64,Int64}, ::Val{true}; check=true)”
I create two simple examples and try to figure why but I am confused now. Below is the examples.
using SparseArrays
# this one is ok
A1 = sparse([1,1,2],[1,2,2],[1.0,2.0,3.0])
b1 = sparsevec([2],[1.0])
c1 = A1\b1
# this one does not
A2 = sparse([1,1,2,2],[1,2,1,2],[1.0,2.0,2.0,6.0])
b2 = sparsevec([2],[1.0])
c2 = A2\b2
c1 = A1\b1 can be solved but A2\b2 throws an error which is the same as the one above. The A2 here is not sparse but the actual matrix I need to solve is definitely sparse. Since this example gives me the same error, so I think the sparsity is not an issue.
I am using Julia 1.4.2.
Any suggestions will be helpful. Thank you in advance.