samedi 14 mars 2015

Assigning matrix rows with particular indices


I am porting some code from Matlab to Armadillo and am stuck at a simple step. I am finding all the indices of a vector res on the basis of a condition and then want to store all the rows of a matrix Pts corresponding to the condition.


So what it is in matlab



ifAny = find(res < lim);
Pts = Pts(ifAny,:);


In Armadillo -



arma::uvec ifAny = arma::find(res < lim);
// elem gives only the single column
// Pts = Pts.elem(ifAny);



Aucun commentaire:

Enregistrer un commentaire