MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / wrap_dispatch_matrix_primitive

Function wrap_dispatch_matrix_primitive

inst/include/Rcpp/internal/wrap.h:580–595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578
579 template <typename T, typename STORAGE>
580 inline SEXP wrap_dispatch_matrix_primitive(const T& object) {
581 const int RTYPE = ::Rcpp::traits::r_sexptype_traits<STORAGE>::rtype;
582 int nr = object.nrow(), nc = object.ncol();
583 Shield<SEXP> res(Rf_allocVector(RTYPE, nr*nc));
584
585 int k=0;
586 STORAGE* p = r_vector_start< RTYPE>(res);
587 for (int j=0; j<nc; j++)
588 for (int i=0; i<nr; i++, k++)
589 p[k] = object(i,j);
590 Shield<SEXP> dim(Rf_allocVector(INTSXP, 2));
591 INTEGER(dim)[0] = nr;
592 INTEGER(dim)[1] = nc;
593 Rf_setAttrib(res, R_DimSymbol , dim);
594 return res;
595 }
596
597 template <typename T>
598 inline SEXP wrap_dispatch_matrix_not_logical(const T& object, ::Rcpp::traits::r_type_primitive_tag) {

Callers

nothing calls this directly

Calls 3

objectClass · 0.50
nrowMethod · 0.45
ncolMethod · 0.45

Tested by

no test coverage detected