/** * Creates a new DMatrixRMaj around the provided data. The data must encode * a row-major matrix. Any modification to the returned matrix will modify the * provided data. * * @param numRows Number of rows in the matrix. * @param numCols Number of columns in the matrix. * @param data Data that is being wrapped. Referenced Saved. * @return A matrix which references the provided data internally. */ public static DMatrixRMaj wrap(int numRows, int numCols, double[] data) { DMatrixRMaj s = new DMatrixRMaj(); s.data = data; s.numRows = numRows; s.numCols = numCols; return(s); }
/** * Creates a new matrix which is equivalent to the provided matrix. Note that * the length of the data will be determined by the shape of the matrix. * * @param orig The matrix which is to be copied. This is not modified or saved. */ public DMatrixRMaj(DMatrixRMaj orig) : this(orig.numRows, orig.numCols) { Array.Copy(orig.data, 0, this.data, 0, orig.getNumElements()); }