Could you please help me to solve the error in my MWE (A,b,p,q
are snipped from real code)? The error says the problem is with typeof(A[p,q][1:6,1:6)
however its type is SparseMatrixCSC{Float64, Int64}
.
using SparseArrays, LinearAlgebra
A = sparse([0.0137346 0 0 0 0 0 0 0 0 -0.00123457 0 0 0 0 0;
0 0.0137346 0 0 0 0 0 0 0 0 -0.00123457 0 0 0 0;
0 0 0.0137346 0 0 0 0 0 0 0 0 -0.00123457 0 0 0;
0 0 0 1.0 0 0 -1.0 0 0 0 0 0 1.0 0 0;
0 0 0 0 1.0 0 0 -1.0 0 0 0 0 0 1.0 0;
0 0 0 0 0 1.0 0 0 -1.0 0 0 0 0 0 1.0;
0 0 0 -1.0 0 0 1.00302 -0.000705766 -0.000705766 0 0 0 0 0 0;
0 0 0 0 -1.0 0 -0.000705766 1.00302 -0.000705766 0 0 0 0 0 0;
0 0 0 0 0 -1.0 -0.000705766 -0.000705766 1.00302 0 0 0 0 0 0;
-0.00123457 0 0 0 0 0 0 0 0 0.00425693 -0.000705766 -0.000705766 0 0 0;
0 -0.00123457 0 0 0 0 0 0 0 -0.000705766 0.00425693 -0.000705766 0 0 0;
0 0 -0.00123457 0 0 0 0 0 0 -0.000705766 -0.000705766 0.00425693 0 0 0;
0 0 0 1.0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 1.0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 1.0 0 0 0 0 0 0 0 0 0]);
b = [-1.7632749965554524,4.5258858371825, -2.7626108406269907, 0.0, 0.0, 0.0, -84.69238104647695, 334.2439006136896, -249.55151956721267, 14.008262358676006, -19.104993786251043, 5.096731427574866,
16329.20635908069, -8031.318664614193, -8297.88769446649];
# p,q are permutation matrices
p =[1,2,3,11,12,10,4,5,6,7,8,9,13,14,15];
q =[1,2,3,11,12,10,13,14,15,7,8,9,4,5,6];
x = A[p,q][1:6,1:6] \ @view( b[p[1:6]] ); # nor .....x = @view( A[p,q][1:6,1:6] ) \ @view( b[p[1:6]] )
ERROR: MethodError: no method matching lu!(::SparseMatrixCSC{Float64, Int64}, ::RowMaximum; check=true)
Closest candidates are:
lu!(::StridedMatrix{T}, ::RowMaximum; check) where T<:Union{Float32, Float64, ComplexF32, ComplexF64} at julia\stdlib\v1.8\LinearAlgebra\src\lu.jl:80
lu!(::Union{Hermitian{T, S}, Symmetric{T, S}} where {T, S}, ::Union{NoPivot, RowMaximum}; check) at Julia-1.8.0-beta1\share\julia\stdlib\v1.8\LinearAlgebra\src\lu.jl:89
lu!(::StridedMatrix{T} where T, ::Union{NoPivot, RowMaximum}; check) at Julia-1.8.0-beta1\share\julia\stdlib\v1.8\LinearAlgebra\src\lu.jl:135
Any help here please?