/** * Construct and returns a new 2-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix1D</tt> the new matrix must be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix1D</tt> the new matrix must be of type <tt>SparseObjectMatrix2D</tt>, etc. * * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @return a new matrix of the corresponding dynamic type. */ public ObjectMatrix2D like2D(int rows, int columns) { return new SparseObjectMatrix2D(rows,columns); } /**
/** * Construct and returns a new 2-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix1D</tt> the new matrix must be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix1D</tt> the new matrix must be of type <tt>SparseObjectMatrix2D</tt>, etc. * * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @return a new matrix of the corresponding dynamic type. */ public ObjectMatrix2D like2D(int rows, int columns) { return new SparseObjectMatrix2D(rows,columns); } /**
/** * Construct and returns a new 2-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix1D</tt> the new matrix must be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix1D</tt> the new matrix must be of type <tt>SparseObjectMatrix2D</tt>, etc. * * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @return a new matrix of the corresponding dynamic type. */ public ObjectMatrix2D like2D(int rows, int columns) { return new SparseObjectMatrix2D(rows,columns); } /**
/** * Construct and returns a new 2-d matrix <i>of the corresponding dynamic type</i>, entirelly independent of the receiver. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix1D</tt> the new matrix must be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix1D</tt> the new matrix must be of type <tt>SparseObjectMatrix2D</tt>, etc. * * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @return a new matrix of the corresponding dynamic type. */ public ObjectMatrix2D like2D(int rows, int columns) { return new SparseObjectMatrix2D(rows,columns); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified number of rows and columns. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix2D</tt> the new matrix must also be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix2D</tt> the new matrix must also be of type <tt>SparseObjectMatrix2D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @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 ObjectMatrix2D like(int rows, int columns) { return new SparseObjectMatrix2D(rows, columns); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified number of rows and columns. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix2D</tt> the new matrix must also be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix2D</tt> the new matrix must also be of type <tt>SparseObjectMatrix2D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @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 ObjectMatrix2D like(int rows, int columns) { return new SparseObjectMatrix2D(rows, columns); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified number of rows and columns. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix2D</tt> the new matrix must also be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix2D</tt> the new matrix must also be of type <tt>SparseObjectMatrix2D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @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 ObjectMatrix2D like(int rows, int columns) { return new SparseObjectMatrix2D(rows, columns); } /**
/** * Construct and returns a new empty matrix <i>of the same dynamic type</i> as the receiver, having the specified number of rows and columns. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix2D</tt> the new matrix must also be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix2D</tt> the new matrix must also be of type <tt>SparseObjectMatrix2D</tt>, etc. * In general, the new matrix should have internal parametrization as similar as possible. * * @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 ObjectMatrix2D like(int rows, int columns) { return new SparseObjectMatrix2D(rows, columns); } /**
/** * Construct and returns a new 2-d matrix <i>of the corresponding dynamic type</i>, sharing the same cells. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix3D</tt> the new matrix must also be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix3D</tt> the new matrix must also be of type <tt>SparseObjectMatrix2D</tt>, etc. * * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @param rowZero the position of the first element. * @param columnZero the position of the first element. * @param rowStride the number of elements between two rows, i.e. <tt>index(i+1,j)-index(i,j)</tt>. * @param columnStride the number of elements between two columns, i.e. <tt>index(i,j+1)-index(i,j)</tt>. * @return a new matrix of the corresponding dynamic type. */ protected ObjectMatrix2D like2D(int rows, int columns, int rowZero, int columnZero, int rowStride, int columnStride) { return new SparseObjectMatrix2D(rows,columns,this.elements,rowZero,columnZero,rowStride,columnStride); } /**
/** * Construct and returns a new 2-d matrix <i>of the corresponding dynamic type</i>, sharing the same cells. * For example, if the receiver is an instance of type <tt>DenseObjectMatrix3D</tt> the new matrix must also be of type <tt>DenseObjectMatrix2D</tt>, * if the receiver is an instance of type <tt>SparseObjectMatrix3D</tt> the new matrix must also be of type <tt>SparseObjectMatrix2D</tt>, etc. * * @param rows the number of rows the matrix shall have. * @param columns the number of columns the matrix shall have. * @param rowZero the position of the first element. * @param columnZero the position of the first element. * @param rowStride the number of elements between two rows, i.e. <tt>index(i+1,j)-index(i,j)</tt>. * @param columnStride the number of elements between two columns, i.e. <tt>index(i,j+1)-index(i,j)</tt>. * @return a new matrix of the corresponding dynamic type. */ protected ObjectMatrix2D like2D(int rows, int columns, int rowZero, int columnZero, int rowStride, int columnStride) { return new SparseObjectMatrix2D(rows,columns,this.elements,rowZero,columnZero,rowStride,columnStride); } /**
/** * Constructs a matrix with the given shape, each cell initialized with zero. */ public ObjectMatrix2D make(int rows, int columns) { if (this==sparse) return new SparseObjectMatrix2D(rows,columns); else return new DenseObjectMatrix2D(rows,columns); } /**
/** * Constructs a matrix with the given shape, each cell initialized with zero. */ public ObjectMatrix2D make(int rows, int columns) { if (this==sparse) return new SparseObjectMatrix2D(rows,columns); else return new DenseObjectMatrix2D(rows,columns); } /**
/** * Constructs a matrix with the given cell values. * <tt>values</tt> is required to have the form <tt>values[row][column]</tt> * and have exactly the same number of columns in every row. * <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 new matrix. * @throws IllegalArgumentException if <tt>for any 1 <= row < values.length: values[row].length != values[row-1].length</tt>. */ public ObjectMatrix2D make(Object[][] values) { if (this==sparse) return new SparseObjectMatrix2D(values); else return new DenseObjectMatrix2D(values); } /**
/** * Constructs a matrix with the given cell values. * <tt>values</tt> is required to have the form <tt>values[row][column]</tt> * and have exactly the same number of columns in every row. * <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 new matrix. * @throws IllegalArgumentException if <tt>for any 1 <= row < values.length: values[row].length != values[row-1].length</tt>. */ public ObjectMatrix2D make(Object[][] values) { if (this==sparse) return new SparseObjectMatrix2D(values); else return new DenseObjectMatrix2D(values); } /**