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

Function as_vector__impl

inst/include/Rcpp/sugar/matrix/as_vector.h:29–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28template <int RTYPE, bool NA, typename T>
29inline Rcpp::Vector<RTYPE>
30as_vector__impl( MatrixBase<RTYPE,NA,T>& t, Rcpp::traits::false_type ){
31 T& ref = t.get_ref() ;
32 int nc = ref.ncol(), nr = ref.nrow() ;
33 Vector<RTYPE> out (static_cast<R_xlen_t>(nr) * nc) ;
34 R_xlen_t k =0;
35 for( int col_index=0; col_index<nc; col_index++)
36 for( int row_index=0; row_index<nr; row_index++, k++)
37 out[k] = ref( row_index, col_index ) ;
38
39 return out ;
40}
41
42template <int RTYPE, bool NA, typename T>
43inline Rcpp::Vector<RTYPE>

Callers 1

as_vectorFunction · 0.85

Calls 3

ncolMethod · 0.45
nrowMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected