// return the matrix-vector product b = Ax public SparseVector times(SparseVector x) { SparseRowMatrix A = this; if (N != x.size()) throw new RuntimeException("Dimensions disagree"); SparseVector b = new SparseVector(N); for (int i = 0; i < N; i++) b.put(i, A.rows[i].dot(x)); return b; }
/** Sets the given row equal the passed vector */ public void setRow(int i, SparseVector x) { if (x.size() != numColumns) throw new IllegalArgumentException("New row must be of the same size as existing row"); rowD[i] = x; }