SCM

SCM Repository

[matrix] Diff of /pkg/src/dsCMatrix.c
ViewVC logotype

Diff of /pkg/src/dsCMatrix.c

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

revision 582, Mon Feb 28 18:15:21 2005 UTC revision 587, Wed Mar 2 18:19:15 2005 UTC
# Line 136  Line 136 
136    
137  SEXP ssc_transpose(SEXP x)  SEXP ssc_transpose(SEXP x)
138  {  {
139      SEXP      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dsCMatrix"))),
         ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dsCMatrix"))),  
140          islot = GET_SLOT(x, Matrix_iSym);          islot = GET_SLOT(x, Matrix_iSym);
141      int nnz = length(islot),      int nnz = length(islot), *adims,
         *adims = INTEGER(GET_SLOT(ans, Matrix_DimSym)),  
142          *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));          *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));
143    
144        adims = INTEGER(ALLOC_SLOT(ans, Matrix_DimSym, INTSXP, 2));
145      adims[0] = xdims[1]; adims[1] = xdims[0];      adims[0] = xdims[1]; adims[1] = xdims[0];
146      if (CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0] == 'U')      if (CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0] == 'U')
147          SET_SLOT(ans, Matrix_uploSym, mkString("L"));          SET_SLOT(ans, Matrix_uploSym, mkString("L"));
148      SET_SLOT(ans, Matrix_pSym, allocVector(INTSXP, xdims[0] + 1));      csc_compTr(xdims[0], xdims[1], nnz,
149      SET_SLOT(ans, Matrix_iSym, allocVector(INTSXP, nnz));                 INTEGER(GET_SLOT(x, Matrix_pSym)), INTEGER(islot),
     SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nnz));  
     csc_components_transpose(xdims[0], xdims[1], nnz,  
                              INTEGER(GET_SLOT(x, Matrix_pSym)),  
                              INTEGER(islot),  
150                               REAL(GET_SLOT(x, Matrix_xSym)),                               REAL(GET_SLOT(x, Matrix_xSym)),
151                               INTEGER(GET_SLOT(ans, Matrix_pSym)),                 INTEGER(ALLOC_SLOT(ans, Matrix_pSym, INTSXP, xdims[0] + 1)),
152                               INTEGER(GET_SLOT(ans, Matrix_iSym)),                 INTEGER(ALLOC_SLOT(ans, Matrix_iSym, INTSXP, nnz)),
153                               REAL(GET_SLOT(ans, Matrix_xSym)));                 REAL(ALLOC_SLOT(ans, Matrix_xSym, REALSXP, nnz)));
154      UNPROTECT(1);      UNPROTECT(1);
155      return ans;      return ans;
156  }  }

Legend:
Removed from v.582  
changed lines
  Added in v.587

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