| 362 | } |
| 363 | |
| 364 | @Override |
| 365 | public void transposeMultiply(double c, Vec b, Vec x) |
| 366 | { |
| 367 | if(this.rows() != b.length()) |
| 368 | throw new ArithmeticException("Matrix dimensions do not agree, [" + cols() +"," + rows() + "] x [" + b.length() + ",1]" ); |
| 369 | else if(this.cols() != x.length()) |
| 370 | throw new ArithmeticException("Matrix dimensions do not agree with target vector"); |
| 371 | |
| 372 | for(int i = 0; i < rows(); i++)//if b was sparce, we want to skip every time b_i = 0 |
| 373 | { |
| 374 | double b_i = b.get(i); |
| 375 | if(b_i == 0)//Skip, not quite as good as sparce handeling |
| 376 | continue;//TODO handle sparce input vector better |
| 377 | |
| 378 | for(int j = 0; j < cols(); j++) |
| 379 | x.increment(j, c*b_i*this.get(i, j)); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | @Override |
| 384 | public void transposeMultiply(final Matrix b, Matrix C) |