Open H-Dynamite opened 11 months ago
Thanks for reporting this issue. I will open a PR on core repo. Is your original need to copy an existing sparse matrix or build a sparse matrix from provided arrays ?
I initially wanted to use arrays to quickly construct a sparse matrix for testing the performance of KLU. Surprisingly, the decomposition speed of KLU is very fast. I am grateful that we have developed such a great library.
Describe the current behavior
Using SparseMatrix (int rowCount, int columnCount, int [] columnStart, int [] rowIndicators, double [] values) causes LU decomposition to fail
error log:
Exception in thread "main" com.powsybl.math.matrix.MatrixException: klu_analyze error KLU_INVALID at com.powsybl.math.matrix.SparseLUDecomposition.init(Native Method) at com.powsybl.math.matrix.SparseLUDecomposition.init(SparseLUDecomposition.java:49) at com.powsybl.math.matrix.SparseLUDecomposition.(SparseLUDecomposition.java:43)
at com.powsybl.math.matrix.SparseMatrix.decomposeLU(SparseMatrix.java:330)
at com.powsybl.math.matrix.SparseMatrixTest.main(SparseMatrixTest.java:121)
Describe the expected behavior
Expected decomposition successful
Describe the steps
SparseMatrix a =new SparseMatrix(2, 2, 2); a.add(0, 0, 1d); a.add(1, 0, 1d); a.add(0, 1, 1d); SparseMatrix m = new SparseMatrix(a.getRowCount(), a.getColumnCount(), a.getColumnStart(), a.getRowIndices(), a.getValues()); LUDecomposition decomposition = m.decomposeLU();
Problem solving:
This issue is caused by the variable "currentColumn" not being assigned during initialization
}
Environment
powsybl-core 6.2.0-SNAPSHOT
Relevant Log Output
No response
Extra Information
No response