Logo Search packages:      
Sourcecode: jblas version File versions  Download package

org::jblas::la::DoubleMatrix::DoubleMatrix ( double  data[][]  )  [inline]

Creates a new n times m DoubleMatrix from the given n times m 2D data array. The first dimension of the array makes the rows (n) and the second dimension the columns (m). For example, the given code

new DoubleMatrix(new double[][]{{1d, 2d, 3d}, {4d, 5d, 6d}, {7d, 8d, 9d}}).print();

will constructs the following matrix:

 1.0	2.0	3.0
 4.0	5.0	6.0
 7.0	8.0	9.0
 
.
Parameters:
data n times m data array

Definition at line 360 of file DoubleMatrix.java.

References columns, length, put(), and rows.

                                         {
        this(data.length, data[0].length);

        for (int r = 0; r < rows; r++) {
            assert (data[r].length == columns);
        }

        for (int r = 0; r < rows; r++) {
            for (int c = 0; c < columns; c++) {
                put(r, c, data[r][c]);
            }
        }
    }


Generated by  Doxygen 1.6.0   Back to index