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 184, Sun May 30 22:38:37 2004 UTC revision 478, Wed Feb 2 14:33:51 2005 UTC
# Line 59  Line 59 
59      }      }
60      SET_SLOT(val, Matrix_pSym, allocVector(INTSXP, ncol + 1));      SET_SLOT(val, Matrix_pSym, allocVector(INTSXP, ncol + 1));
61      Ap = INTEGER(GET_SLOT(val, Matrix_pSym));      Ap = INTEGER(GET_SLOT(val, Matrix_pSym));
62      triplet_to_col(ncol, ncol, ntrpl, Ti, Tj, Tx, Ap, TTi, TTx);      dgTMatrix_to_dgCMatrix(ncol, ncol, ntrpl, Ti, Tj, Tx, Ap, TTi, TTx);
63      nz = Ap[ncol];              /* non-zeros in Z'Z crosstab */      nz = Ap[ncol];              /* non-zeros in Z'Z crosstab */
64      SET_SLOT(val, Matrix_iSym, allocVector(INTSXP, nz));      SET_SLOT(val, Matrix_iSym, allocVector(INTSXP, nz));
65      SET_SLOT(val, Matrix_xSym, allocVector(REALSXP, nz));      SET_SLOT(val, Matrix_xSym, allocVector(REALSXP, nz));
# Line 115  Line 115 
115                  }                  }
116              }              }
117          }          }
118          triplet_to_col(n, n, nnz, TTi, Tj, (double *) NULL,          dgTMatrix_to_dgCMatrix(n, n, nnz, TTi, Tj, (double *) NULL,
119                         Ap, Ai, (double *) NULL);                         Ap, Ai, (double *) NULL);
120          ssc_metis_order(n, Ap, Ai, perm, iperm);          ssc_metis_order(n, Ap, Ai, perm, iperm);
121          for (j = j1; j < i2; j++) ans[j] = j1 + iperm[j - j1];          for (j = j1; j < i2; j++) ans[j] = j1 + iperm[j - j1];
# Line 170  Line 170 
170   *   *
171   * @param ctab pointer to a sscCrosstab object   * @param ctab pointer to a sscCrosstab object
172   *   *
173   * @return a pointer to an sscMatrix giving the projection of the 2,1 component   * @return a pointer to an dsCMatrix giving the projection of the 2,1 component
174   */   */
175  SEXP sscCrosstab_project(SEXP ctab)  SEXP sscCrosstab_project(SEXP ctab)
176  {  {
# Line 185  Line 185 
185          n = length(pSlot) - 1,  /* number of columns */          n = length(pSlot) - 1,  /* number of columns */
186          nf = length(GpSlot) - 1, /* number of factors */          nf = length(GpSlot) - 1, /* number of factors */
187          nz, up;          nz, up;
188      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("sscMatrix")));      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dsCMatrix")));
189    
190      up = toupper(*CHAR(STRING_ELT(GET_SLOT(ctab, Matrix_uploSym), 0))) != 'L';      up = toupper(*CHAR(STRING_ELT(GET_SLOT(ctab, Matrix_uploSym), 0))) != 'L';
191      if (nf > 1 && up) {                 /* transpose */      if (nf > 1 && up) {                 /* transpose */
# Line 243  Line 243 
243                  }                  }
244              }              }
245          }          }
246          triplet_to_col(n, n, nnz, TTi, Tj, (double *) NULL,          dgTMatrix_to_dgCMatrix(n, n, nnz, TTi, Tj, (double *) NULL,
247                         AAp, AAi, (double *) NULL);                         AAp, AAi, (double *) NULL);
248          nz = AAp[n];          nz = AAp[n];
249          SET_SLOT(ans, Matrix_iSym, allocVector(INTSXP, nz));          SET_SLOT(ans, Matrix_iSym, allocVector(INTSXP, nz));
# Line 268  Line 268 
268   *   *
269   * @param ctab pointer to a sscCrosstab object   * @param ctab pointer to a sscCrosstab object
270   *   *
271   * @return a pointer to an sscMatrix with the projection   * @return a pointer to an dsCMatrix with the projection
272   */   */
273  SEXP sscCrosstab_project2(SEXP ctab)  SEXP sscCrosstab_project2(SEXP ctab)
274  {  {
# Line 283  Line 283 
283          nf = length(GpSlot) - 1, /* number of factors */          nf = length(GpSlot) - 1, /* number of factors */
284          nz, pos, up, *AAp, *Ti, *Cp, *ind;          nz, pos, up, *AAp, *Ti, *Cp, *ind;
285      double *Ax = REAL(GET_SLOT(ctab, Matrix_xSym));      double *Ax = REAL(GET_SLOT(ctab, Matrix_xSym));
286      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("sscMatrix")));      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dsCMatrix")));
287    
288    
289      if (nf < 2) error("sscCrosstab_project2 requires more than one group");      if (nf < 2) error("sscCrosstab_project2 requires more than one group");

Legend:
Removed from v.184  
changed lines
  Added in v.478

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