SCM

SCM Repository

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

Diff of /pkg/src/sscCrosstab.c

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

revision 143, Fri Apr 30 20:33:01 2004 UTC revision 146, Sat May 1 20:27:04 2004 UTC
# Line 2  Line 2 
2    
3  SEXP sscCrosstab(SEXP flist, SEXP upper)  SEXP sscCrosstab(SEXP flist, SEXP upper)
4  {  {
5      int      int **fpt, *Ap, *Gp, *TTi, *Ti, *Tj, *dims, i,
         **fpt,  
         *Ap,  
         *Gp,  
         *TTi,  
         *Ti,  
         *Tj,  
         *dims,  
         i,  
6          ncol = 0,          ncol = 0,
7          nfac = length(flist),          nfac = length(flist),
8          nfc2 = (nfac * (nfac - 1))/2, /* nfac choose 2 */          nfc2 = (nfac * (nfac - 1))/2, /* nfac choose 2 */
9          nobs = length(VECTOR_ELT(flist, 0)),          nobs = length(VECTOR_ELT(flist, 0)),
10          ntrpl,          ntrpl, nz, pos, up = asLogical(upper);
11          nz,      double *TTx, *Tx;
         pos,  
         up = asLogical(upper);  
     double  
         *TTx,  
         *Tx;  
12      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("sscCrosstab")));      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("sscCrosstab")));
13    
14      if (!isNewList(flist) || nfac < 1)      if (!isNewList(flist) || nfac < 1)
# Line 271  Line 258 
258      for (i = 0; i < n; i++) {      for (i = 0; i < n; i++) {
259          INTEGER(ans)[i] = i;    /* initialize permutation to identity */          INTEGER(ans)[i] = i;    /* initialize permutation to identity */
260      }      }
261        for (i = 1; i < nf; i++) {
262            col_metis_order(Gp[i - 1], Gp[i], Gp[i+1], Ap, Ai, INTEGER(ans));
263        }
264        if (0) {                    /* skip this part */
265      if (!ctab_isNested(n, nf, 0, Ap, Ai, Gp)) {      if (!ctab_isNested(n, nf, 0, Ap, Ai, Gp)) {
266          int *np = Calloc(n + 1, int), /* column pointers */          int *np = Calloc(n + 1, int), /* column pointers */
267              *ni = Calloc(length(iSlot) - n, int); /* row indices */              *ni = Calloc(length(iSlot) - n, int); /* row indices */
# Line 296  Line 287 
287          }          }
288          Free(np); Free(ni);          Free(np); Free(ni);
289      }      }
290        }
291      if (nf > 1 && up) {Free(Ap); Free(Ai);}      if (nf > 1 && up) {Free(Ap); Free(Ai);}
292      UNPROTECT(1);      UNPROTECT(1);
293      return ans;      return ans;

Legend:
Removed from v.143  
changed lines
  Added in v.146

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