public DoubleMatrix3D like(int slices, int rows, int columns) { return new DenseDoubleMatrix3D(slices, rows, columns); }
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); }
public DoubleMatrix3D reshape(int slices, int rows, int columns) { if (slices * rows * columns != size) { throw new IllegalArgumentException("slices*rows*columns != size"); } DoubleMatrix3D M = new DenseDoubleMatrix3D(slices, rows, columns); final double[] elementsOther = (double[]) M.elements(); final int zeroOther = (int) M.index(0, 0, 0); final int sliceStrideOther = M.sliceStride(); final int rowStrideOther = M.rowStride(); final int colStrideOther = M.columnStride(); int idxOther; int idx = 0; for (int s = 0; s < slices; s++) { for (int c = 0; c < columns; c++) { idxOther = zeroOther + s * sliceStrideOther + c * colStrideOther; for (int r = 0; r < rows; r++) { elementsOther[idxOther] = getQuick(idx++); idxOther += rowStrideOther; } } } return M; }
public DoubleMatrix3D reshape(int slices, int rows, int columns) { if (slices * rows * columns != size) { throw new IllegalArgumentException("slices*rows*columns != size"); } DoubleMatrix3D M = new DenseDoubleMatrix3D(slices, rows, columns); final double[] elementsOther = (double[]) M.elements(); final int zeroOther = (int) M.index(0, 0, 0); final int sliceStrideOther = M.sliceStride(); final int rowStrideOther = M.rowStride(); final int colStrideOther = M.columnStride(); int idxOther; int idx = 0; for (int s = 0; s < slices; s++) { for (int c = 0; c < columns; c++) { idxOther = zeroOther + s * sliceStrideOther + c * colStrideOther; for (int r = 0; r < rows; r++) { elementsOther[idxOther] = getQuick(idx++); idxOther += rowStrideOther; } } } return M; }
throw new IllegalArgumentException("slices*rows*columns != size"); DoubleMatrix3D M = new DenseDoubleMatrix3D(slices, rows, columns); final double[] elementsOther = (double[]) M.elements(); final int zeroOther = (int) M.index(0, 0, 0);
throw new IllegalArgumentException("slices*rows*columns != size"); DoubleMatrix3D M = new DenseDoubleMatrix3D(slices, rows, columns); final double[] elementsOther = (double[]) M.elements(); final int zeroOther = (int) M.index(0, 0, 0);
public DoubleMatrix3D getRealPart() { final DenseDoubleMatrix3D R = new DenseDoubleMatrix3D(slices, rows, columns); final double[] elemsOther = R.elements(); final int sliceStrideOther = R.sliceStride();
public DoubleMatrix3D getImaginaryPart() { final DenseDoubleMatrix3D Im = new DenseDoubleMatrix3D(slices, rows, columns); final double[] elemsOther = Im.elements(); final int sliceStrideOther = Im.sliceStride();
public DoubleMatrix3D getImaginaryPart() { final DenseDoubleMatrix3D Im = new DenseDoubleMatrix3D(slices, rows, columns); final double[] elemsOther = Im.elements(); final int sliceStrideOther = Im.sliceStride();
public DoubleMatrix3D getRealPart() { final DenseDoubleMatrix3D R = new DenseDoubleMatrix3D(slices, rows, columns); final double[] elemsOther = R.elements(); final int sliceStrideOther = R.sliceStride();
cern.colt.matrix.tdouble.DoubleMatrix3D heights = new cern.colt.matrix.tdouble.impl.DenseDoubleMatrix3D( toArrayHeights(h)); heights = heights.viewDice(2, 1, 0).viewSliceFlip().viewRowFlip(); // keep
cern.colt.matrix.tdouble.DoubleMatrix3D heights = new cern.colt.matrix.tdouble.impl.DenseDoubleMatrix3D( toArrayHeights(h)); heights = heights.viewDice(2, 1, 0).viewSliceFlip().viewRowFlip(); // keep