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
SparseMatrix(int rowCount, int columnCount, int[] columnStart, int[] rowIndices, double[] values) {
this.rowCount = rowCount;
this.columnCount = columnCount;
this.columnStart = Objects.requireNonNull(columnStart);
this.currentColumn = values.length;//Initialize here
columnValueCount = new int[columnCount];
this.rowIndices = new TIntArrayListHack(Objects.requireNonNull(rowIndices));
this.values = new TDoubleArrayListHack(Objects.requireNonNull(values));
fillColumnValueCount(this.columnCount, this.columnStart, columnValueCount, this.values);
}
}
Environment
powsybl-core 6.2.0-SNAPSHOT
Relevant Log Output
No response
Extra Information
No response
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