SCM

SCM Repository

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

Diff of /pkg/src/dgCMatrix.c

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

revision 1866, Mon Jun 4 17:11:11 2007 UTC revision 1867, Mon Jun 4 17:13:02 2007 UTC
# Line 30  Line 30 
30          ans,    indP = GET_SLOT(x, indSym),          ans,    indP = GET_SLOT(x, indSym),
31          pP = GET_SLOT(x, Matrix_pSym);          pP = GET_SLOT(x, Matrix_pSym);
32      int npt = length(pP) - 1;      int npt = length(pP) - 1;
33      char *cl = class_P(x);/* maybe unduplicated */      char *ncl = strdup(class_P(x));
     char *ncl = strdup(cl);  
34      char *valid[] = {      char *valid[] = {
35          "dgCMatrix", "dsCMatrix", "dtCMatrix", /* 0: 0:2 */          "dgCMatrix", "dsCMatrix", "dtCMatrix", /* 0: 0:2 */
36          "lgCMatrix", "lsCMatrix", "ltCMatrix", /* 1: 3:5 */          "lgCMatrix", "lsCMatrix", "ltCMatrix", /* 1: 3:5 */
# Line 43  Line 42 
42          "ngRMatrix", "nsRMatrix", "ntRMatrix", /* 6: 18:20 */          "ngRMatrix", "nsRMatrix", "ntRMatrix", /* 6: 18:20 */
43          "zgRMatrix", "zsRMatrix", "ztRMatrix", /* 7: 21:23 */          "zgRMatrix", "zsRMatrix", "ztRMatrix", /* 7: 21:23 */
44          ""};          ""};
45      int ctype = Matrix_check_class(cl, valid);      int ctype = Matrix_check_class(ncl, valid);
46    
47      if (ctype < 0)      if (ctype < 0)
48          error(_("invalid class(x) '%s' in compressed_to_TMatrix(x)"), cl);          error(_("invalid class(x) '%s' in compressed_to_TMatrix(x)"), ncl);
49    
50      /* replace 'C' or 'R' with 'T' :*/      /* replace 'C' or 'R' with 'T' :*/
51      ncl[2] = 'T';      ncl[2] = 'T';
# Line 73  Line 72 
72  SEXP R_to_CMatrix(SEXP x)  SEXP R_to_CMatrix(SEXP x)
73  {  {
74      SEXP ans, tri = PROTECT(allocVector(LGLSXP, 1));      SEXP ans, tri = PROTECT(allocVector(LGLSXP, 1));
75      char *cl = class_P(x);/* maybe unduplicated */      char *ncl = strdup(class_P(x));
     char *ncl = strdup(cl);  
76      char *valid[] = {      char *valid[] = {
77          "dgRMatrix", "dsRMatrix", "dtRMatrix",          "dgRMatrix", "dsRMatrix", "dtRMatrix",
78          "lgRMatrix", "lsRMatrix", "ltRMatrix",          "lgRMatrix", "lsRMatrix", "ltRMatrix",
79          "ngRMatrix", "nsRMatrix", "ntRMatrix",          "ngRMatrix", "nsRMatrix", "ntRMatrix",
80          "zgRMatrix", "zsRMatrix", "ztRMatrix",          "zgRMatrix", "zsRMatrix", "ztRMatrix",
81          ""};          ""};
82      int ctype = Matrix_check_class(cl, valid);      int ctype = Matrix_check_class(ncl, valid);
83      int *x_dims = INTEGER(GET_SLOT(x, Matrix_DimSym)), *a_dims;      int *x_dims = INTEGER(GET_SLOT(x, Matrix_DimSym)), *a_dims;
84    
85      if (ctype < 0)      if (ctype < 0)
86          error(_("invalid class(x) '%s' in R_to_CMatrix(x)"), cl);          error(_("invalid class(x) '%s' in R_to_CMatrix(x)"), ncl);
87    
88      /* replace 'R' with 'C' : */      /* replace 'R' with 'C' : */
89      ncl[2] = 'C';      ncl[2] = 'C';

Legend:
Removed from v.1866  
changed lines
  Added in v.1867

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