SCM

SCM Repository

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

Diff of /pkg/src/ldense.c

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

revision 1547, Mon Sep 11 14:49:39 2006 UTC revision 1548, Mon Sep 11 22:13:07 2006 UTC
# Line 1  Line 1 
1  #include "ldense.h"  #include "ldense.h"
2    
3    /* dense logical Matrices "ldenseMatrix" classes --- almost identical to
4     * dense nonzero-pattern: "ndenseMatrix" ones
5     */
6    
7  /* this is very close to dspMatrix_as_dsy* () in ./dspMatrix.c : */  /* this is very close to dspMatrix_as_dsy* () in ./dspMatrix.c : */
8  SEXP lspMatrix_as_lsyMatrix(SEXP from)  SEXP lspMatrix_as_lsyMatrix(SEXP from, SEXP kind)
9  {  {
10      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("lsyMatrix"))),      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS((asInteger(kind) == 1) ?
11                                                 "nsyMatrix" :
12                                                 "lsyMatrix"))),
13          uplo = GET_SLOT(from, Matrix_uploSym),          uplo = GET_SLOT(from, Matrix_uploSym),
14          dimP = GET_SLOT(from, Matrix_DimSym),          dimP = GET_SLOT(from, Matrix_DimSym),
15          dmnP = GET_SLOT(from, Matrix_DimNamesSym);          dmnP = GET_SLOT(from, Matrix_DimNamesSym);
# Line 20  Line 26 
26  }  }
27    
28  /* this is very close to dsyMatrix_as_dsp* () in ./dsyMatrix.c : */  /* this is very close to dsyMatrix_as_dsp* () in ./dsyMatrix.c : */
29  SEXP lsyMatrix_as_lspMatrix(SEXP from)  SEXP lsyMatrix_as_lspMatrix(SEXP from, SEXP kind)
30  {  {
31      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("lspMatrix"))),      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS((asInteger(kind) == 1) ?
32                                                 "nspMatrix" :
33                                                 "lspMatrix"))),
34          uplo = GET_SLOT(from, Matrix_uploSym),          uplo = GET_SLOT(from, Matrix_uploSym),
35          dimP = GET_SLOT(from, Matrix_DimSym);          dimP = GET_SLOT(from, Matrix_DimSym);
36      int n = *INTEGER(dimP);      int n = *INTEGER(dimP);
# Line 38  Line 46 
46  }  }
47    
48  /* this is very close to dtpMatrix_as_dtr* () in ./dtpMatrix.c : */  /* this is very close to dtpMatrix_as_dtr* () in ./dtpMatrix.c : */
49  SEXP ltpMatrix_as_ltrMatrix(SEXP from)  SEXP ltpMatrix_as_ltrMatrix(SEXP from, SEXP kind)
50  {  {
51      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("ltrMatrix"))),      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS((asInteger(kind) == 1) ?
52                                                 "ntrMatrix" :
53                                                 "ltrMatrix"))),
54          uplo = GET_SLOT(from, Matrix_uploSym),          uplo = GET_SLOT(from, Matrix_uploSym),
55          diag = GET_SLOT(from, Matrix_diagSym),          diag = GET_SLOT(from, Matrix_diagSym),
56          dimP = GET_SLOT(from, Matrix_DimSym),          dimP = GET_SLOT(from, Matrix_DimSym),
# Line 59  Line 69 
69  }  }
70    
71  /* this is very close to dtrMatrix_as_dtp* () in ./dtrMatrix.c : */  /* this is very close to dtrMatrix_as_dtp* () in ./dtrMatrix.c : */
72  SEXP ltrMatrix_as_ltpMatrix(SEXP from)  SEXP ltrMatrix_as_ltpMatrix(SEXP from, SEXP kind)
73  {  {
74      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("ltpMatrix"))),      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS((asInteger(kind) == 1) ?
75                                                 "ntpMatrix" :
76                                                 "ltpMatrix"))),
77          uplo = GET_SLOT(from, Matrix_uploSym),          uplo = GET_SLOT(from, Matrix_uploSym),
78          diag = GET_SLOT(from, Matrix_diagSym),          diag = GET_SLOT(from, Matrix_diagSym),
79          dimP = GET_SLOT(from, Matrix_DimSym);          dimP = GET_SLOT(from, Matrix_DimSym);
# Line 80  Line 92 
92  }  }
93    
94  /* this is very close to dtrMatrix_as_dge*() :*/  /* this is very close to dtrMatrix_as_dge*() :*/
95  SEXP ltrMatrix_as_lgeMatrix(SEXP from)  SEXP ltrMatrix_as_lgeMatrix(SEXP from, SEXP kind)
96  {  {
97      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("lgeMatrix")));      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS((asInteger(kind) == 1) ?
98                                                 "ngeMatrix" :
99                                                 "lgeMatrix")));
100    
101      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(from, Matrix_xSym)));      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(from, Matrix_xSym)));
102      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(from, Matrix_DimSym)));      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(from, Matrix_DimSym)));
# Line 95  Line 109 
109  }  }
110    
111  /* this is very close to dsyMatrix_as_dge*() :*/  /* this is very close to dsyMatrix_as_dge*() :*/
112  SEXP lsyMatrix_as_lgeMatrix(SEXP from)  SEXP lsyMatrix_as_lgeMatrix(SEXP from, SEXP kind)
113  {  {
114      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("lgeMatrix")));      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS((asInteger(kind) == 1) ?
115                                                 "ngeMatrix" :
116                                                 "lgeMatrix")));
117    
118      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(from, Matrix_xSym)));      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(from, Matrix_xSym)));
119      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(from, Matrix_DimSym)));      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(from, Matrix_DimSym)));

Legend:
Removed from v.1547  
changed lines
  Added in v.1548

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge