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 1369, Mon Aug 14 18:54:04 2006 UTC revision 1371, Mon Aug 14 21:08:58 2006 UTC
# Line 38  Line 38 
38      return chm_dense_to_SEXP(chxd, 1);      return chm_dense_to_SEXP(chxd, 1);
39  }  }
40    
41    SEXP Csparse_to_logical(SEXP x, SEXP tri)
42    {
43        cholmod_sparse *chxs = as_cholmod_sparse(x);
44        cholmod_sparse
45            *chxcp = cholmod_copy(chxs, chxs->stype, CHOLMOD_PATTERN, &c);
46        int uploT = 0; char *diag = "";
47    
48        Free(chxs);
49        if (asLogical(tri)) {       /* triangular sparse matrices */
50            uploT = (strcmp(CHAR(asChar(GET_SLOT(x, Matrix_uploSym))), "U")) ?
51                -1 : 1;
52            diag = CHAR(asChar(GET_SLOT(x, Matrix_diagSym)));
53        }
54        return chm_sparse_to_SEXP(chxcp, 1, uploT, diag,
55                                    GET_SLOT(x, Matrix_DimNamesSym));
56    }
57    
58  SEXP Csparse_to_matrix(SEXP x)  SEXP Csparse_to_matrix(SEXP x)
59  {  {
60      cholmod_sparse *chxs = as_cholmod_sparse(x);      cholmod_sparse *chxs = as_cholmod_sparse(x);
# Line 61  Line 78 
78          diag = CHAR(asChar(GET_SLOT(x, Matrix_diagSym)));          diag = CHAR(asChar(GET_SLOT(x, Matrix_diagSym)));
79      }      }
80      return chm_triplet_to_SEXP(chxt, 1, uploT, diag,      return chm_triplet_to_SEXP(chxt, 1, uploT, diag,
81                                 duplicate(GET_SLOT(x, Matrix_DimNamesSym)));                                 GET_SLOT(x, Matrix_DimNamesSym));
82    }
83    
84    SEXP Csparse_symmetric_to_general(SEXP x)
85    {
86        cholmod_sparse *chx = as_cholmod_sparse(x), *chgx;
87    
88        if (!(chx->stype))
89            error(_("Nonsymmetric matrix in Csparse_symmeteric_to_general"));
90        chgx = cholmod_copy(chx, 0, chx->xtype, &c);
91        Free(chx);
92        return chm_sparse_to_SEXP(chgx, 1, 0, "",
93                                  GET_SLOT(x, Matrix_DimNamesSym));
94  }  }
95    
96  SEXP Csparse_transpose(SEXP x, SEXP tri)  SEXP Csparse_transpose(SEXP x, SEXP tri)

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

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