/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified number of slices, rows and columns. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix3D</tt> the new matrix must also be of type <tt>DenseDoubleMatrix3D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix3D</tt> the new matrix must also be of type <tt>SparseDoubleMatrix3D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @param slices the number of slices the matrix shall have. * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @return a new empty matrix of the same dynamic type. */ public DoubleMatrix3D like(int slices, int rows, int columns) { return new DenseDoubleMatrix3D(slices,rows,columns); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified number of slices, rows and columns. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix3D</tt> the new matrix must also be of type <tt>DenseDoubleMatrix3D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix3D</tt> the new matrix must also be of type <tt>SparseDoubleMatrix3D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @param slices the number of slices the matrix shall have. * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @return a new empty matrix of the same dynamic type. */ public DoubleMatrix3D like(int slices, int rows, int columns) { return new DenseDoubleMatrix3D(slices,rows,columns); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified number of slices, rows and columns. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix3D</tt> the new matrix must also be of type <tt>DenseDoubleMatrix3D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix3D</tt> the new matrix must also be of type <tt>SparseDoubleMatrix3D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @param slices the number of slices the matrix shall have. * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @return a new empty matrix of the same dynamic type. */ public DoubleMatrix3D like(int slices, int rows, int columns) { return new DenseDoubleMatrix3D(slices,rows,columns); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified number of slices, rows and columns. * For example, if the receiver is an instance of type <tt>DenseDoubleMatrix3D</tt> the new matrix must also be of type <tt>DenseDoubleMatrix3D</tt>, * if the receiver is an instance of type <tt>SparseDoubleMatrix3D</tt> the new matrix must also be of type <tt>SparseDoubleMatrix3D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @param slices the number of slices the matrix shall have. * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @return a new empty matrix of the same dynamic type. */ public DoubleMatrix3D like(int slices, int rows, int columns) { return new DenseDoubleMatrix3D(slices,rows,columns); } /**
/** * Constructs a matrix with the given shape, each cell initialized with zero. */ public DoubleMatrix3D make(int slices, int rows, int columns) { if (this==sparse) return new SparseDoubleMatrix3D(slices,rows,columns); return new DenseDoubleMatrix3D(slices,rows,columns); } /**
/** * Constructs a matrix with the given shape, each cell initialized with zero. */ public DoubleMatrix3D make(int slices, int rows, int columns) { if (this==sparse) return new SparseDoubleMatrix3D(slices,rows,columns); return new DenseDoubleMatrix3D(slices,rows,columns); } /**
/** * Constructs a matrix with the given cell values. * <tt>values</tt> is required to have the form <tt>values[slice][row][column]</tt> * and have exactly the same number of slices, rows and columns as the receiver. * <p> * The values are copied. So subsequent changes in <tt>values</tt> are not reflected in the matrix, and vice-versa. * * @param values the values to be filled into the cells. * @return <tt>this</tt> (for convenience only). * @throws IllegalArgumentException if <tt>values.length != slices() || for any 0 <= slice < slices(): values[slice].length != rows()</tt>. * @throws IllegalArgumentException if <tt>for any 0 <= column < columns(): values[slice][row].length != columns()</tt>. */ public DoubleMatrix3D make(double[][][] values) { if (this==sparse) return new SparseDoubleMatrix3D(values); return new DenseDoubleMatrix3D(values); } /**
/** * Constructs a matrix with the given cell values. * <tt>values</tt> is required to have the form <tt>values[slice][row][column]</tt> * and have exactly the same number of slices, rows and columns as the receiver. * <p> * The values are copied. So subsequent changes in <tt>values</tt> are not reflected in the matrix, and vice-versa. * * @param values the values to be filled into the cells. * @return <tt>this</tt> (for convenience only). * @throws IllegalArgumentException if <tt>values.length != slices() || for any 0 <= slice < slices(): values[slice].length != rows()</tt>. * @throws IllegalArgumentException if <tt>for any 0 <= column < columns(): values[slice][row].length != columns()</tt>. */ public DoubleMatrix3D make(double[][][] values) { if (this==sparse) return new SparseDoubleMatrix3D(values); return new DenseDoubleMatrix3D(values); } /**