| 535 | } |
| 536 | |
| 537 | @Override |
| 538 | public void multiply(double c, Matrix A, Vec b) |
| 539 | { |
| 540 | if(this.length() != A.rows()) |
| 541 | throw new ArithmeticException("Vector x Matrix dimensions do not agree"); |
| 542 | else if(b.length() != A.cols()) |
| 543 | throw new ArithmeticException("Destination vector is not the right size"); |
| 544 | |
| 545 | for(int i = 0; i < used; i++) |
| 546 | { |
| 547 | double val = c*this.values[i]; |
| 548 | int index = this.indexes[i]; |
| 549 | for(int j = 0; j < A.cols(); j++) |
| 550 | b.increment(j, val*A.get(index, j)); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | @Override |
| 555 | public void mutableAdd(double c) |