[Rcpp-devel] Rcpp-devel Digest, Vol 14, Issue 17
Christian Gunning
xian at unm.edu
Sun Dec 5 03:50:12 CET 2010
On Sat, Dec 4, 2010 at 7:35 AM,
<rcpp-devel-request at lists.r-forge.r-project.org> wrote:
> While I am on this, would it be valuable to have something like this:
>
> typedef SubMatrix<REALSXP> NumericSubMatrix ;
>
> or perhaps inside Matrix we could have:
>
> typedef typename SubMatrix<RTYPE> sub ;
>
> So that we would write
>
> NumericMatrix::sub yy = xx( Range(0,2), Range(0,3) )
Looks nice. I was wondering about that.
Question -
Is there a simple example where the following differ? I looked at the
source, and it looks to me that MatrixColumn, MatrixRow, and SubMatrix
objects are still tied to the original Matrix object (example 1),
whereas example 2 creates an entirely new object. I don't understand
the exact consequences of this. Am I correct in assuming that A, 1
does not make a new copy, and that B, modifications to the SubMatrix
object propogate back to the underlying Matrix?
1) NumericMatrix::sub yy1 = xx( Range(0,2), Range(0,3) )
2) NumericMatrix: yy2 = xx( Range(0,2), Range(0,3) )
thanks,
Christian
--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
More information about the Rcpp-devel
mailing list