@Override public void zero() { this.internalVector.zero(); }
@Override public void zero() { this.internalVector.zero(); }
@Override public void zero() { this.internalVector.zero(); }
public Vector transMult(double alpha, Vector x, Vector y) { return transMultAdd(alpha, x, y.zero()); }
public Vector mult(double alpha, Vector x, Vector y) { return multAdd(alpha, x, y.zero()); }
public Vector transMult(double alpha, Vector x, Vector y) { return transMultAdd(alpha, x, y.zero()); }
public Vector mult(double alpha, Vector x, Vector y) { return multAdd(alpha, x, y.zero()); }
/** * Sets the restart parameter * * @param restart * GMRES iteration is restarted after this number of iterations */ public void setRestart(int restart) { this.restart = restart; if (restart <= 0) throw new IllegalArgumentException( "restart must be a positive integer"); s = new DenseVector(restart + 1); H = new DenseMatrix(restart + 1, restart); rotation = new GivensRotation[restart + 1]; v = new Vector[restart + 1]; for (int i = 0; i < v.length; ++i) v[i] = r.copy().zero(); }
/** * Sets the restart parameter * * @param restart * GMRES iteration is restarted after this number of iterations */ public void setRestart(int restart) { this.restart = restart; if (restart <= 0) throw new IllegalArgumentException( "restart must be a positive integer"); s = new DenseVector(restart + 1); H = new DenseMatrix(restart + 1, restart); rotation = new GivensRotation[restart + 1]; v = new Vector[restart + 1]; for (int i = 0; i < v.length; ++i) v[i] = r.copy().zero(); }
@Override public Vector transMult(Vector x, Vector y) { if (!(x instanceof DenseVector) || !(y instanceof DenseVector)) return super.transMult(x, y); checkTransMultAdd(x, y); double[] xd = ((DenseVector) x).getData(); double[] yd = ((DenseVector) y).getData(); y.zero(); for (int i = 0; i < numRows; ++i) for (int j = rowPointer[i]; j < rowPointer[i + 1]; ++j) yd[columnIndex[j]] += data[j] * xd[i]; return y; }
@Override public Vector transMult(Vector x, Vector y) { if (!(x instanceof DenseVector) || !(y instanceof DenseVector)) return super.transMult(x, y); checkTransMultAdd(x, y); double[] xd = ((DenseVector) x).getData(); double[] yd = ((DenseVector) y).getData(); y.zero(); for (int i = 0; i < numRows; ++i) for (int j = rowPointer[i]; j < rowPointer[i + 1]; ++j) yd[columnIndex[j]] += data[j] * xd[i]; return y; }
@Override public Vector mult(Vector x, Vector y) { if (!(x instanceof DenseVector) || !(y instanceof DenseVector)) return super.mult(x, y); checkMultAdd(x, y); double[] xd = ((DenseVector) x).getData(); double[] yd = ((DenseVector) y).getData(); y.zero(); for (int i = 0; i < ind.length; ++i) { int row = ind[i] < 0 ? -ind[i] : 0; int column = ind[i] > 0 ? ind[i] : 0; double[] locDiag = diag[i]; for (int j = 0; j < locDiag.length; ++j, ++row, ++column) yd[row] += locDiag[j] * xd[column]; } return y; }
@Override public Vector mult(Vector x, Vector y) { if (!(x instanceof DenseVector) || !(y instanceof DenseVector)) return super.mult(x, y); checkMultAdd(x, y); double[] xd = ((DenseVector) x).getData(); double[] yd = ((DenseVector) y).getData(); y.zero(); for (int i = 0; i < ind.length; ++i) { int row = ind[i] < 0 ? -ind[i] : 0; int column = ind[i] > 0 ? ind[i] : 0; double[] locDiag = diag[i]; for (int j = 0; j < locDiag.length; ++j, ++row, ++column) yd[row] += locDiag[j] * xd[column]; } return y; }