Sorry for slow reply. > Or perhaps use the "_" thing : > > ret( i, _ ) = ...
Is there documentation on _? > Or perhaps have this syntax : > > ret.row(i) = ... > > We aleardy have row member function that returns a Row object, but it > currently does not have a operator=, that could be taken care of. This sounds good. I'll look at this in the next week or 2. Two questions about how this might extend - 1. Would this allow for an analogous member function along the following lines, or is "Rows" too much of a stretch? typedef MatrixRows<RTYPE> Rows ; inline Rows row( NumericVector i ){ return Row( *this, i ) ; } and Class MatrixRows : ... private: MatrixRow& row ; NumericVector index ; 2. For an Array class, does a chained assignment like ret.slice(i).row(j) = ... sound sensible? best, xian >> The next logical extension of matrix/array indexing beyond boolean >> would be to allow NumericVectors in each of the index positions. At >> this point, though, there's an explosion of over-loaded functions - a >> 3D Num myArray(x, y, z) gives 27 separate functions for x,y,z chosen >> from {bool, int, NumericVector}, plus NumericMatrix and NumericVector. >> Here's where an indexer class starts to make sense - unified >> constructors, along with clear dimensionality of the indexer and >> simple checks of dimensional conformance between indexer and indexed. > > Sure. > >> As a side-note, I just spent some time with arma, and was sad to find >> that arma_mat.insert_rows(atrow, rowvec) extends arma_mat, with no >> apparent way to do row/col-level in-place replacement. So, at least >> we're not whipping a dead horse. >> >> Can you point me to the relevant NumericMatrix(i,j) indexer code? > > Look for the "offset" member functions in > https://r-forge.r-project.org/scm/viewvc.php/pkg/Rcpp/inst/include/Rcpp/vector/Vector.h?view=markup&revision=2031&root=rcpp > > This is what is used by operator()(int,int) in Matrix.h: > https://r-forge.r-project.org/scm/viewvc.php/pkg/Rcpp/inst/include/Rcpp/vector/Matrix.h?view=markup&revision=1907&root=rcpp > > >> thanks much, >> Christian > > > -- > Romain Francois > Professional R Enthusiast > +33(0) 6 28 91 30 30 > http://romainfrancois.blog.free.fr > |- http://bit.ly/cCmbgg : Rcpp 0.8.6 > |- http://bit.ly/bzoWrs : Rcpp svn revision 2000 > `- http://bit.ly/b8VNE2 : Rcpp at LondonR, oct 5th > > > -- A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama! _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel