SCM

SCM Repository

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

Diff of /pkg/src/cscMatrix.c

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

revision 371, Sun Dec 5 13:52:25 2004 UTC revision 476, Wed Feb 2 11:51:24 2005 UTC
# Line 49  Line 49 
49      int j, *iVal, ncol = length(pslot) - 1, maxnz, nnz = 0, *pVal;      int j, *iVal, ncol = length(pslot) - 1, maxnz, nnz = 0, *pVal;
50      double *xVal;      double *xVal;
51    
52      SET_SLOT(ans, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(ans, Matrix_factorSym, allocVector(VECSXP, 0));
53      maxnz = (ncol * (ncol + 1))/2;      maxnz = (ncol * (ncol + 1))/2;
54      iVal = Calloc(maxnz, int); xVal = Calloc(maxnz, double);      iVal = Calloc(maxnz, int); xVal = Calloc(maxnz, double);
55      SET_SLOT(ans, Matrix_pSym, allocVector(INTSXP, ncol + 1));      SET_SLOT(ans, Matrix_pSym, allocVector(INTSXP, ncol + 1));
# Line 114  Line 114 
114      int *itmp, *ansp;      int *itmp, *ansp;
115      double *xVal, *xtmp;      double *xVal, *xtmp;
116    
117      SET_SLOT(ans, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(ans, Matrix_factorSym, allocVector(VECSXP, 0));
118      ntrip = nrow;               /* number of triplets */      ntrip = nrow;               /* number of triplets */
119      for (j = 0; j < ncol; j++) {      for (j = 0; j < ncol; j++) {
120          int nzj = xp[j+1] - xp[j];          int nzj = xp[j+1] - xp[j];
# Line 251  Line 251 
251      SET_SLOT(ans, Matrix_DimSym, duplicate(Dimslot));      SET_SLOT(ans, Matrix_DimSym, duplicate(Dimslot));
252      SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nrow*ncol));      SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nrow*ncol));
253      SET_SLOT(ans, Matrix_rcondSym, allocVector(REALSXP, 0));      SET_SLOT(ans, Matrix_rcondSym, allocVector(REALSXP, 0));
254      SET_SLOT(ans, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(ans, Matrix_factorSym, allocVector(VECSXP, 0));
255      ax = REAL(GET_SLOT(ans, Matrix_xSym));      ax = REAL(GET_SLOT(ans, Matrix_xSym));
256      for (j = 0; j < (nrow * ncol); j++) ax[j] = 0.;      for (j = 0; j < (nrow * ncol); j++) ax[j] = 0.;
257      for (j = 0; j < ncol; j++) {      for (j = 0; j < ncol; j++) {
# Line 275  Line 275 
275      if (!(isMatrix(A) && isReal(A)))      if (!(isMatrix(A) && isReal(A)))
276          error("A must be a numeric matrix");          error("A must be a numeric matrix");
277      nrow = adims[0]; ncol = adims[1];      nrow = adims[0]; ncol = adims[1];
278      SET_SLOT(val, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));
279      SET_SLOT(val, Matrix_pSym, allocVector(INTSXP, ncol + 1));      SET_SLOT(val, Matrix_pSym, allocVector(INTSXP, ncol + 1));
280      vp = INTEGER(GET_SLOT(val, Matrix_pSym));      vp = INTEGER(GET_SLOT(val, Matrix_pSym));
281      maxnz = nrow * ncol;      maxnz = nrow * ncol;
# Line 357  Line 357 
357          *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));          *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));
358    
359      adims[0] = xdims[1]; adims[1] = xdims[0];      adims[0] = xdims[1]; adims[1] = xdims[0];
360      SET_SLOT(ans, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(ans, Matrix_factorSym, allocVector(VECSXP, 0));
361      SET_SLOT(ans, Matrix_pSym, allocVector(INTSXP, xdims[0] + 1));      SET_SLOT(ans, Matrix_pSym, allocVector(INTSXP, xdims[0] + 1));
362      SET_SLOT(ans, Matrix_iSym, allocVector(INTSXP, nnz));      SET_SLOT(ans, Matrix_iSym, allocVector(INTSXP, nnz));
363      SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nnz));      SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nnz));
# Line 408  Line 408 
408      int *iperm, *prm, *vi, *vp, *xi, *xp, j, k, ncol, pos;      int *iperm, *prm, *vi, *vp, *xi, *xp, j, k, ncol, pos;
409      double *vx, *xx;      double *vx, *xx;
410    
411      SET_SLOT(val, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));
412      tmp = GET_SLOT(x, Matrix_DimSym);      tmp = GET_SLOT(x, Matrix_DimSym);
413      SET_SLOT(val, Matrix_DimSym, duplicate(tmp));      SET_SLOT(val, Matrix_DimSym, duplicate(tmp));
414      ncol = INTEGER(tmp)[1];      ncol = INTEGER(tmp)[1];

Legend:
Removed from v.371  
changed lines
  Added in v.476

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