6

I need to work with RcppParallel::RMatrix. Previously I worked with Rcpp only. But now for RcppParallel I need a documention Like What Rcpp has.

For Example

I Rcpp::NumericMatrix We can select a row or column with placeholder "_" like this:

NumericMatrix new = OldMatrix(_,1);

But I want to know How Can Do same for RcppParallel::RMatrix?

Thank for any help.

Tom Wenseleers
  • 7,535
  • 7
  • 63
  • 103
SirSaleh
  • 1,452
  • 3
  • 23
  • 39

1 Answers1

2

RcppParallel is focused on iterators, and it offers the RMatrix::Column and RMatrix::Row classes that provide iterators for individual columns and rows:

Rcpp::NumericMatrix foo = ...;
RcppParallel::RMatrix<double> bar(foo);

RcppParallel::RMatrix<double>::Column column = bar.column(0);
// use any algorithm on column.begin() to column.end()

RcppParallel::RMatrix<double>::Row row = bar.row(0);
// use any algorithm on row.begin() to row.end()
Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75