The R Project SVN R-packages

Rev

Rev 4529 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4529 Rev 4560
Line 115... Line 115...
115
    if (isString(nodes)) {
115
    if (isString(nodes)) {
116
	SEXP dnms = ALLOC_SLOT(ans, Matrix_DimNamesSym, VECSXP, 2);
116
	SEXP dnms = ALLOC_SLOT(ans, Matrix_DimNamesSym, VECSXP, 2);
117
	SET_VECTOR_ELT(dnms, 0, duplicate(nodes));
117
	SET_VECTOR_ELT(dnms, 0, duplicate(nodes));
118
	SET_VECTOR_ELT(dnms, 1, duplicate(nodes));
118
	SET_VECTOR_ELT(dnms, 1, duplicate(nodes));
119
    }
119
    }
120
    ii = Calloc(totl, int);
120
    ii = Alloca(totl, int);
121
    jj = Calloc(totl, int);
121
    jj = Alloca(totl, int);
122
    xx = Calloc(totl, double);
122
    xx = Alloca(totl, double);
-
 
123
    R_CheckStack();
123
    pos = 0;
124
    pos = 0;
124
    for (i = 0; i < nnd; i++) {
125
    for (i = 0; i < nnd; i++) {
125
	SEXP edg = VECTOR_ELT(edgeL, i);
126
	SEXP edg = VECTOR_ELT(edgeL, i);
126
	SEXP edges = Matrix_getElement(edg, "edges"),
127
	SEXP edges = Matrix_getElement(edg, "edges"),
127
	    weights = Matrix_getElement(edg, "weights");
128
	    weights = Matrix_getElement(edg, "weights");
Line 143... Line 144...
143
    }
144
    }
144
    Memcpy(INTEGER(ALLOC_SLOT(ans, Matrix_iSym, INTSXP, pos)), ii, pos);
145
    Memcpy(INTEGER(ALLOC_SLOT(ans, Matrix_iSym, INTSXP, pos)), ii, pos);
145
    Memcpy(INTEGER(ALLOC_SLOT(ans, Matrix_jSym, INTSXP, pos)), jj, pos);
146
    Memcpy(INTEGER(ALLOC_SLOT(ans, Matrix_jSym, INTSXP, pos)), jj, pos);
146
    Memcpy(REAL(ALLOC_SLOT(ans, Matrix_xSym, REALSXP, pos)), xx, pos);
147
    Memcpy(REAL(ALLOC_SLOT(ans, Matrix_xSym, REALSXP, pos)), xx, pos);
147
 
148
 
148
    Free(ii); Free(jj); Free(xx);
-
 
149
    UNPROTECT(1);
149
    UNPROTECT(1);
150
    return ans;
150
    return ans;
151
}
151
}
152
#endif
152
#endif