SCM

SCM Repository

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

Diff of /pkg/src/bCrosstab.c

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

revision 488, Wed Feb 2 19:11:51 2005 UTC revision 493, Thu Feb 3 18:47:20 2005 UTC
# Line 77  Line 77 
77  }  }
78    
79  /**  /**
  * Create a named vector of type TYP  
  *  
  * @param TYP a vector SEXP type (e.g. REALSXP)  
  * @param names names of list elements with null string appended  
  *  
  * @return pointer to a named vector of type TYP  
  */  
 static SEXP  
 make_named(int TYP, char **names)  
 {  
     SEXP ans, nms;  
     int i, n;  
   
     for (n = 0; strlen(names[n]) > 0; n++) {}  
     ans = PROTECT(allocVector(TYP, n));  
     nms = PROTECT(allocVector(STRSXP, n));  
     for (i = 0; i < n; i++) SET_STRING_ELT(nms, i, mkChar(names[i]));  
     setAttrib(ans, R_NamesSymbol, nms);  
     UNPROTECT(2);  
     return ans;  
 }  
   
 /**  
80   * Check for the existence of the (row, col) pair in a csc structure.   * Check for the existence of the (row, col) pair in a csc structure.
81   *   *
82   * @param p vector of column pointers   * @param p vector of column pointers
# Line 474  Line 451 
451          *pnms[] = {"index", "block", ""};          *pnms[] = {"index", "block", ""};
452    
453      /* Allocate fixed-sized slots */      /* Allocate fixed-sized slots */
454      SET_SLOT(val, Matrix_statusSym, make_named(LGLSXP, statnms ));      SET_SLOT(val, Matrix_statusSym, Matrix_make_named(LGLSXP, statnms ));
455      SET_SLOT(val, Matrix_devianceSym, make_named(REALSXP, devnms));      SET_SLOT(val, Matrix_devianceSym, Matrix_make_named(REALSXP, devnms));
456      SET_SLOT(val, Matrix_devCompSym, allocVector(REALSXP, 4));      SET_SLOT(val, Matrix_devCompSym, allocVector(REALSXP, 4));
457      /* Allocate slots that are lists of length nf */      /* Allocate slots that are lists of length nf */
458      SET_SLOT(val, Matrix_ZZpOSym, allocVector(VECSXP, nf));      SET_SLOT(val, Matrix_ZZpOSym, allocVector(VECSXP, nf));
# Line 527  Line 504 
504              ncj = length(cpp) - 1,              ncj = length(cpp) - 1,
505              nnz = length(cip);              nnz = length(cip);
506    
507          SET_VECTOR_ELT(Parent, j, make_named(VECSXP, pnms));          SET_VECTOR_ELT(Parent, j, Matrix_make_named(VECSXP, pnms));
508          parent = VECTOR_ELT(Parent, j);          parent = VECTOR_ELT(Parent, j);
509          SET_VECTOR_ELT(parent, 0, allocVector(INTSXP, ncj));          SET_VECTOR_ELT(parent, 0, allocVector(INTSXP, ncj));
510          SET_VECTOR_ELT(parent, 1, allocVector(INTSXP, ncj));          SET_VECTOR_ELT(parent, 1, allocVector(INTSXP, ncj));

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

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