Re: [Rcpp-devel] iterator for sparse Matrix

2014-01-22 Thread Saurabh B
Apologies, I will break it down and tackle one thing at a time... On Wed, Jan 22, 2014 at 8:13 PM, Dirk Eddelbuettel wrote: > > Saurabh, > > On 22 January 2014 at 18:04, Saurabh B wrote: > | I am running into many issues. Here they are ranked in order of > importance) - > | 1) When I run this

Re: [Rcpp-devel] Rcpp version of c( )

2014-01-22 Thread Dirk Eddelbuettel
On 21 January 2014 at 22:02, Søren Højsgaard wrote: | I have made the following primitive "concatenate" function, because I couldn't find one in Rcpp: | | template | Vector do_conc_(Vector x, Vector y){ | int nx=x.size(), n=x.size()+y.size(),i,j; | Vector out=no_init(n); | for (i=0; i ( X

Re: [Rcpp-devel] iterator for sparse Matrix

2014-01-22 Thread Dirk Eddelbuettel
Saurabh, On 22 January 2014 at 18:04, Saurabh B wrote: | I am running into many issues. Here they are ranked in order of importance) - | 1) When I run this (incorrect) program - | stochDescCpp(param = rep(0,3), x = X, y = Y, maxit = 100) | | I get - | Error in .Primitive(".Call")(, param, x,  : 

Re: [Rcpp-devel] is_na, is_infinite etc

2014-01-22 Thread Dirk Eddelbuettel
On 22 January 2014 at 23:07, Søren Højsgaard wrote: | I am struggeling with checking for NA and Inf in a loop over a numeric vector. I have created these two helpers: "If in doubt, check unit tests". See e.g. inst/unitTests/cpp/sugar.cpp // [[Rcpp::export]] LogicalVector runit_isna( NumericV

Re: [Rcpp-devel] is_na, is_infinite etc

2014-01-22 Thread Romain François
This is not implemented as members of Vector. See: https://github.com/RcppCore/Rcpp/blob/b5ff9b5530e4a82682caab5ddc87ac23a7b8857e/inst/include/Rcpp/traits/is_infinite.h So, you can use: traits::is_infinite(x) Romain Le 23 janv. 2014 à 00:07, Søren Højsgaard a écrit : > Dear all, > > I am

[Rcpp-devel] is_na, is_infinite etc

2014-01-22 Thread Søren Højsgaard
Dear all, I am struggeling with checking for NA and Inf in a loop over a numeric vector. I have created these two helpers: //[[Rcpp::export]] bool isna( double x){ return NumericVector::is_na(x) ; } //[[Rcpp::export]] bool isinf( double x){ return NumericVector::is_infinite(x) ; } isna wor

[Rcpp-devel] iterator for sparse Matrix

2014-01-22 Thread Saurabh B
Hi there, I am new to RcppArmadillo and very excited about the sparse matrix functionality it offers. I have a large optim that I wish to break down into stochastic descent in Rcpp to speed things up. To start small, I used a simple logisitic regression function that I have working in R - Norm <