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 919, Fri Sep 16 17:27:06 2005 UTC revision 922, Sun Sep 18 16:33:54 2005 UTC
# Line 1  Line 1 
1  #include "dgCMatrix.h"  #include "dgCMatrix.h"
2    
3    #ifdef USE_CHOLMOD
4    #include "chm_common.h"
5    #endif
6    
7  SEXP dgCMatrix_validate(SEXP x)  SEXP dgCMatrix_validate(SEXP x)
8  {  {
9      SEXP pslot = GET_SLOT(x, Matrix_pSym),      SEXP pslot = GET_SLOT(x, Matrix_pSym),
# Line 102  Line 106 
106    
107  SEXP csc_tcrossprod(SEXP x)  SEXP csc_tcrossprod(SEXP x)
108  {  {
109    #ifdef USE_CHOLMOD
110        cholmod_sparse *cha = cholmod_aat(as_cholmod_sparse(x),
111            (int *) NULL, 0, 1, &c);
112    
113        cha->stype = -1;            /* set the symmetry */
114        cholmod_sort(cha, &c);      /* drop redundant entries */
115        return chm_sparse_to_SEXP(cha, -1);
116    #else
117    
118      SEXP pslot = GET_SLOT(x, Matrix_pSym),      SEXP pslot = GET_SLOT(x, Matrix_pSym),
119          ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dsCMatrix")));          ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dsCMatrix")));
120      int *xp = INTEGER(pslot),      int *xp = INTEGER(pslot),
# Line 159  Line 172 
172      Free(itmp); Free(xtmp); Free(iVal); Free(jVal); Free(xVal);      Free(itmp); Free(xtmp); Free(iVal); Free(jVal); Free(xVal);
173      UNPROTECT(1);      UNPROTECT(1);
174      return ans;      return ans;
175    #endif /* USE_CHOLMOD */
176  }  }
177    
178  SEXP csc_matrix_crossprod(SEXP x, SEXP y, SEXP classed)  SEXP csc_matrix_crossprod(SEXP x, SEXP y, SEXP classed)
# Line 372  Line 386 
386    
387  SEXP csc_transpose(SEXP x)  SEXP csc_transpose(SEXP x)
388  {  {
389    #ifdef USE_CHOLMOD
390        cholmod_sparse *chx = as_cholmod_sparse(x);
391        SEXP ans =
392            chm_sparse_to_SEXP(cholmod_transpose(chx, 1, &c), 1);
393        Free(chx);
394        return ans;
395    #else
396      SEXP xi = GET_SLOT(x, Matrix_iSym);      SEXP xi = GET_SLOT(x, Matrix_iSym);
397      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dgCMatrix")));      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dgCMatrix")));
398      int *adims = INTEGER(ALLOC_SLOT(ans, Matrix_DimSym, INTSXP, 2)),      int *adims = INTEGER(ALLOC_SLOT(ans, Matrix_DimSym, INTSXP, 2)),
# Line 394  Line 415 
415      Free(xj);      Free(xj);
416      UNPROTECT(1);      UNPROTECT(1);
417      return ans;      return ans;
418    #endif /* USE_CHOLMOD */
419  }  }
420    
421  SEXP csc_matrix_mm(SEXP a, SEXP b, SEXP classed, SEXP right)  SEXP csc_matrix_mm(SEXP a, SEXP b, SEXP classed, SEXP right)

Legend:
Removed from v.919  
changed lines
  Added in v.922

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