The R Project SVN R-packages

Rev

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

Rev 1315 Rev 1539
Line 1... Line 1...
1
				/* Sparse triangular matrices */
1
				/* Sparse triangular numeric matrices */
2
#include "dtCMatrix.h"
2
#include "dtCMatrix.h"
3
 
3
 
4
SEXP tsc_validate(SEXP x)
4
SEXP tsc_validate(SEXP x)
5
{
5
{
6
    SEXP val;
6
    SEXP val;
Line 17... Line 17...
17
    SEXP
17
    SEXP
18
	ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dtCMatrix"))),
18
	ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dtCMatrix"))),
19
	islot = GET_SLOT(x, Matrix_iSym);
19
	islot = GET_SLOT(x, Matrix_iSym);
20
    int nnz = length(islot),
20
    int nnz = length(islot),
21
	*adims, *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));
21
	*adims, *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));
-
 
22
    int up = CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0] == 'U';
22
 
23
 
23
    adims = INTEGER(ALLOC_SLOT(ans, Matrix_DimSym, INTSXP, 2));
24
    adims = INTEGER(ALLOC_SLOT(ans, Matrix_DimSym, INTSXP, 2));
24
    adims[0] = xdims[1]; adims[1] = xdims[0];
25
    adims[0] = xdims[1]; adims[1] = xdims[0];
25
    if (CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0] == 'U')
-
 
26
	SET_SLOT(ans, Matrix_uploSym, mkString("L"));
26
    SET_SLOT(ans, Matrix_uploSym, mkString(up ? "L" : "U"));
27
    csc_compTr(xdims[0], xdims[1], nnz,
27
    csc_compTr(xdims[0], xdims[1], nnz,
28
	       INTEGER(GET_SLOT(x, Matrix_pSym)), INTEGER(islot),
28
	       INTEGER(GET_SLOT(x, Matrix_pSym)), INTEGER(islot),
29
	       REAL(GET_SLOT(x, Matrix_xSym)),
29
	       REAL(GET_SLOT(x, Matrix_xSym)),
30
	       INTEGER(ALLOC_SLOT(ans, Matrix_pSym, INTSXP, xdims[0] + 1)),
30
	       INTEGER(ALLOC_SLOT(ans, Matrix_pSym, INTSXP, xdims[0] + 1)),
31
	       INTEGER(ALLOC_SLOT(ans, Matrix_iSym, INTSXP, nnz)),
31
	       INTEGER(ALLOC_SLOT(ans, Matrix_iSym, INTSXP, nnz)),