search for: p_res

Displaying 1 result from an estimated 1 matches for "p_res".

Did you mean: __res
2010 Nov 28
1
faster base::sequence
...for( int i=0; i<n; i++){ x_i = px[i] ; /* this includes the check for NA */ if( x_i <= 0 ) error( "needs non negative integer" ) ; s += x_i ; } SEXP res = PROTECT( allocVector( INTSXP, s ) ) ; int * p_res = INTEGER(res) ; for( int i=0; i<n; i++){ x_i = px[i] ; for( int j=0; j<x_i; j++, p_res++) *p_res = j+1 ; } UNPROTECT(1) ; return res ; ' ) function( nvec ){ fx( as.integer(nvec) ) } })...