Displaying 5 results from an estimated 5 matches for "as_integ".
Did you mean:
  as_int
  
2012 Sep 15
1
Question about copying arguments in C.
...");
    TClass = MAKE_CLASS("thingy");
    PROTECT(ans = NEW_OBJECT(TClass));
    // *****QUESTION STARTS HERE*****
    // CAN I SAY:
    SET_SLOT(ans, Rf_install("myInteger"), thingysInteger);
    // IF NOT, CAN I SAY
    SET_SLOT(ans, Rf_install("myInteger"), AS_INTEGER(thingysInteger));
    // OR DO I NEED TO SAY
    PROTECT(ti = allocVector(INTSXP, 1)); INTEGER(pns)[0] =
INTEGER(thingysInteger)[0];
    SET_SLOT(ans, Rf_install("myInteger"), ti);
    // *****END OF QUESTION*****
    UNPROTECT(1); // or UNPROTECT(2) in latter case.
    return ans;
}...
2012 Dec 06
1
Use .Call interface
...llowing program:
#include <R.h>
#include <Rdefines.h>
#include "Projector.h"
SEXP Projector2(SEXP L, SEXP G, SEXP W, SEXP xymod, SEXP modif){
 int nprot=0;
 PROTECT(L=AS_NUMERIC(L));nprot++;
 PROTECT(G=AS_NUMERIC(G));nprot++;
 PROTECT(W=AS_NUMERIC(W));nprot++;
 PROTECT(xymod=AS_INTEGER(xymod));nprot++;
 PROTECT(modif=AS_NUMERIC(modif));nprot++;
 double *lptr; lptr=REAL(L);
 double *gptr; gptr=REAL(G);
 double *wptr; wptr=REAL(W);
 int *xyptr; xyptr=INTEGER(xymod);
 double *ifptr; ifptr=REAL(modif);
 int *dimL; dimL=INTEGER(GET_DIM(L));
 int *dimG; dimG=INTEGER(GET_DIM(G));
 int...
2003 Dec 10
0
C++: SET_LENGTH() Over Many Iterations?
...#define PUSH_BACK_INTEGER(v, x) \
    do {\
      UNPROTECT_PTR(v);\
      SET_LENGTH(v, GET_LENGTH(v) + 1);\
      PROTECT(v);\
      INTEGER_POINTER(v)[GET_LENGTH(v) - 1] = x;\
    }\
    while (false)
  SEXP R_SimplePushBackTest(SEXP args)
  {
    SEXP arg1, arg2, int_vect;
    PROTECT(arg1 = AS_INTEGER(CADR(args)));
    int n_reps = INTEGER_POINTER(arg1)[0];
    PROTECT(arg2 = AS_LOGICAL(CADDR(args)));
    bool full_alloc = (LOGICAL_POINTER(arg2)[0] ? true : false);
    if (full_alloc)
      PROTECT(int_vect = NEW_INTEGER(n_reps));
    else
      PROTECT(int_vect = NEW_INTEGER(0));
    for (in...
2003 Dec 12
3
C++: Appending Values onto an R-Vector.
Hi folks. I posted this question a few days ago, but maybe it got lost
because of the code I included with it. I'm having a problem using the
SET_LENGTH() macro in an R extension I'm writing in C++. In a function
within the extension I use SET_LENGTH() to resize R vectors so as to
allow the concatenation of single values onto the vectors -- it's a
"push back" function to
2023 Sep 02
1
Fails to install Rfast package
...orks/R.framework/Resources/include" -DNDEBUG
-I../inst/include
-I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include'
-I'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppArmadillo/include'
-I/usr/local/include   -fPIC  -Wall -g -O2  -c as_integer.cpp -o
as_integer.o
In file included from as_integer.cpp:4:
In file included from
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppArmadillo/include/RcppArmadillo.h:29:
In file included from
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/RcppArmadillo/include/...