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 488, Wed Feb 2 19:11:51 2005 UTC revision 534, Tue Feb 8 08:59:31 2005 UTC
# Line 139  Line 139 
139          up;          up;
140      SEXP ans = PROTECT(allocVector(INTSXP, n));      SEXP ans = PROTECT(allocVector(INTSXP, n));
141    
142      up = toupper(*CHAR(STRING_ELT(GET_SLOT(ctab, Matrix_uploSym), 0))) != 'L';      up = *CHAR(STRING_ELT(GET_SLOT(ctab, Matrix_uploSym), 0)) != 'L';
143      if (nf > 1 && up) {                 /* transpose */      if (nf > 1 && up) {                 /* transpose */
144          int nz = length(iSlot);          int nz = length(iSlot);
145          int *ai = Calloc(nz, int),          int *ai = Calloc(nz, int),
# Line 187  Line 187 
187          nz, up;          nz, up;
188      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dsCMatrix")));      SEXP ans = PROTECT(NEW_OBJECT(MAKE_CLASS("dsCMatrix")));
189    
190      up = toupper(*CHAR(STRING_ELT(GET_SLOT(ctab, Matrix_uploSym), 0))) != 'L';      up = *CHAR(STRING_ELT(GET_SLOT(ctab, Matrix_uploSym), 0)) != 'L';
191      if (nf > 1 && up) {                 /* transpose */      if (nf > 1 && up) {                 /* transpose */
192          int nz = length(iSlot);          int nz = length(iSlot);
193          int *ai = Calloc(nz, int),          int *ai = Calloc(nz, int),
# Line 251  Line 251 
251          SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nz));          SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nz));
252          Ax = REAL(GET_SLOT(ans, Matrix_xSym));          Ax = REAL(GET_SLOT(ans, Matrix_xSym));
253          for (j = 0; j < nz; j++) Ax[j] = 1.;          for (j = 0; j < nz; j++) Ax[j] = 1.;
254          SET_SLOT(ans, Matrix_uploSym, ScalarString(mkChar("L")));          SET_SLOT(ans, Matrix_uploSym, mkString("L"));
255          SET_SLOT(ans, Matrix_DimSym, allocVector(INTSXP, 2));          SET_SLOT(ans, Matrix_DimSym, allocVector(INTSXP, 2));
256          AAp = INTEGER(GET_SLOT(ans, Matrix_DimSym));          AAp = INTEGER(GET_SLOT(ans, Matrix_DimSym));
257          AAp[0] = AAp[1] = n;          AAp[0] = AAp[1] = n;
# Line 287  Line 287 
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");
290      up = toupper(*CHAR(STRING_ELT(GET_SLOT(ctab, Matrix_uploSym), 0))) != 'L';      up = *CHAR(STRING_ELT(GET_SLOT(ctab, Matrix_uploSym), 0)) != 'L';
291      if (up) {                   /* tranpose */      if (up) {                   /* tranpose */
292          int n = length(pSlot) - 1;      /* number of columns */          int n = length(pSlot) - 1;      /* number of columns */
293          int nnz = length(iSlot);          int nnz = length(iSlot);
# Line 342  Line 342 
342      SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nz));      SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nz));
343      Ax = REAL(GET_SLOT(ans, Matrix_xSym));      Ax = REAL(GET_SLOT(ans, Matrix_xSym));
344      for (j = 0; j < nz; j++) Ax[j] = 1.;      for (j = 0; j < nz; j++) Ax[j] = 1.;
345      SET_SLOT(ans, Matrix_uploSym, ScalarString(mkChar("L")));      SET_SLOT(ans, Matrix_uploSym, mkString("L"));
346      SET_SLOT(ans, Matrix_DimSym, allocVector(INTSXP, 2));      SET_SLOT(ans, Matrix_DimSym, allocVector(INTSXP, 2));
347      AAp = INTEGER(GET_SLOT(ans, Matrix_DimSym));      AAp = INTEGER(GET_SLOT(ans, Matrix_DimSym));
348      AAp[0] = AAp[1] = i2 - j1;      AAp[0] = AAp[1] = i2 - j1;

Legend:
Removed from v.488  
changed lines
  Added in v.534

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