On Thu, May 31, 2012 at 11:07 PM, Søren Højsgaard <[email protected]> wrote:
> I would expect that there is a way of doing this without having
> to jump "into" armadillo "back" to Rcpp and "into" Armadillo again.
> I just can't spot an easier way. If a simpler solution exists I would
> be interested to know...

Perhaps Armadillo's find() in conjunction with .elem() can help:

http://arma.sourceforge.net/docs.html#find
http://arma.sourceforge.net/docs.html#submat

For example, set any element of X greater than 0.5 to 123:

mat X = randu<mat>(5,5);
X.elem( find(X > 0.5) ).fill(123.0);
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to