No subject


Mon Feb 21 17:26:18 CET 2011


// Reference the second column
// Changes propagate to xx (same applies for Row)
NumericMatrix::Column zzcol = xx( _, 1);
zzcol = zzcol * 2;

Only difference in my code was that I was assigning from a NumericVector
instead of from an altered version of the original NumericMatrix::Column. Or
am I mistaken here? I've put it here again:
NumericVector curcol = df(i);
NumericMatrix::Column cl = retMat( _, i);
cl = curcol;//from rcpp-quickref, I understand this alters the matrix?

Then you appear to suggest that my approach using the "dim" attribute is no
good, or at least you get the dimensions in a very different way (by using
the data.frame as a list). I agree your way works, but why shouldn't mine?
In any case, this sort of thing would be a valuable addition to Rcpp in my
opinion.

Finally, you use:
>+        V = DF[i];
>+        M(_,i) = V;  // one way to assign using sugar operator _
Which makes me wonder:
* why DF[i] and not DF(i) (what's the difference - I still have not found a
clear explanation)
* is M(_,i) = V; any different from NumericVector cl = M(_,i);cl=V; ? If so,
how so?
* thanks for letting me know _ is part of sugar. I may be able to figure out
its use now, but isn't this worthy of a mention in rcpp-sugar.pdf?

Thanks,

Nick Sabbe
--
ping: nick.sabbe at ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36

-- Do Not Disapprove







More information about the Rcpp-devel mailing list