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 93, Fri Apr 16 21:19:40 2004 UTC revision 127, Sun Apr 25 18:06:27 2004 UTC
# Line 127  Line 127 
127    * @param Ai row indices (modified)    * @param Ai row indices (modified)
128    * @param rperm on return contains the permutation of the rows    * @param rperm on return contains the permutation of the rows
129    * @param cperm if non-null, on return contains the permutation of the columns    * @param cperm if non-null, on return contains the permutation of the columns
   * @param useL when more than one row matches maxrc, use last match  
130    */    */
131  static  static
132  void pair_perm(int m, int n, int Ap[], int Ai[], int rperm[], int cperm[],  void pair_perm(int m, int n, int Ap[], int Ai[], int rperm[], int cperm[])
                int useL)  
133  {  {
134      int *cc = Calloc(n, int),   /* column counts */      int *cc = Calloc(n, int),   /* column counts */
135          *cm = Calloc(n, int),   /* column removed */          *cm = Calloc(n, int),   /* column removed */
# Line 198  Line 196 
196      Free(cc); Free(cm); Free(rc);      Free(cc); Free(cm); Free(rc);
197  }  }
198    
199  SEXP sscCrosstab_groupedPerm(SEXP ctab, SEXP useLast)  SEXP sscCrosstab_groupedPerm(SEXP ctab)
200  {  {
201      SEXP      SEXP
202          GpSlot = GET_SLOT(ctab, Matrix_GpSym),          GpSlot = GET_SLOT(ctab, Matrix_GpSym),
# Line 207  Line 205 
205      int *Ai = INTEGER(iSlot),      int *Ai = INTEGER(iSlot),
206          *Ap = INTEGER(pSlot),          *Ap = INTEGER(pSlot),
207          *Gp = INTEGER(GpSlot),          *Gp = INTEGER(GpSlot),
         useL = asLogical(useLast),  
208          i,          i,
209          n = length(pSlot) - 1,  /* number of columns */          n = length(pSlot) - 1,  /* number of columns */
210          nf = length(GpSlot) - 1, /* number of factors */          nf = length(GpSlot) - 1, /* number of factors */
# Line 237  Line 234 
234              np[j + 1 - p1] = p0;              np[j + 1 - p1] = p0;
235          }          }
236          pair_perm(p3 - p2, p2 - p1, np, ni,          pair_perm(p3 - p2, p2 - p1, np, ni,
237                    INTEGER(ans) + p2, INTEGER(ans), useL);                    INTEGER(ans) + p2, INTEGER(ans));
238          for (j = p2; j < p3; j++) INTEGER(ans)[j] += p2;          for (j = p2; j < p3; j++) INTEGER(ans)[j] += p2;
239      }      }
240    

Legend:
Removed from v.93  
changed lines
  Added in v.127

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