SCM

SCM Repository

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

Diff of /pkg/Matrix/src/Csparse.c

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

revision 2784, Fri Jun 8 17:01:25 2012 UTC revision 2817, Sat Aug 11 23:41:46 2012 UTC
# Line 189  Line 189 
189      if(cl_x[2] != 'C') error(_("not a CsparseMatrix"));      if(cl_x[2] != 'C') error(_("not a CsparseMatrix"));
190      int nnz = LENGTH(GET_SLOT(x, Matrix_iSym));      int nnz = LENGTH(GET_SLOT(x, Matrix_iSym));
191      SEXP ans;      SEXP ans;
192      char *ncl = strdup(cl_x);      char *ncl = alloca(strlen(cl_x) + 1); /* not much memory required */
193        strcpy(ncl, cl_x);
194      double *dx_x; int *ix_x;      double *dx_x; int *ix_x;
195      ncl[0] = (r_kind == x_double ? 'd' :      ncl[0] = (r_kind == x_double ? 'd' :
196                (r_kind == x_logical ? 'l' :                (r_kind == x_logical ? 'l' :
# Line 266  Line 267 
267    
268  SEXP Csparse_general_to_symmetric(SEXP x, SEXP uplo)  SEXP Csparse_general_to_symmetric(SEXP x, SEXP uplo)
269  {  {
270        int *adims = INTEGER(GET_SLOT(x, Matrix_DimSym)), n = adims[0];
271        if(n != adims[1]) {
272            error(_("Csparse_general_to_symmetric(): matrix is not square!"));
273            return R_NilValue; /* -Wall */
274        }
275      CHM_SP chx = AS_CHM_SP__(x), chgx;      CHM_SP chx = AS_CHM_SP__(x), chgx;
276      int uploT = (*CHAR(STRING_ELT(uplo,0)) == 'U') ? 1 : -1;      int uploT = (*CHAR(STRING_ELT(uplo,0)) == 'U') ? 1 : -1;
277      int Rkind = (chx->xtype != CHOLMOD_PATTERN) ? Real_kind(x) : 0;      int Rkind = (chx->xtype != CHOLMOD_PATTERN) ? Real_kind(x) : 0;
278      R_CheckStack();      R_CheckStack();
   
279      chgx = cholmod_copy(chx, /* stype: */ uploT, chx->xtype, &c);      chgx = cholmod_copy(chx, /* stype: */ uploT, chx->xtype, &c);
280      /* xtype: pattern, "real", complex or .. */      /* xtype: pattern, "real", complex or .. */
281      return chm_sparse_to_SEXP(chgx, 1, 0, Rkind, "",      return chm_sparse_to_SEXP(chgx, 1, 0, Rkind, "",

Legend:
Removed from v.2784  
changed lines
  Added in v.2817

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