@Test(expected = PowsyblException.class) public void testWrongColumnOrder() { Matrix a = matrixFactory.create(2, 2, 2); a.set(0, 0, 1d); a.set(1, 0, 1d); a.set(0, 1, 1d); a.set(1, 0, 1d); }
@Override public void set(int i, int j, double value) { checkBounds(i, j); if (j == currentColumn) { } else if (j > currentColumn) { columnStart[j] = values.size(); currentColumn = j; } else { throw new PowsyblException("Columns have to be filled in the right order"); } values.add(value); rowIndices.add(i); columnStart[columnStart.length - 1] = values.size(); columnValueCount[j]++; }
SparseMatrix extends AbstractMatrix { @Override public void set(int i, int j, double value) { checkBounds(i, j); if (j == currentColumn) { } else if (j > currentColumn) { columnStart[j] = values.size(); currentColumn = j; } else { throw new PowsyblException("Columns have to be filled in the right order"); } values.add(value); rowIndices.add(i); columnStart[columnStart.length - 1] = values.size(); columnValueCount[j]++; } }
SparseMatrix extends AbstractMatrix { @Override public void set(int i, int j, double value) { checkBounds(i, j); if (j == currentColumn) { } else if (j > currentColumn) { columnStart[j] = values.size(); currentColumn = j; } else { throw new PowsyblException("Columns have to be filled in the right order"); } values.add(value); rowIndices.add(i); columnStart[columnStart.length - 1] = values.size(); columnValueCount[j]++; } SparseMatrix(int rowCount, int columnCount, int[] columnStart, int[] rowIndices, double[] values);   SparseMatrix(int rowCount, int columnCount, int estimatedNonZeroValueCount); }
SparseMatrix extends AbstractMatrix { @Override public void set(int i, int j, double value) { checkBounds(i, j); if (j == currentColumn) { } else if (j > currentColumn) { columnStart[j] = values.size(); currentColumn = j; } else { throw new PowsyblException("Columns have to be filled in the right order"); } values.add(value); rowIndices.add(i); columnStart[columnStart.length - 1] = values.size(); columnValueCount[j]++; } SparseMatrix(int rowCount, int columnCount, int[] columnStart, int[] rowIndices, double[] values);   SparseMatrix(int rowCount, int columnCount, int estimatedNonZeroValueCount); @Override int getRowCount(); @Override int getColumnCount(); @Override void set(int i, int j, double value); @Override void add(int i, int j, double value); @Override Element addAndGetElement(int i, int j, double value); @Override void reset(); @Override LUDecomposition decomposeLU(); @Override Matrix times(Matrix other); @Override void iterateNonZeroValue(ElementHandler handler); @Override void iterateNonZeroValueOfColumn(int j, ElementHandler handler); @Override DenseMatrix toDense(); @Override SparseMatrix toSparse(); @Override Matrix to(MatrixFactory factory); @Override void print(PrintStream out); @Override void print(PrintStream out, List<String> rowNames, List<String> columnNames); @Override int hashCode(); @Override boolean equals(Object obj); }
SparseMatrix extends AbstractMatrix { @Override public void set(int i, int j, double value) { checkBounds(i, j); if (j == currentColumn) { } else if (j > currentColumn) { columnStart[j] = values.size(); currentColumn = j; } else { throw new PowsyblException("Columns have to be filled in the right order"); } values.add(value); rowIndices.add(i); columnStart[columnStart.length - 1] = values.size(); columnValueCount[j]++; } SparseMatrix(int rowCount, int columnCount, int[] columnStart, int[] rowIndices, double[] values);   SparseMatrix(int rowCount, int columnCount, int estimatedNonZeroValueCount); @Override int getRowCount(); @Override int getColumnCount(); @Override void set(int i, int j, double value); @Override void add(int i, int j, double value); @Override Element addAndGetElement(int i, int j, double value); @Override void reset(); @Override LUDecomposition decomposeLU(); @Override Matrix times(Matrix other); @Override void iterateNonZeroValue(ElementHandler handler); @Override void iterateNonZeroValueOfColumn(int j, ElementHandler handler); @Override DenseMatrix toDense(); @Override SparseMatrix toSparse(); @Override Matrix to(MatrixFactory factory); @Override void print(PrintStream out); @Override void print(PrintStream out, List<String> rowNames, List<String> columnNames); @Override int hashCode(); @Override boolean equals(Object obj);  }