Search Results

Search found 1 results on 1 pages for 'howard123'.

Page 1/1 | 1 

  • I am getting error when using Attributes in Rcpp and have RcppArmadillo code

    - by howard123
    I am trying to create a package with RcppArmadillo. The code uses the new attributes methodology of Rcpp. The sourceCpp works fine and compiles the code, but when I build a package I get errors when I use RcppArmadillo code. Without the RcppArmadillo code and using regulare C++, I do not get these errors. The C++ code (it is essentially the fastLm sample code) is: // [[Rcpp::depends(RcppArmadillo)]] #include <Rcpp.h> #include <RcppArmadillo.h> using namespace Rcpp; // [[Rcpp::depends(RcppArmadillo)]] #include <RcppArmadillo.h> // [[Rcpp::export]] List fastLm(NumericVector yr, NumericMatrix Xr) { int n = Xr.nrow(), k = Xr.ncol(); arma::mat X(Xr.begin(), n, k, false); arma::colvec y(yr.begin(), yr.size(), false); arma::colvec coef = arma::solve(X, y); arma::colvec resid = y - X*coef; double sig2 = arma::as_scalar(arma::trans(resid)*resid/(n-k)); arma::colvec stderrest = arma::sqrt( sig2 * arma::diagvec( arma::inv(arma::trans(X)*X)) ); return List::create(Named("coefficients") = coef, Named("stderr") = stderrest); } Here is the compilation error, after I execute "R Rcpp::compileAttributes() * Updated src/RcppExports.cpp == Rcmd.exe INSTALL --no-multiarch NewPackage * installing to library 'C:/Users/Howard/Documents/R/win-library/2.15' * installing *source* package 'NewPackage' ... ** libs g++ -m64 -I"C:/R/R-2-15-2/include" -DNDEBUG -I"C:/Users/Howard/Documents/R/win-library/2.15/Rcpp/include" -I"C:/Users/Howard/Documents/R/win-library/2.15/RcppArmadillo/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o g++ -m64 -I"C:/R/R-2-15-2/include" -DNDEBUG -I"C:/Users/Howard/Documents/R/win-library/2.15/Rcpp/include" -I"C:/Users/Howard/Documents/R/win-library/2.15/RcppArmadillo/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c test_arma3.cpp -o test_arma3.o g++ -m64 -shared -s -static-libgcc -o NewPackage.dll tmp.def RcppExports.o test_arma3.o C:/Users/Howard/Documents/R/win-library/2.15/Rcpp/lib/x64/libRcpp.a -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/R/R-2-15-2/bin/x64 -lR test_arma3.o:test_arma3.cpp:(.text+0xae4): undefined reference to `dgemm_' test_arma3.o:test_arma3.cpp:(.text+0x19db): undefined reference to `dgemm_' test_arma3.o:test_arma3.cpp:(.text+0x1b0c): undefined reference to `dgemv_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma6auxlib8solve_odIdNS_3MatIdEEEEbRNS2_IT_EES6_RKNS_4BaseIS4_T0_EE[_ZN4arma6auxlib8solve_odIdNS_3MatIdEEEEbRNS2_IT_EES6_RKNS_4BaseIS4_T0_EE]+0x702): undefined reference to `dgels_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma6auxlib8solve_udIdNS_3MatIdEEEEbRNS2_IT_EES6_RKNS_4BaseIS4_T0_EE[_ZN4arma6auxlib8solve_udIdNS_3MatIdEEEEbRNS2_IT_EES6_RKNS_4BaseIS4_T0_EE]+0x51c): undefined reference to `dgels_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma6auxlib10det_lapackIdEET_RKNS_3MatIS2_EEb[_ZN4arma6auxlib10det_lapackIdEET_RKNS_3MatIS2_EEb]+0x14b): undefined reference to `dgetrf_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma6auxlib5solveIdNS_3MatIdEEEEbRNS2_IT_EES6_RKNS_4BaseIS4_T0_EEb[_ZN4arma6auxlib5solveIdNS_3MatIdEEEEbRNS2_IT_EES6_RKNS_4BaseIS4_T0_EEb]+0x375): undefined reference to `dgesv_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma4gemvILb1ELb0ELb0EE15apply_blas_typeIdEEvPT_RKNS_3MatIS3_EEPKS3_S3_S3_[_ZN4arma4gemvILb1ELb0ELb0EE15apply_blas_typeIdEEvPT_RKNS_3MatIS3_EEPKS3_S3_S3_]+0x17d): undefined reference to `dgemv_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma27glue_times_redirect2_helperILb1EE5applyINS_2OpINS_3MatIdEENS_9op_htransEEES5_EEvRNS4_INT_9elem_typeEEERKNS_4GlueIS8_T0_NS_10glue_timesEEE[_ZN4arma27glue_times_redirect2_helperILb1EE5applyINS_2OpINS_3MatIdEENS_9op_htransEEES5_EEvRNS4_INT_9elem_typeEEERKNS_4GlueIS8_T0_NS_10glue_timesEEE]+0x37a): undefined reference to `dgemm_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE[_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE]+0x2c1): undefined reference to `dgetrf_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE[_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE]+0x322): undefined reference to `dgetri_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE[_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE]+0x398): undefined reference to `dgetri_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE[_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE]+0x775): undefined reference to `dgetrf_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE[_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE]+0x7d6): undefined reference to `dgetri_' test_arma3.o:test_arma3.cpp:(.text$_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE[_ZN4arma10op_diagvec5applyINS_2OpINS_4GlueINS2_INS_3MatIdEENS_9op_htransEEES5_NS_10glue_timesEEENS_6op_invEEEEEvRNS4_INT_9elem_typeEEERKNS2_ISC_S0_EE]+0x892): undefined reference to `dgetri_' collect2: ld returned 1 exit status ERROR: compilation failed for package 'NewPackage' * removing 'C:/Users/Howard/Documents/R/win-library/2.15/NewPackage' * restoring previous 'C:/Users/Howard/Documents/R/win-library/2.15/NewPackage' Exited with status 1.

    Read the article

1