I am trying to play with KLU matrices based on KLU.jl. However, I am having false
instead of true
when I am comparing Q*((P*A*Q)\P*b) == A\b
. Could you please correct me given that the below A
and b
are taken from my real code?
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];
factor = klu(A);
julia> (A[factor.p,factor.q]\b[factor.p])[factor.q] == A\b # which is Q*((P*A*Q)\P*b) == A\b
false