Alters row i of this matrix, such that A[i,:] = A[i,:] + c b @param i the index of the row to update @param c the scalar constant to multiply the vector by @param b the vector to add to the specified row
(int i, double c, Vec b)
| 857 | * @param b the vector to add to the specified row |
| 858 | */ |
| 859 | public void updateRow(int i, double c, Vec b) |
| 860 | { |
| 861 | if(b.length() != this.cols()) |
| 862 | throw new ArithmeticException("vector is not of the same column length"); |
| 863 | if (b.isSparse()) |
| 864 | for (IndexValue iv : b) |
| 865 | this.increment(i, iv.getIndex(), c * iv.getValue()); |
| 866 | else |
| 867 | for (int j = 0; j < b.length(); j++) |
| 868 | this.increment(i, j, c * b.get(j)); |
| 869 | } |
| 870 | |
| 871 | /** |
| 872 | * Alters the matrix <i>A</i> such that, |