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 3127, Mon Jun 1 10:17:01 2015 UTC revision 3128, Tue Jun 2 08:08:16 2015 UTC
# Line 151  Line 151 
151    
152  /**  /**
153   * colSums(), colMeans(),  rowSums() and rowMeans() for all sparce *gCMatrix()es   * colSums(), colMeans(),  rowSums() and rowMeans() for all sparce *gCMatrix()es
154     * @param x a ?gCMatrix, i.e. sparse column-compressed Matrix
155   * @param NArm logical indicating if NA's should be remove 'na.rm' in R   * @param NArm logical indicating if NA's should be remove 'na.rm' in R
156   * @param spRes logical = 'sparseResult' indicating if result should be sparse   * @param spRes logical = 'sparseResult' indicating if result should be sparse
157   * @param trans logical: TRUE <==> row[Sums/Means] <==> compute col*s( t(x) )   * @param trans logical: TRUE <==> row[Sums/Means] <==> compute col*s( t(x) )
# Line 180  Line 181 
181      // result value:  sparseResult (==> "*sparseVector") or dense (atomic)vector      // result value:  sparseResult (==> "*sparseVector") or dense (atomic)vector
182      SEXP ans = PROTECT(sp ? NEW_OBJECT(MAKE_CLASS(SparseResult_class))      SEXP ans = PROTECT(sp ? NEW_OBJECT(MAKE_CLASS(SparseResult_class))
183                            : allocVector(SXP_ans, nc));                            : allocVector(SXP_ans, nc));
   
184      if (sp) { // sparseResult, i.e. *sparseVector (never allocating length-nc)      if (sp) { // sparseResult, i.e. *sparseVector (never allocating length-nc)
185          int nza, i1, i2, p, *ai;          int nza, i1, i2, p, *ai;
186          Type_ans *ax;          Type_ans *ax;
# Line 215  Line 215 
215      }      }
216    
217      if (tr) cholmod_free_sparse(&cx, &c);      if (tr) cholmod_free_sparse(&cx, &c);
218        if (!sp) {
219            SEXP nms = VECTOR_ELT(GET_SLOT(x, Matrix_DimNamesSym), tr ? 0 : 1);
220            if (!isNull(nms))
221                setAttrib(ans, R_NamesSymbol, duplicate(nms));
222        }
223      UNPROTECT(1);      UNPROTECT(1);
224      return ans;      return ans;
225  }  }

Legend:
Removed from v.3127  
changed lines
  Added in v.3128

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