Displaying 2 results from an estimated 2 matches for "mkname".
Did you mean:
myname
2013 Apr 01
2
Timing of SET_VECTOR_ELT
...and "xyz" for the pointer to its contents.)
PROTECT(means2 = allocVector(REALSXP, nvar));
means = REAL(means2);
PROTECT(u2 = allocVector(REALSXP, nvar));
u = REAL(u2);
PROTECT(loglik2 = allocVector(REALSXP, 2));
loglik = REAL(loglik2);
PROTECT(rlist = mknamed(VECSXP, outnames));
Can I assign the individual elements into rlist using SET_VECTOR_ELT at this point, or do
I need to wait until the end of the program, after I've filled in means[i], u[i], etc.? I
likely depends on whether I'm assigning a pointer or a copy.
Terry T.
2011 Jan 17
1
isoreg memory leak?
...R_isoreg(SEXP y)
{
int n = LENGTH(y), i, ip, known, n_ip;
double tmp, slope;
SEXP yc, yf, iKnots, ans;
const char *anms[] = {"y", "yc", "yf", "iKnots", ""};
/* unneeded: y = coerceVector(y, REALSXP); */
PROTECT(ans = mkNamed(VECSXP, anms));
SET_VECTOR_ELT(ans, 0, y = y);
SET_VECTOR_ELT(ans, 1, yc = allocVector(REALSXP, n+1));
SET_VECTOR_ELT(ans, 2, yf = allocVector(REALSXP, n));
SET_VECTOR_ELT(ans, 3, iKnots= allocVector(INTSXP, n));
... calculation ...
SETLENGTH(iKnots, n_ip);
UNPROTE...