/** * Construct and returns a new selection view. * * @param offsets * the offsets of the visible elements. * @return a new view. */ protected DoubleMatrix1D viewSelectionLike(int[] offsets) { return new SelectedSparseDoubleMatrix1D(this.elements, offsets); } }
/** * Constructs a matrix view with the given parameters. * * @param size * the number of cells the matrix shall have. * @param elements * the cells. * @param zero * the index of the first element. * @param stride * the number of indexes between any two elements, i.e. * <tt>index(i+1)-index(i)</tt>. * @param offsets * the offsets of the cells that shall be visible. * @param offset */ protected SelectedSparseDoubleMatrix1D(int size, AbstractLongDoubleMap elements, int zero, int stride, int[] offsets, int offset) { setUp(size, zero, stride); this.elements = elements; this.offsets = offsets; this.offset = offset; this.isNoView = false; }
public DoubleMatrix2D reshape(int rows, int columns) { if (rows * columns != size) { throw new IllegalArgumentException("rows*columns != size"); } DoubleMatrix2D M = new SparseDoubleMatrix2D(rows, columns); int idx = 0; for (int c = 0; c < columns; c++) { for (int r = 0; r < rows; r++) { M.setQuick(r, c, getQuick(idx++)); } } return M; }
public DoubleMatrix2D reshape(int rows, int columns) { if (rows * columns != size) { throw new IllegalArgumentException("rows*columns != size"); } DoubleMatrix2D M = new SparseDoubleMatrix2D(rows, columns); int idx = 0; for (int c = 0; c < columns; c++) { for (int r = 0; r < rows; r++) { M.setQuick(r, c, getQuick(idx++)); } } return M; }
/** * Construct and returns a new selection view. * * @param offsets * the offsets of the visible elements. * @return a new view. */ protected DoubleMatrix1D viewSelectionLike(int[] offsets) { return new SelectedSparseDoubleMatrix1D(this.elements, offsets); } }
public DoubleMatrix3D reshape(int slices, int rows, int columns) { if (slices * rows * columns != size) { throw new IllegalArgumentException("slices*rows*columns != size"); } DoubleMatrix3D M = new SparseDoubleMatrix3D(slices, rows, columns); int idx = 0; for (int s = 0; s < slices; s++) { for (int c = 0; c < columns; c++) { for (int r = 0; r < rows; r++) { M.setQuick(s, r, c, getQuick(idx++)); } } } return M; }
/** * Constructs a matrix view with the given parameters. * * @param size * the number of cells the matrix shall have. * @param elements * the cells. * @param zero * the index of the first element. * @param stride * the number of indexes between any two elements, i.e. * <tt>index(i+1)-index(i)</tt>. * @param offsets * the offsets of the cells that shall be visible. * @param offset */ protected SelectedSparseDoubleMatrix1D(int size, AbstractLongDoubleMap elements, int zero, int stride, int[] offsets, int offset) { setUp(size, zero, stride); this.elements = elements; this.offsets = offsets; this.offset = offset; this.isNoView = false; }
/** * Construct and returns a new selection view. * * @param offsets * the offsets of the visible elements. * @return a new view. */ protected DoubleMatrix1D viewSelectionLike(int[] offsets) { return new SelectedSparseDoubleMatrix1D(this.elements, offsets); } }
public DoubleMatrix3D reshape(int slices, int rows, int columns) { if (slices * rows * columns != size) { throw new IllegalArgumentException("slices*rows*columns != size"); } DoubleMatrix3D M = new SparseDoubleMatrix3D(slices, rows, columns); int idx = 0; for (int s = 0; s < slices; s++) { for (int c = 0; c < columns; c++) { for (int r = 0; r < rows; r++) { M.setQuick(s, r, c, getQuick(idx++)); } } } return M; }
/** * Construct and returns a new selection view. * * @param offsets * the offsets of the visible elements. * @return a new view. */ protected DoubleMatrix1D viewSelectionLike(int[] offsets) { return new SelectedSparseDoubleMatrix1D(this.elements, offsets); } }
int[] viewOffsets = this.rowOffsets; int viewOffset = this.offset + _columnOffset(_columnRank(column)); return new SelectedSparseDoubleMatrix1D(viewSize, this.elements, viewZero, viewStride, viewOffsets, viewOffset);
int[] viewOffsets = this.rowOffsets; int viewOffset = this.offset + _columnOffset(_columnRank(column)); return new SelectedSparseDoubleMatrix1D(viewSize, this.elements, viewZero, viewStride, viewOffsets, viewOffset);
int[] viewOffsets = this.columnOffsets; int viewOffset = this.offset + _rowOffset(_rowRank(row)); return new SelectedSparseDoubleMatrix1D(viewSize, this.elements, viewZero, viewStride, viewOffsets, viewOffset);
int[] viewOffsets = this.columnOffsets; int viewOffset = this.offset + _rowOffset(_rowRank(row)); return new SelectedSparseDoubleMatrix1D(viewSize, this.elements, viewZero, viewStride, viewOffsets, viewOffset);