SCM

SCM Repository

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

Diff of /pkg/src/geMatrix.c

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

revision 342, Mon Nov 15 13:55:52 2004 UTC revision 343, Mon Nov 15 23:29:28 2004 UTC
# Line 79  Line 79 
79      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("poMatrix")));      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("poMatrix")));
80      int *Dims = INTEGER(GET_SLOT(x, Matrix_DimSym)),      int *Dims = INTEGER(GET_SLOT(x, Matrix_DimSym)),
81          *vDims;          *vDims;
82      int n = Dims[1];      int i, n = Dims[1];
83      double one = 1.0, zero = 0.0;      int nsqr = n * n;
84        double one = 1.0, *xvals, zero = 0.0;
85    
86      SET_SLOT(val, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(val, Matrix_factorization, allocVector(VECSXP, 0));
87      SET_SLOT(val, Matrix_rcondSym, allocVector(REALSXP, 0));      SET_SLOT(val, Matrix_rcondSym, allocVector(REALSXP, 0));
# Line 89  Line 90 
90      vDims = INTEGER(GET_SLOT(val, Matrix_DimSym));      vDims = INTEGER(GET_SLOT(val, Matrix_DimSym));
91      vDims[0] = vDims[1] = n;      vDims[0] = vDims[1] = n;
92      SET_SLOT(val, Matrix_xSym, allocVector(REALSXP, n * n));      SET_SLOT(val, Matrix_xSym, allocVector(REALSXP, n * n));
93        xvals = REAL(GET_SLOT(val, Matrix_xSym));
94        for (i = 0; i < nsqr; i++) xvals[i] = 0.; /* keep valgrind happy */
95      if (Dims[0] > 0) {      if (Dims[0] > 0) {
96          F77_CALL(dsyrk)("U", "T", vDims, Dims,          F77_CALL(dsyrk)("U", "T", vDims, Dims,
97                          &one, REAL(GET_SLOT(x, Matrix_xSym)), Dims,                          &one, REAL(GET_SLOT(x, Matrix_xSym)), Dims,
98                          &zero, REAL(GET_SLOT(val, Matrix_xSym)), vDims);                          &zero, REAL(GET_SLOT(val, Matrix_xSym)), vDims);
     } else {  
         int i, nsqr = n * n;  
         double *xvals = REAL(GET_SLOT(val, Matrix_xSym));  
         for (i = 0; i < nsqr; i++) xvals[i] = 0.;  
99      }      }
   
100      UNPROTECT(1);      UNPROTECT(1);
101      return val;      return val;
102  }  }

Legend:
Removed from v.342  
changed lines
  Added in v.343

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