The R Project SVN R-packages

Rev

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

Rev 4668 Rev 4904
Line 189... Line 189...
189
    SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("sparseQR")));
189
    SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("sparseQR")));
190
    CSP A = AS_CSP(Ap), D;
190
    CSP A = AS_CSP(Ap), D;
191
    css *S;
191
    css *S;
192
    csn *N;
192
    csn *N;
193
    int m = A->m, n = A->n, ord = asLogical(order) ? 3 : 0, *p;
193
    int m = A->m, n = A->n, ord = asLogical(order) ? 3 : 0, *p;
-
 
194
    int *dims = INTEGER(ALLOC_SLOT(ans, Matrix_DimSym, INTSXP, 2));
194
    R_CheckStack();
195
    R_CheckStack();
195
 
196
 
196
    if (m < n) error("A must have # rows >= # columns") ;
197
    if (m < n) error("A must have # rows >= # columns") ;
-
 
198
    dims[0] = m; dims[1] = n;
197
    S = cs_sqr(ord, A, 1);	/* symbolic QR ordering & analysis*/
199
    S = cs_sqr(ord, A, 1);	/* symbolic QR ordering & analysis*/
198
    if (!S) error("cs_sqr failed");
200
    if (!S) error("cs_sqr failed");
199
    N = cs_qr(A, S);		/* numeric QR factorization */
201
    N = cs_qr(A, S);		/* numeric QR factorization */
200
    if (!N) error("cs_qr failed") ;
202
    if (!N) error("cs_qr failed") ;
201
    cs_dropzeros(N->L);		/* drop zeros from V and sort */
203
    cs_dropzeros(N->L);		/* drop zeros from V and sort */