| 269 | } |
| 270 | |
| 271 | @Override |
| 272 | public void multiply(double c, Matrix A, Vec b) |
| 273 | { |
| 274 | if(this.length() != A.rows()) |
| 275 | throw new ArithmeticException("Vector x Matrix dimensions do not agree [1," + this.length() + "] x [" + A.rows() + ", " + A.cols() + "]"); |
| 276 | if(b.length() != A.cols()) |
| 277 | throw new ArithmeticException("Destination vector is not the right size"); |
| 278 | |
| 279 | for(int i = 0; i < this.length(); i++) |
| 280 | { |
| 281 | double this_i = c*this.array[i+this.startIndex]; |
| 282 | for(int j = 0; j < A.cols(); j++) |
| 283 | b.increment(j, this_i*A.get(i, j)); |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | @Override |
| 288 | public void mutableAdd(double c) |