# Doubt about "nzval" field in factorization?

I have the below MWE. I have two things:
1- The matrices of `factor` and `factor1` are different. However, why the fifth element of `factor.nzval=7` not `6`. but the matrices of ``?

``````using SparseArrays, LinearAlgebra, KLU
A_Mat = spzeros(3,3);
A_Mat[diagind(A_Mat)[1:3]] .= 1.0;
A_Mat[2,1] = 9; A_Mat[3,1] = 10; A_Mat[1,3] = 6;
b_Mat = zeros(3); b_Mat[1,1] = 2.0; b_Mat[2,1] = 3; b_Mat[3,1] = 4;
x_Mat = zeros(3);
factor = klu(A_Mat);
A_Mat[1,3] = 7;
factor1 = klu(A_Mat);
ldiv!(x_Mat, factor, b_Mat)
julia> factor.nzval
6-element Vector{Float64}:
1.0
9.0
10.0
1.0
7.0
1.0

julia> factor1.nzval
6-element Vector{Float64}:
1.0
9.0
10.0
1.0
7.0
1.0
``````

2- In the REPL, I can see all the matrices of factor, for example `factor.L`, but I cannot see them in the workspace (variables/global(main)) in VS code. Any reason for that?

`factor.nzval` and `factor1.nzval` work, but they are not properties of `KLUFactorization`. `factor.L.nzval` and `factor1.L.nzval` give the different results that are expected.

The way `KLUFactorization` `getproperty` function is defined passes unrecognized values to `getfield` on the structure, which has an `nzval` (the purpose of which I hadn’t investigated).

Hope this clear up something. Maybe a PR is necessary not to allow access to every `KLUFactorization` field with `getproperty`.

2 Likes

They are properties of `A_Mat`, right?
What is `PR`?