File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,18 @@ using namespace Rcpp;
1010#include < cmath>
1111#include < algorithm>
1212
13+ double squareRoot (double x) {
14+ return ::sqrt (x);
15+ }
16+
1317// [[Rcpp::export]]
1418NumericMatrix matrixSqrt (NumericMatrix orig) {
1519
1620 // allocate the matrix we will return
1721 NumericMatrix mat (orig.nrow (), orig.ncol ());
1822
1923 // transform it
20- std::transform (orig.begin (), orig.end (), mat.begin (), ::sqrt );
24+ std::transform (orig.begin (), orig.end (), mat.begin (), squareRoot );
2125
2226 // return the new matrix
2327 return mat;
@@ -43,7 +47,7 @@ struct SquareRoot : public Worker
4347 std::transform (input.begin () + begin,
4448 input.begin () + end,
4549 output.begin () + begin,
46- ::sqrt );
50+ squareRoot );
4751 }
4852};
4953
You can’t perform that action at this time.
0 commit comments