SCM

SCM Repository

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

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

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

revision 367, Sun Dec 5 13:50:43 2004 UTC revision 478, Wed Feb 2 14:33:51 2005 UTC
# Line 1  Line 1 
1                                  /* Sparse triangular matrices */                                  /* Sparse triangular matrices */
2  #include "tscMatrix.h"  #include "dtCMatrix.h"
3    
4  SEXP tsc_validate(SEXP x)  SEXP tsc_validate(SEXP x)
5  {  {
# Line 9  Line 9 
9  SEXP tsc_transpose(SEXP x)  SEXP tsc_transpose(SEXP x)
10  {  {
11      SEXP      SEXP
12          ans = PROTECT(NEW_OBJECT(MAKE_CLASS("tscMatrix"))),          ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dtCMatrix"))),
13          islot = GET_SLOT(x, Matrix_iSym);          islot = GET_SLOT(x, Matrix_iSym);
14      int nnz = length(islot),      int nnz = length(islot),
15          *adims, *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));          *adims, *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));
# Line 34  Line 34 
34      return ans;      return ans;
35  }  }
36    
37  SEXP tsc_to_triplet(SEXP x)  SEXP tsc_to_dgTMatrix(SEXP x)
38  {  {
39      SEXP ans;      SEXP ans;
40      if (toupper(CHAR(STRING_ELT(GET_SLOT(x, Matrix_diagSym), 0))[0]) != 'U')      if (toupper(CHAR(STRING_ELT(GET_SLOT(x, Matrix_diagSym), 0))[0]) != 'U')
41          ans = csc_to_triplet(x);          ans = csc_to_dgTMatrix(x);
42      else {                      /* unit triangular matrix */      else {                      /* unit triangular matrix */
43          SEXP islot = GET_SLOT(x, Matrix_iSym),          SEXP islot = GET_SLOT(x, Matrix_iSym),
44              pslot = GET_SLOT(x, Matrix_pSym);              pslot = GET_SLOT(x, Matrix_pSym);
# Line 49  Line 49 
49              *p = INTEGER(pslot);              *p = INTEGER(pslot);
50          double *ax;          double *ax;
51    
52          ans = PROTECT(NEW_OBJECT(MAKE_CLASS("tripletMatrix")));          ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dgTMatrix")));
53          SET_SLOT(ans, Matrix_DimSym, duplicate(GET_SLOT(x, Matrix_DimSym)));          SET_SLOT(ans, Matrix_DimSym, duplicate(GET_SLOT(x, Matrix_DimSym)));
54          SET_SLOT(ans, Matrix_iSym, allocVector(INTSXP, nout));          SET_SLOT(ans, Matrix_iSym, allocVector(INTSXP, nout));
55          ai = INTEGER(GET_SLOT(ans, Matrix_iSym));          ai = INTEGER(GET_SLOT(ans, Matrix_iSym));
# Line 114  Line 114 
114    
115  SEXP Parent_inverse(SEXP par, SEXP unitdiag)  SEXP Parent_inverse(SEXP par, SEXP unitdiag)
116  {  {
117      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("tscMatrix")));      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dtCMatrix")));
118      int *ap, *ai, *dims, *pr = INTEGER(par),      int *ap, *ai, *dims, *pr = INTEGER(par),
119          countDiag = 1 - asLogical(unitdiag),          countDiag = 1 - asLogical(unitdiag),
120          j, n = length(par), nnz;          j, n = length(par), nnz;

Legend:
Removed from v.367  
changed lines
  Added in v.478

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