SCM

SCM Repository

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

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

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

revision 2975, Mon Mar 24 17:46:07 2014 UTC revision 2976, Tue Mar 25 12:41:40 2014 UTC
# Line 149  Line 149 
149    
150  /* Now the template which depends on the above macros : */  /* Now the template which depends on the above macros : */
151    
152    /**
153     * colSums(), colMeans(),  rowSums() and rowMeans() for all sparce *gCMatrix()es
154     * @param NArm logical indicating if NA's should be remove 'na.rm' in R
155     * @param spRes logical = 'sparseResult' indicating if result should be sparse
156     * @param trans logical: TRUE <==> row[Sums/Means] <==> compute col*s( t(x) )
157     * @param means logical: TRUE <==> compute [row/col]Means() , not *Sums()
158     */
159  SEXP gCMatrix_colSums(SEXP x, SEXP NArm, SEXP spRes, SEXP trans, SEXP means)  SEXP gCMatrix_colSums(SEXP x, SEXP NArm, SEXP spRes, SEXP trans, SEXP means)
160  {  {
161      int mn = asLogical(means), sp = asLogical(spRes), tr = asLogical(trans);      int mn = asLogical(means), sp = asLogical(spRes), tr = asLogical(trans);
# Line 162  Line 169 
169      }      }
170    
171      /* everything else *after* the above potential transpose : */      /* everything else *after* the above potential transpose : */
     /* Don't declarations here require the C99 standard?  Can we assume C99? */  
172    
173      int j, nc = cx->ncol;      int j, nc = cx->ncol;
174      int *xp = (int *)(cx -> p);      int *xp = (int *)(cx -> p);
175  #ifdef _has_x_slot_  #ifdef _has_x_slot_
176      int na_rm = asLogical(NArm), i, dnm = 0/*Wall*/;      int na_rm = asLogical(NArm), // can have NAs only with an 'x' slot
177            i, dnm = 0/*Wall*/;
178      double *xx = (double *)(cx -> x);      double *xx = (double *)(cx -> x);
179  #endif  #endif
180        // result value:  sparseResult (==> "*sparseVector") or dense (atomic)vector
181      SEXP ans = PROTECT(sp ? NEW_OBJECT(MAKE_CLASS(SparseResult_class))      SEXP ans = PROTECT(sp ? NEW_OBJECT(MAKE_CLASS(SparseResult_class))
182                            : allocVector(SXP_ans, nc));                            : allocVector(SXP_ans, nc));
183    

Legend:
Removed from v.2975  
changed lines
  Added in v.2976

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