1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| SEXP inocsum(SEXP p_nom, SEXP omega_c ) {
omega_c = coerceVector(omega_c, REALSXP);
SEXP feuille_choix, compart_choix, i_s_c;
int i,j;
double *CONIS_choix, om_c = REAL(omega_c)[0];
PROTECT(i_s_c = allocVector(REALSXP,1));
SEXP feuille = getListElement(p_nom,"feuilles");
for (i=0;i< length(feuille);i++) {
feuille_choix = VECTOR_ELT(feuille, i);
SEXP compart = getListElement(feuille,"compartiments");
for(j=0;j<7;j++) {
compart_choix = VECTOR_ELT(compart, j);
SEXP CONIs = getListElement(feuille,"CONIs");
CONIS_choix = REAL(CONIs);
REAL(i_s_c)[0] += ((om_c) * (*CONIS_choix));
};
};
UNPROTECT(1);
return(i_s_c);
} |
Partager