-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi all,
I have a question on the reshape method of org.ejml.data.DenseMatrix64F.java.
If we want to keep the matrix data and just reshape it to, for example, make it
bigger, the data doesn't stay in the same "logical" positions that it had
before, as a consequence the logical matrix is altered, and I cannot see how
the original data could be still used in a meaningful way. This option would be
typically needed e.g. in dimensionality reduction algorithms, etc.
Would it make sense to consider an implementation that leaves each value in the
same logical (i,j) position it had initially? E.g. something like:
@Override
public void reshape(int numRows, int numCols, boolean saveValues) {
double[] d = new double[numRows * numCols];
if (saveValues) {
for (int i = 0, j = 0; i < numRows * numCols && j < getNumElements();) {
if (j % this.numCols < numCols) {
d[i++] = data[j++];
} else {
j += this.numCols - numCols;
}
}
}
this.data = d;
this.numRows = numRows;
this.numCols = numCols;
}
Any help is appreciated!
Cheers!
Original issue reported on code.google.com by sofiamar...@gmail.com on 3 Dec 2013 at 12:41
Reactions are currently unavailable