The R Project SVN R-packages

Rev

Rev 4543 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4543 Rev 4556
Line 283... Line 283...
283
    int *bdims = INTEGER(GET_SLOT(ans, Matrix_DimSym));
283
    int *bdims = INTEGER(GET_SLOT(ans, Matrix_DimSym));
284
    int j, n = bdims[0], nrhs = bdims[1];
284
    int j, n = bdims[0], nrhs = bdims[1];
285
    int *p = INTEGER(GET_SLOT(lu, Matrix_pSym)),
285
    int *p = INTEGER(GET_SLOT(lu, Matrix_pSym)),
286
	*q = LENGTH(qslot) ? INTEGER(qslot) : (int *) NULL;
286
	*q = LENGTH(qslot) ? INTEGER(qslot) : (int *) NULL;
287
    double *ax = REAL(GET_SLOT(ans, Matrix_xSym)),
287
    double *ax = REAL(GET_SLOT(ans, Matrix_xSym)),
288
	*x = Calloc(n, double);
288
	*x = Alloca(n, double);
289
    R_CheckStack();
289
    R_CheckStack();
290
 
290
 
291
    if (U->n != n || nrhs < 1 || n < 1)
291
    if (U->n != n || nrhs < 1 || n < 1)
292
	error(_("Dimensions of system to be solved are inconsistent"));
292
	error(_("Dimensions of system to be solved are inconsistent"));
293
    for (j = 0; j < nrhs; j++) {
293
    for (j = 0; j < nrhs; j++) {
Line 302... Line 302...
302
	if (q)			       /* b(q) = x */
302
	if (q)			       /* b(q) = x */
303
	    cs_ipvec(q, x, ax + j * n, n);
303
	    cs_ipvec(q, x, ax + j * n, n);
304
	else
304
	else
305
	    Memcpy(ax + j * n, x, n);
305
	    Memcpy(ax + j * n, x, n);
306
    }
306
    }
307
    Free(x);
-
 
308
    UNPROTECT(1);
307
    UNPROTECT(1);
309
    return ans;
308
    return ans;
310
}
309
}
311
 
310
 
312
SEXP dgCMatrix_cholsol(SEXP x, SEXP y)
311
SEXP dgCMatrix_cholsol(SEXP x, SEXP y)