public void setQuick(int row, int column, double value) { elements[row].setQuick(column, value); }
public void setQuick(int row, int column, double value) { elements[column].setQuick(row, value); }
public void setQuick(int row, int column, double value) { elements[column].setQuick(row, value); }
public void setQuick(int row, int column, double value) { elements[row].setQuick(column, value); }
public DoubleMatrix1D vectorize() { SparseDoubleMatrix1D v = new SparseDoubleMatrix1D((int) size()); int idx = 0; for (int c = 0; c < columns; c++) { for (int r = 0; r < rows; r++) { double elem = getQuick(r, c); v.setQuick(idx++, elem); } } return v; }
public DoubleMatrix1D vectorize() { SparseDoubleMatrix1D v = new SparseDoubleMatrix1D((int) size()); int idx = 0; for (int c = 0; c < columns; c++) { for (int r = 0; r < rows; r++) { double elem = getQuick(r, c); v.setQuick(idx++, elem); } } return v; }
/** * Returns a vector obtained by stacking the columns of the matrix on top of * one another. * * @return */ public DoubleMatrix1D vectorize() { SparseDoubleMatrix1D v = new SparseDoubleMatrix1D((int) size()); int idx = 0; for (int c = 0; c < columns; c++) { for (int r = 0; r < rows; r++) { v.setQuick(idx++, getQuick(c, r)); } } return v; }
/** * Returns a vector obtained by stacking the columns of the matrix on top of * one another. * * @return */ public DoubleMatrix1D vectorize() { SparseDoubleMatrix1D v = new SparseDoubleMatrix1D((int) size()); int idx = 0; for (int c = 0; c < columns; c++) { for (int r = 0; r < rows; r++) { v.setQuick(idx++, getQuick(c, r)); } } return v; }
private void factor() { int n = LU.rows(); for (int i = 1; i < n; ++i) { // Get row i SparseDoubleMatrix1D rowi = LU.viewRow(i); // Drop tolerance on current row double taui = DenseDoubleAlgebra.DEFAULT.norm(rowi, Norm.Two) * tau; for (int k = 0; k < i; ++k) { // Get row k SparseDoubleMatrix1D rowk = LU.viewRow(k); if (rowk.getQuick(k) == 0) throw new RuntimeException("Zero diagonal entry on row " + (k + 1) + " during ILU process"); double LUik = rowi.getQuick(k) / rowk.getQuick(k); // Check for small elimination entry if (Math.abs(LUik) <= taui) continue; // Traverse the sparse row k, reducing row i int rowUsed = (int) rowk.size(); for (int j = k + 1; j < rowUsed; ++j) rowi.setQuick(j, rowi.getQuick(j) - LUik * rowk.getQuick(j)); // The above has overwritten LUik, so remedy that rowi.setQuick(k, LUik); } // Store back into the LU matrix, dropping as needed gather(rowi, taui, i); } // System.out.println(LU.toString()); }
private void factor() { int n = LU.rows(); for (int i = 1; i < n; ++i) { // Get row i SparseDoubleMatrix1D rowi = LU.viewRow(i); // Drop tolerance on current row double taui = DenseDoubleAlgebra.DEFAULT.norm(rowi, Norm.Two) * tau; for (int k = 0; k < i; ++k) { // Get row k SparseDoubleMatrix1D rowk = LU.viewRow(k); if (rowk.getQuick(k) == 0) throw new RuntimeException("Zero diagonal entry on row " + (k + 1) + " during ILU process"); double LUik = rowi.getQuick(k) / rowk.getQuick(k); // Check for small elimination entry if (Math.abs(LUik) <= taui) continue; // Traverse the sparse row k, reducing row i int rowUsed = (int) rowk.size(); for (int j = k + 1; j < rowUsed; ++j) rowi.setQuick(j, rowi.getQuick(j) - LUik * rowk.getQuick(j)); // The above has overwritten LUik, so remedy that rowi.setQuick(k, LUik); } // Store back into the LU matrix, dropping as needed gather(rowi, taui, i); } // System.out.println(LU.toString()); }
m = DoubleFactory1D.sparse.make(size.numEntries()); for (i = 0; i < size.numEntries(); i++) ((SparseDoubleMatrix1D) m).setQuick(i, data[i]); } else { throw new UnsupportedOperationException();
m = DoubleFactory1D.sparse.make(size.numEntries()); for (i = 0; i < size.numEntries(); i++) ((SparseDoubleMatrix1D) m).setQuick(i, data[i]); } else { throw new UnsupportedOperationException();
m = DoubleFactory1D.sparse.make(size.numEntries()); for (i = 0; i < size.numEntries(); i++) ((SparseDoubleMatrix1D) m).setQuick(i, data[i]); } else { throw new UnsupportedOperationException();