SCM

SCM Repository

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

Diff of /pkg/src/Csparse.c

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

revision 1708, Fri Dec 22 19:53:37 2006 UTC revision 1710, Tue Dec 26 15:57:06 2006 UTC
# Line 59  Line 59 
59    
60      Free(chxs);      Free(chxs);
61      if (asLogical(tri)) {       /* triangular sparse matrices */      if (asLogical(tri)) {       /* triangular sparse matrices */
62          uploT = (strcmp(CHAR(asChar(GET_SLOT(x, Matrix_uploSym))), "U")) ?          uploT = (*uplo_P(x) == 'U') ? 1 : -1;
             -1 : 1;  
63          diag = CHAR(asChar(GET_SLOT(x, Matrix_diagSym)));          diag = CHAR(asChar(GET_SLOT(x, Matrix_diagSym)));
64      }      }
65      return chm_sparse_to_SEXP(chxcp, 1, uploT, 0, diag,      return chm_sparse_to_SEXP(chxcp, 1, uploT, 0, diag,
# Line 87  Line 86 
86    
87      Free(chxs);      Free(chxs);
88      if (asLogical(tri)) {       /* triangular sparse matrices */      if (asLogical(tri)) {       /* triangular sparse matrices */
89          uploT = (*uplo_P(x) == 'U') ? -1 : 1;          uploT = (*uplo_P(x) == 'U') ? 1 : -1;
90          diag = diag_P(x);          diag = diag_P(x);
91      }      }
92      return chm_triplet_to_SEXP(chxt, 1, uploT, Rkind, diag,      return chm_triplet_to_SEXP(chxt, 1, uploT, Rkind, diag,
# Line 112  Line 111 
111  SEXP Csparse_general_to_symmetric(SEXP x, SEXP uplo)  SEXP Csparse_general_to_symmetric(SEXP x, SEXP uplo)
112  {  {
113      cholmod_sparse *chx = as_cholmod_sparse(x), *chgx;      cholmod_sparse *chx = as_cholmod_sparse(x), *chgx;
114      int uploT = (*CHAR(asChar(uplo)) == 'U') ? -1 : 1;      int uploT = (*CHAR(asChar(uplo)) == 'U') ? 1 : -1;
115      int Rkind = (chx->xtype == CHOLMOD_REAL) ? Real_kind(x) : 0;      int Rkind = (chx->xtype == CHOLMOD_REAL) ? Real_kind(x) : 0;
116    
117      chgx = cholmod_copy(chx, /* stype: */ uploT, chx->xtype, &c);      chgx = cholmod_copy(chx, /* stype: */ uploT, chx->xtype, &c);
# Line 135  Line 134 
134      SET_VECTOR_ELT(dn, 0, VECTOR_ELT(dn, 1));      SET_VECTOR_ELT(dn, 0, VECTOR_ELT(dn, 1));
135      SET_VECTOR_ELT(dn, 1, tmp);      SET_VECTOR_ELT(dn, 1, tmp);
136      UNPROTECT(1);      UNPROTECT(1);
137      if (asLogical(tri)) {       /* triangular sparse matrices */      if (asLogical(tri)) { /* triangular sparse matrices : SWAP 'uplo' */
138          uploT = (*uplo_P(x) == 'U') ? -1 : 1;          uploT = (*uplo_P(x) == 'U') ? -1 : 1;
139          diag = diag_P(x);          diag = diag_P(x);
140      }      }
# Line 320  Line 319 
319          cholmod_sparse *eye = cholmod_speye(chx->nrow, chx->ncol, chx->xtype, &c);          cholmod_sparse *eye = cholmod_speye(chx->nrow, chx->ncol, chx->xtype, &c);
320          double one[] = {1, 0};          double one[] = {1, 0};
321          cholmod_sparse *ans = cholmod_add(chx, eye, one, one, TRUE, TRUE, &c);          cholmod_sparse *ans = cholmod_add(chx, eye, one, one, TRUE, TRUE, &c);
322          int uploT = (strcmp(CHAR(asChar(GET_SLOT(x, Matrix_uploSym))), "U")) ?          int uploT = (*uplo_P(x) == 'U') ? 1 : -1;
             -1 : 1;  
323          int Rkind = (chx->xtype == CHOLMOD_REAL) ? Real_kind(x) : 0;          int Rkind = (chx->xtype == CHOLMOD_REAL) ? Real_kind(x) : 0;
324    
325          Free(chx); cholmod_free_sparse(&eye, &c);          Free(chx); cholmod_free_sparse(&eye, &c);

Legend:
Removed from v.1708  
changed lines
  Added in v.1710

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