search for: dim0

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

Did you mean: dim
2016 Jan 10
3
coerce SEXP type to C++ matrix class and back
...lements, are stored with column-major ordering I have tried the following silly example: #include <R.h> #include <Rdefines.h> #include <Rinternals.h> #include <Rmath.h> #include <R_ext/BLAS.h> #include <R_ext/Lapack.h> #include <armadillo> #define IDX(i,j,dim0) (i) + (j) * (dim0) extern "C" SEXP Symm(SEXP RA) { int m = INTEGER(GET_DIM(RA))[0]; int n = INTEGER(GET_DIM(RA))[1]; double *A; A = REAL(RA); arma::mat C(m, n), D(m, n); for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) C[IDX(i, j, m)] = A[IDX(i, j, m)...