Displaying 5 results from an estimated 5 matches for "sillysum".
2019 Sep 23
2
What is the best way to loop over an ALTREP vector?
...> case LGLSXP:\
>
> ITERATE_BY_REGION(sx, ptr, ind, nbatch, int, LOGICAL, expr);\
>
> break; \
>
> default:\
>
> Rf_error("Unknow data type\n"); \
>
> break; \
>
> }
>
>
>
> // [[Rcpp::export]]
>
> double sillysum(SEXP x) {
>
> double s = 0.0;
>
> type_free_iter(x, ptr, ind, nbatch,
>
> {
>
> for (int i = 0; i < nbatch; i++) { s = s + ptr[i]; }
>
> });
>
> return s;
>
> }
>
>
>
&...
2019 Aug 28
3
What is the best way to loop over an ALTREP vector?
Hi devel team,
I'm working on C/C++ level ALTREP compatibility for a package. The package
previously used pointers to access the data of a SEXP, so it would not work
for some ALTREP objects which do not have a pointer. I plan to rewrite the
code and use functions like get_elt, get_region, and get_subset to access
the values of a vector, so I have a few questions for ALTREP:
1. Since an
2019 Sep 23
0
What is the best way to loop over an ALTREP vector?
...ITERATE_BY_REGION(sx, ptr, ind, nbatch, double, REAL, expr);\
break; \
case LGLSXP:\
ITERATE_BY_REGION(sx, ptr, ind, nbatch, int, LOGICAL, expr);\
break; \
default:\
Rf_error("Unknow data type\n"); \
break; \
}
// [[Rcpp::export]]
double sillysum(SEXP x) {
double s = 0.0;
type_free_iter(x, ptr, ind, nbatch,
{
for (int i = 0; i < nbatch; i++) { s = s + ptr[i]; }
});
return s;
}
Best,
Jiefei
On Wed, Aug 28, 2019 at 2:32 PM Wang Jiefei <szwjf08 at g...
2019 Sep 24
2
What is the best way to loop over an ALTREP vector?
...> >>
> >> default:\
> >>
> >> Rf_error("Unknow data type\n"); \
> >>
> >> break; \
> >>
> >> }
> >>
> >>
> >>
> >> // [[Rcpp::export]]
> >>
> >> double sillysum(SEXP x) {
> >>
> >> double s = 0.0;
> >>
> >> type_free_iter(x, ptr, ind, nbatch,
> >>
> >> {
> >>
> >> for (int i = 0; i < nbatch; i++) { s = s + ptr[i]; }
> >>
> >...
2019 Sep 24
0
What is the best way to loop over an ALTREP vector?
...atch, int, LOGICAL, expr);\
>>
>> break; \
>>
>> default:\
>>
>> Rf_error("Unknow data type\n"); \
>>
>> break; \
>>
>> }
>>
>>
>>
>> // [[Rcpp::export]]
>>
>> double sillysum(SEXP x) {
>>
>> double s = 0.0;
>>
>> type_free_iter(x, ptr, ind, nbatch,
>>
>> {
>>
>> for (int i = 0; i < nbatch; i++) { s = s + ptr[i]; }
>>
>> });
>>
>>...