search for: sequence_c

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

Did you mean: sequence
2010 Nov 28
1
faster base::sequence
...and following Bill's suggestions, it appeared that sequence: > sequence function (nvec) unlist(lapply(nvec, seq_len)) <environment: namespace:base> could benefit from being written in C to avoid unnecessary memory allocations. I made this version using inline: require( inline ) sequence_c <- local( { fx <- cfunction( signature( x = "integer"), ' int n = length(x) ; int* px = INTEGER(x) ; int x_i, s = 0 ; /* error checking */ for( int i=0; i<n; i++){ x_i = px[i] ; /* this includes the c...