Hi,
I have a matrix X which is 5x5. I have another matrix 5x1 called Y having [ [0] , [2] , [1] , [3] , [4] ].
I would like to get those elements from X whose column index correspond to the numbers mentioned in Y.
I tried using get(DoubleMatrix rindices, DoubleMatrix cindicies) but that returns the entire column/row if its index is found in the matrix.
Right now I do it with a for loop, which takes a lot of time when X>>1,00,000.
DoubleMatrix Z = new DoubleMatrix(Y.rows, 1);
for (int j = 0; j < X,rows; j++) {
int correctClassIndex = (int) Y.get(j, 0);
X.put(j, 0, X.get(j, correctClass));
}
I am assuming I might have to make a nativeblas call.
Any suggestions?
Thanks,
Abhishek Mishra