Martin Morgan has written at Sun, 23 Nov 2014 14:09:27 -0800
On 11/23/2014 11:07 AM, Sokol Serguei wrote:
Gabor Grothendieck has written at Sat, 22 Nov 2014 19:17:27 -0500
On Sat, Nov 22, 2014 at 1:43 PM, Sokol
Serguei<serguei.so...@gmail.com> wrote:
Let try to stick with regular rcpp code
(file: matrix_norm.cpp):
//[[Rcpp::depends(RcppArmadillo)]]
#include <RcppArmadillo.h>
using namespace Rcpp;
using namespace arma;
// [[Rcpp::export]]
double nmat(mat A) {
Function Matrix_norm_r_=Environment("package:Matrix")["norm"];
double res=as<double>(Matrix_norm_r_(A, "1"));
return res;
}
...
but obviously the other pairlist templates need protection, too. Maybe
it's enough, instead, to add protection to grow
template <typename T>
SEXP grow(const T& head, SEXP tail) {
Shield<SEXP> y(tail);
return internal::grow__dispatch( typename
traits::is_named<T>::type(), head, y );
}
inline SEXP grow( const char* head, SEXP tail ) {
Shield<SEXP> y(tail);
return grow( Rf_mkString(head), y ) ;
}
I confirm that this patch solved the problem. Nice find Martin.
Serguei.
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel