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 676, Sat Mar 26 15:59:18 2005 UTC revision 677, Mon Mar 28 14:03:32 2005 UTC
# Line 190  Line 190 
190      return ans;      return ans;
191  }  }
192    
193  SEXP csc_to_dgTMatrix(SEXP x)  SEXP compressed_to_dgTMatrix(SEXP x, SEXP colP)
194  {  {
195      SEXP      int col = asLogical(colP);
196          ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dgTMatrix"))),      SEXP indSym = col ? Matrix_iSym : Matrix_jSym;
197          dimslot = GET_SLOT(x, Matrix_DimSym),      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dgTMatrix"))),
198          islot = GET_SLOT(x, Matrix_iSym),          indP = GET_SLOT(x, indSym),
199          pslot = GET_SLOT(x, Matrix_pSym);          pP = GET_SLOT(x, Matrix_pSym);
200      int *dims = INTEGER(dimslot), j, jj,      int npt = length(pP);
         *xp = INTEGER(pslot), *yj;  
201    
202      SET_SLOT(ans, Matrix_iSym, duplicate(islot));      SET_SLOT(ans, Matrix_DimSym, duplicate(GET_SLOT(x, Matrix_DimSym)));
     SET_SLOT(ans, Matrix_DimSym, duplicate(dimslot));  
203      SET_SLOT(ans, Matrix_xSym, duplicate(GET_SLOT(x, Matrix_xSym)));      SET_SLOT(ans, Matrix_xSym, duplicate(GET_SLOT(x, Matrix_xSym)));
204      SET_SLOT(ans, Matrix_jSym, allocVector(INTSXP, length(islot)));      SET_SLOT(ans, indSym, duplicate(indP));
205      yj = INTEGER(GET_SLOT(ans, Matrix_jSym));      expand_column_pointers(length(pP) - 1, INTEGER(pP),
206      jj = 0;                             INTEGER(ALLOC_SLOT(ans,
207      for (j = 0; j < dims[1]; j++) {                                                col ? Matrix_jSym : Matrix_iSym,
208          while (jj < xp[j + 1]) {                                                INTSXP, length(indP))));
             yj[jj] = j;  
             jj++;  
         }  
     }  
209      UNPROTECT(1);      UNPROTECT(1);
210      return ans;      return ans;
211  }  }

Legend:
Removed from v.676  
changed lines
  Added in v.677

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