SCM

SCM Repository

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

Diff of /pkg/Matrix/src/dtCMatrix.c

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

revision 2770, Mon Mar 5 13:41:23 2012 UTC revision 2889, Thu Aug 8 21:06:22 2013 UTC
# Line 108  Line 108 
108    
109      int *xp = INTEGER(ALLOC_SLOT(ans, Matrix_pSym, INTSXP, (B->n) + 1)),      int *xp = INTEGER(ALLOC_SLOT(ans, Matrix_pSym, INTSXP, (B->n) + 1)),
110          xnz = 10 * B->p[B->n];  /* initial estimate of nnz in x */          xnz = 10 * B->p[B->n];  /* initial estimate of nnz in x */
111      int *ti = Calloc(xnz, int), k, lo = uplo_P(a)[0] == 'L', pos = 0;      int k, lo = uplo_P(a)[0] == 'L', pos = 0;
112      double *tx = Calloc(xnz, double);      int    *ti = Calloc(xnz, int),     *xi = Calloc(2*A->n, int); /* for cs_reach */
113      double  *wrk = Calloc(A->n, double);      double *tx = Calloc(xnz, double), *wrk = Calloc(  A->n, double);
     int *xi = Calloc(2*A->n, int);      /* for cs_reach */  
114    
115      slot_dup(ans, b, Matrix_DimSym);      slot_dup(ans, b, Matrix_DimSym);
116      SET_DimNames(ans, b);      SET_DimNames(ans, b);
117      xp[0] = 0;      xp[0] = 0;
118      for (k = 0; k < B->n; k++) {      for (k = 0; k < B->n; k++) {
119          int top = cs_spsolve (A, B, k, xi, wrk, (int *)NULL, lo);          int top = cs_spsolve (A, B, k, xi, wrk, (int *)NULL, lo);
120          int nz = A->n - top, p;          int nz = A->n - top;
121    
122          xp[k + 1] = nz + xp[k];          xp[k + 1] = nz + xp[k];
123          if (xp[k + 1] > xnz) {          if (xp[k + 1] > xnz) {
# Line 127  Line 126 
126              tx = Realloc(tx, xnz, double);              tx = Realloc(tx, xnz, double);
127          }          }
128          if (lo)                 /* increasing row order */          if (lo)                 /* increasing row order */
129              for(p = top; p < A->n; p++, pos++) {              for(int p = top; p < A->n; p++, pos++) {
130                  ti[pos] = xi[p];                  ti[pos] = xi[p];
131                  tx[pos] = wrk[xi[p]];                  tx[pos] = wrk[xi[p]];
132              }              }
133          else                    /* decreasing order, reverse copy */          else                    /* decreasing order, reverse copy */
134              for(p = A->n - 1; p >= top; p--, pos++) {              for(int p = A->n - 1; p >= top; p--, pos++) {
135                  ti[pos] = xi[p];                  ti[pos] = xi[p];
136                  tx[pos] = wrk[xi[p]];                  tx[pos] = wrk[xi[p]];
137              }              }

Legend:
Removed from v.2770  
changed lines
  Added in v.2889

root@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