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 1366, Sat Aug 12 17:31:39 2006 UTC revision 1369, Mon Aug 14 18:54:04 2006 UTC
# Line 64  Line 64 
64                                 duplicate(GET_SLOT(x, Matrix_DimNamesSym)));                                 duplicate(GET_SLOT(x, Matrix_DimNamesSym)));
65  }  }
66    
67  SEXP Csparse_transpose(SEXP x)  SEXP Csparse_transpose(SEXP x, SEXP tri)
68  {  {
69      cholmod_sparse *chx = as_cholmod_sparse(x);      cholmod_sparse *chx = as_cholmod_sparse(x);
70      cholmod_sparse *chxt = cholmod_transpose(chx, (int) chx->xtype, &c);      cholmod_sparse *chxt = cholmod_transpose(chx, (int) chx->xtype, &c);
71      SEXP dn = PROTECT(duplicate(GET_SLOT(x, Matrix_DimNamesSym))), tmp;      SEXP dn = PROTECT(duplicate(GET_SLOT(x, Matrix_DimNamesSym))), tmp;
72        int uploT = 0; char *diag = "";
73    
74      Free(chx);      Free(chx);
75      tmp = VECTOR_ELT(dn, 0);    /* swap the dimnames */      tmp = VECTOR_ELT(dn, 0);    /* swap the dimnames */
76      SET_VECTOR_ELT(dn, 0, VECTOR_ELT(dn, 1));      SET_VECTOR_ELT(dn, 0, VECTOR_ELT(dn, 1));
77      SET_VECTOR_ELT(dn, 1, tmp);      SET_VECTOR_ELT(dn, 1, tmp);
78      UNPROTECT(1);      UNPROTECT(1);
79      return chm_sparse_to_SEXP(chxt, 1, 0, "", dn);      if (asLogical(tri)) {       /* triangular sparse matrices */
80            uploT = (strcmp(CHAR(asChar(GET_SLOT(x, Matrix_uploSym))), "U")) ?
81                1 : -1;             /* switch upper and lower for transpose */
82            diag = CHAR(asChar(GET_SLOT(x, Matrix_diagSym)));
83        }
84        return chm_sparse_to_SEXP(chxt, 1, uploT, diag, dn);
85  }  }
86    
87  SEXP Csparse_Csparse_prod(SEXP a, SEXP b)  SEXP Csparse_Csparse_prod(SEXP a, SEXP b)

Legend:
Removed from v.1366  
changed lines
  Added in v.1369

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