SCM

SCM Repository

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

Diff of /pkg/src/dtrMatrix.c

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

revision 627, Mon Mar 7 17:36:38 2005 UTC revision 628, Thu Mar 10 17:57:47 2005 UTC
# Line 104  Line 104 
104  {  {
105      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("dgeMatrix")));      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("dgeMatrix")));
106    
107      SET_SLOT(val, Matrix_rcondSym,      SET_SLOT(val, Matrix_rcondSym, duplicate(GET_SLOT(from, Matrix_rcondSym)));
              duplicate(GET_SLOT(from, Matrix_rcondSym)));  
108      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(from, Matrix_xSym)));      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(from, Matrix_xSym)));
109      /* Dim < 2 can give a seg.fault problem in make_array_triangular(): */      /* Dim < 2 can give a seg.fault problem in make_array_triangular(): */
110      if (LENGTH(GET_SLOT(from, Matrix_DimSym)) < 2)      if (LENGTH(GET_SLOT(from, Matrix_DimSym)) < 2)
111          error(_(_("'Dim' slot has length less than two")));          error(_("'Dim' slot has length less than two"));
112      SET_SLOT(val, Matrix_DimSym,      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(from, Matrix_DimSym)));
113               duplicate(GET_SLOT(from, Matrix_DimSym)));      SET_SLOT(val, Matrix_DimNamesSym, duplicate(GET_SLOT(from, Matrix_DimNamesSym)));
114      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));
115      make_array_triangular(REAL(GET_SLOT(val, Matrix_xSym)), from);      make_array_triangular(REAL(GET_SLOT(val, Matrix_xSym)), from);
116      UNPROTECT(1);      UNPROTECT(1);
# Line 123  Line 122 
122      int *Dim = INTEGER(GET_SLOT(from, Matrix_DimSym));      int *Dim = INTEGER(GET_SLOT(from, Matrix_DimSym));
123      int m = Dim[0], n = Dim[1];      int m = Dim[0], n = Dim[1];
124      SEXP val = PROTECT(allocMatrix(REALSXP, m, n));      SEXP val = PROTECT(allocMatrix(REALSXP, m, n));
   
125      make_array_triangular(Memcpy(REAL(val),      make_array_triangular(Memcpy(REAL(val),
126                                   REAL(GET_SLOT(from, Matrix_xSym)), m * n),                                   REAL(GET_SLOT(from, Matrix_xSym)), m * n),
127                            from);                            from);
128        setAttrib(val, R_DimNamesSymbol, GET_SLOT(from, Matrix_DimNamesSym));
129      UNPROTECT(1);      UNPROTECT(1);
130      return val;      return val;
131  }  }

Legend:
Removed from v.627  
changed lines
  Added in v.628

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