Creates a vector that has a copy of the values in column j of this matrix. Altering it will not effect the values in this matrix @param j the column to copy @return a clone of the column as a Vec
(int j)
| 608 | * @return a clone of the column as a {@link Vec} |
| 609 | */ |
| 610 | public Vec getColumn(int j) |
| 611 | { |
| 612 | if(j < 0 || j >= cols()) |
| 613 | throw new ArithmeticException("Column was not a valid value " + j + " not in [0," + (cols()-1) + "]"); |
| 614 | DenseVector c = new DenseVector(rows()); |
| 615 | for(int i =0; i < rows(); i++) |
| 616 | c.set(i, get(i, j)); |
| 617 | return c; |
| 618 | } |
| 619 | |
| 620 | /** |
| 621 | * Obtains a vector that is backed by <i>this</i>, at very little memory |