(int newRows, int newCols)
| 424 | } |
| 425 | |
| 426 | @Override |
| 427 | public void changeSize(int newRows, int newCols) |
| 428 | { |
| 429 | if(newRows <= 0) |
| 430 | throw new ArithmeticException("Matrix must have a positive number of rows"); |
| 431 | if(newCols <= 0) |
| 432 | throw new ArithmeticException("Matrix must have a positive number of columns"); |
| 433 | final int oldRows = rows.length; |
| 434 | if(newCols != cols()) |
| 435 | { |
| 436 | for(int i = 0; i < rows.length; i++) |
| 437 | { |
| 438 | final SparseVector row_i = rows[i]; |
| 439 | while(row_i.getLastNonZeroIndex() >= newCols) |
| 440 | row_i.set(row_i.getLastNonZeroIndex(), 0); |
| 441 | row_i.setLength(newCols); |
| 442 | } |
| 443 | } |
| 444 | //update new rows |
| 445 | rows = Arrays.copyOf(rows, newRows); |
| 446 | for(int i = oldRows; i < newRows; i++) |
| 447 | rows[i] = new SparseVector(newCols); |
| 448 | } |
| 449 | |
| 450 | @Override |
| 451 | public void multiplyTranspose(Matrix B, Matrix C) |
nothing calls this directly
no test coverage detected