#include #include "A0_W.h" /////////////////////////////////////////////////////////////////////// // A0obj constructor takes any A0 representation (as a 0/1 // // ident matrix or an example filled with 0/[double value]) and a // // scalar indicating the number of gibbs sampler draws to be // // saved. Constructor allocates all necessary memory and initializes // // private data members. // /////////////////////////////////////////////////////////////////////// // Empty Constructor initialization A0obj::A0obj(){ eqnCount=0; idRltnshpCount=0; numDraws=0; currentDraw=0; } //Deconstruction handled by R A0obj::A0obj(SEXP A0) { int i, ct=0, *structPtr;//*str; SEXP eqnListR, structR, valsR;//mR double *vals; // Rprintf("--- Setting eqnCount...\n"); PROTECT(eqnListR=coerceVector(listElt(A0,"m"),INTSXP)); eqnCount=INTEGER(eqnListR)[0]; UNPROTECT(1); // Rprintf("--- Setting freeParamIDX, strR...\n"); PROTECT(structR=coerceVector(listElt(A0,"struct"),INTSXP)); idRltnshpCount=length(structR); structPtr=INTEGER(structR); freeParamIDX=(int*)R_alloc(idRltnshpCount,sizeof(int)); for(i=0;ivaltmp, realloc flatWVals, valtmp==>flatWVals, free valtmp if(numVals) { double *valtmp=(double*)R_alloc(numVals,sizeof(double)); for(i=0;iflatWVals[%d:%d] \n",idx,n,n,st,end); double *tmp=(double*)R_alloc(end-st,sizeof(double)); for(i=st;i0) stval=arrayIDX[stidx-1]; else stval=0; // Get index array int *idxs=(int*)R_alloc(eqnCount,sizeof(int)); int ctidx=stval; for(i=0;i