SCM

SCM Repository

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

Diff of /pkg/src/lgTMatrix.c

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

revision 692, Mon Apr 18 14:34:33 2005 UTC revision 732, Tue May 17 17:18:14 2005 UTC
# Line 1  Line 1 
1  /* Sparse matrices in triplet form */                                  /* Logical, sparse matrices in triplet form */
2  #include "lgTMatrix.h"  #include "lgTMatrix.h"
3    
4  SEXP lgTMatrix_validate(SEXP x)  SEXP lgTMatrix_validate(SEXP x)
# Line 26  Line 26 
26      }      }
27      return ScalarLogical(1);      return ScalarLogical(1);
28  }  }
29    
30    SEXP lgTMatrix_as_lgCMatrix(SEXP x)
31    {
32        SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("lgCMatrix"))),
33            xDim = GET_SLOT(x, Matrix_DimSym),
34            xiP = GET_SLOT(x, Matrix_iSym);
35        int m = INTEGER(xDim)[0], n = INTEGER(xDim)[1], nz = length(xiP);
36    
37        SET_SLOT(ans, Matrix_DimSym, duplicate(xDim));
38        SET_SLOT(ans, Matrix_DimNamesSym,
39                 duplicate(GET_SLOT(x, Matrix_DimNamesSym)));
40        triplet_to_col(m, n, nz, INTEGER(xiP),
41                       INTEGER(GET_SLOT(x, Matrix_jSym)), (double *) NULL,
42                       INTEGER(ALLOC_SLOT(ans, Matrix_pSym, INTSXP, n + 1)),
43                       INTEGER(ALLOC_SLOT(ans, Matrix_iSym, INTSXP, nz)),
44                       (double *) NULL);
45        UNPROTECT(1);
46        return ans;
47    }

Legend:
Removed from v.692  
changed lines
  Added in v.732

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