SCM

SCM Repository

[matrix] Diff of /branches/Matrix-mer2/src/dgCMatrix.c
ViewVC logotype

Diff of /branches/Matrix-mer2/src/dgCMatrix.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 683, Thu Mar 31 17:10:16 2005 UTC revision 726, Thu May 12 14:59:04 2005 UTC
# Line 349  Line 349 
349    
350  SEXP csc_transpose(SEXP x)  SEXP csc_transpose(SEXP x)
351  {  {
352      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dgCMatrix"))),      SEXP xi = GET_SLOT(x, Matrix_iSym);
353          islot = GET_SLOT(x, Matrix_iSym);      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dgCMatrix")));
354      int *adims, *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym)),      int *adims = INTEGER(ALLOC_SLOT(ans, Matrix_DimSym, INTSXP, 2)),
355          nnz = length(islot);          *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym)),
356            nz = length(xi);
357        int *xj = Calloc(nz, int);
358        SEXP adn = ALLOC_SLOT(ans, Matrix_DimNamesSym, VECSXP, 2),
359            xdn = GET_SLOT(x, Matrix_DimNamesSym);
360    
     adims = INTEGER(ALLOC_SLOT(ans, Matrix_DimSym, INTSXP, 2));  
361      adims[0] = xdims[1]; adims[1] = xdims[0];      adims[0] = xdims[1]; adims[1] = xdims[0];
362      csc_compTr(xdims[0], xdims[1], nnz,      SET_VECTOR_ELT(adn, 0, VECTOR_ELT(xdn, 1));
363                 INTEGER(GET_SLOT(x, Matrix_pSym)), INTEGER(islot),      SET_VECTOR_ELT(adn, 1, VECTOR_ELT(xdn, 0));
364        triplet_to_col(adims[0], adims[1], nz,
365                       expand_cmprPt(xdims[1], INTEGER(GET_SLOT(x, Matrix_pSym)), xj),
366                       INTEGER(xi),
367                 REAL(GET_SLOT(x, Matrix_xSym)),                 REAL(GET_SLOT(x, Matrix_xSym)),
368                 INTEGER(ALLOC_SLOT(ans, Matrix_pSym, INTSXP, xdims[0] + 1)),                     INTEGER(ALLOC_SLOT(ans, Matrix_pSym, INTSXP, adims[1] + 1)),
369                 INTEGER(ALLOC_SLOT(ans, Matrix_iSym, INTSXP, nnz)),                     INTEGER(ALLOC_SLOT(ans, Matrix_iSym, INTSXP, nz)),
370                 REAL(ALLOC_SLOT(ans, Matrix_xSym, REALSXP, nnz)));                     REAL(ALLOC_SLOT(ans, Matrix_xSym, REALSXP, nz)));
371        Free(xj);
372      UNPROTECT(1);      UNPROTECT(1);
373      return ans;      return ans;
374  }  }

Legend:
Removed from v.683  
changed lines
  Added in v.726

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge