public void run() { for (int r = firstRow; r < lastRow; r++) { double[] currentRow = values[r]; for (int c = 0; c < columns; c++) { currentRow[c] = getQuick(r, c); } } } });
public Double call() throws Exception { double sum = 0; double elem; for (int r = firstRow; r < lastRow; r++) { for (int c = 0; c < columns; c++) { elem = X.getQuick(r, c); sum += (elem * elem); } } return sum; } });
public Integer call() throws Exception { int cardinality = 0; for (int r = firstRow; r < lastRow; r++) { for (int c = 0; c < columns; c++) { if (getQuick(r, c) != 0) cardinality++; } } return Integer.valueOf(cardinality); } });
public Double call() throws Exception { double a = f.apply(getQuick(firstRow, 0), other.getQuick(firstRow, 0)); int d = 1; for (int r = firstRow; r < lastRow; r++) { for (int c = d; c < columns; c++) { a = aggr.apply(a, f.apply(getQuick(r, c), other.getQuick(r, c))); } d = 0; } return Double.valueOf(a); } });
public Double call() throws Exception { double a = f.apply(getQuick(firstRow, 0), other.getQuick(firstRow, 0)); int d = 1; for (int r = firstRow; r < lastRow; r++) { for (int c = d; c < columns; c++) { a = aggr.apply(a, f.apply(getQuick(r, c), other.getQuick(r, c))); } d = 0; } return Double.valueOf(a); } });
public void setMatrix(DoubleMatrix2D A) { if (A.rows() != invdiag.length) throw new IllegalArgumentException("Matrix size differs from preconditioner size"); for (int i = 0; i < invdiag.length; ++i) { invdiag[i] = A.getQuick(i, i); if (invdiag[i] == 0) // Avoid zero-division throw new RuntimeException("Zero diagonal on row " + (i + 1)); else invdiag[i] = 1 / invdiag[i]; } }
public void run() { for (int r = firstRow; r < lastRow; r++) { for (int c = 0; c < columns; c++) { setQuick(r, c, source.getQuick(r, c)); } } } });
public boolean apply(long key, double value) { int i = (int) (key / columns); int j = (int) (key % columns); double r = value / y.getQuick(i, j); if (r != value) elements.put(key, r); return true; } });
public void setMatrix(DoubleMatrix2D A) { if (A.rows() != invdiag.length) throw new IllegalArgumentException("Matrix size differs from preconditioner size"); for (int i = 0; i < invdiag.length; ++i) { invdiag[i] = A.getQuick(i, i); if (invdiag[i] == 0) // Avoid zero-division throw new RuntimeException("Zero diagonal on row " + (i + 1)); else invdiag[i] = 1 / invdiag[i]; } }
/** * Returns the sum of the diagonal elements of matrix <tt>A</tt>; * <tt>Sum(A[i,i])</tt>. */ public double trace(DoubleMatrix2D A) { double sum = 0; for (int i = Math.min(A.rows(), A.columns()); --i >= 0;) { sum += A.getQuick(i, i); } return sum; }
public void run() { double elem; for (int r = firstRow; r < lastRow; r++) { for (int c = 0; c < columns; c++) { elem = getQuick(r, c); if (cond.apply(elem) == true) { setQuick(r, c, value); } } } } });
public void run() { for (int r = firstRow; r < lastRow; r++) { for (int c = 0; c < columns; c++) { double re = getQuick(r, c)[0]; double im = other.getQuick(r, c); setQuick(r, c, re, im); } } } });
public void run() { for (int r = firstRow; r < lastRow; r++) { for (int c = 0; c < columns; c++) { double re = getQuick(r, c)[0]; double im = other.getQuick(r, c); setQuick(r, c, re, im); } } } });
public void run() { double elem; for (int r = firstRow; r < lastRow; r++) { for (int c = 0; c < columns; c++) { elem = getQuick(r, c); if (cond.apply(elem) == true) { setQuick(r, c, f.apply(elem)); } } } } });
public void run() { for (int r = firstRow; r < lastRow; r++) { double s = 0; for (int c = 0; c < columns; c++) { s += getQuick(r, c) * y.getQuick(c); } zz.setQuick(r, alpha * s + beta * zz.getQuick(r)); } } });