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

Method ones

inst/include/Rcpp/vector/MatrixBase.h:60–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58 }
59
60 static MATRIX ones(int n) {
61 const bool enabled =
62 traits::is_arithmetic<stored_type>::value ||
63 traits::same_type<stored_type, Rcomplex>::value;
64 (void)sizeof(traits::allowed_matrix_type<enabled>);
65
66 MATRIX res(n, n);
67 std::fill(
68 res.begin(), res.end(),
69 traits::one_type<stored_type>()
70 );
71 return res;
72 }
73
74 static MATRIX zeros(int n) {
75 const bool enabled =

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected