SCM

SCM Repository

[matrix] Diff of /pkg/Matrix/src/Mutils.h
ViewVC logotype

Diff of /pkg/Matrix/src/Mutils.h

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

revision 2586, Sun Jul 25 02:32:06 2010 UTC revision 2628, Sat Dec 11 16:56:51 2010 UTC
# Line 120  Line 120 
120      if(GET_SLOT(src, sym) != R_NilValue)                        \      if(GET_SLOT(src, sym) != R_NilValue)                        \
121          SET_SLOT(dest, sym, duplicate(GET_SLOT(src, sym)))          SET_SLOT(dest, sym, duplicate(GET_SLOT(src, sym)))
122    
123    #define slot_dup_if_has(dest, src, sym)                         \
124        if(R_has_slot(src, sym))                                    \
125            SET_SLOT(dest, sym, duplicate(GET_SLOT(src, sym)))
126    
127  /* TODO: Make this faster for the case where dimnames = list(NULL,NULL)  /* TODO: Make this faster for the case where dimnames = list(NULL,NULL)
128   *       and hence don't have to be set ! */   *       and hence don't have to be set ! */
129  #define SET_DimNames(dest, src) slot_dup(dest, src, Matrix_DimNamesSym)  #define SET_DimNames(dest, src) slot_dup(dest, src, Matrix_DimNamesSym)
# Line 129  Line 133 
133  #define diag_P(_x_) CHAR(STRING_ELT(GET_SLOT(_x_, Matrix_diagSym), 0))  #define diag_P(_x_) CHAR(STRING_ELT(GET_SLOT(_x_, Matrix_diagSym), 0))
134  #define class_P(_x_) CHAR(asChar(getAttrib(_x_, R_ClassSymbol)))  #define class_P(_x_) CHAR(asChar(getAttrib(_x_, R_ClassSymbol)))
135    
136    // Define this "Cholmod compatible" to some degree
137    enum x_slot_kind {x_pattern=-1, x_double=0, x_logical=1, x_integer=2, x_complex=3};
138    
139  /* should also work for "matrix" matrices: */  /* should also work for "matrix" matrices: */
140  #define Real_KIND(_x_)  (IS_S4_OBJECT(_x_) ? Real_kind(_x_) : \  #define Real_KIND(_x_)  (IS_S4_OBJECT(_x_) ? Real_kind(_x_) : \
141                           (isReal(_x_) ? 0 : (isLogical(_x_) ? 1 : -1)))                           (isReal(_x_) ? x_double : (isLogical(_x_) ? x_logical : -1)))
142  /* This one gives '0' also for integer "matrix" :*/  /* This one gives '0' also for integer "matrix" :*/
143  #define Real_KIND2(_x_) (IS_S4_OBJECT(_x_) ? Real_kind(_x_) : \  #define Real_KIND2(_x_) (IS_S4_OBJECT(_x_) ? Real_kind(_x_) : \
144                           (isLogical(_x_) ? 1 : 0))                           (isLogical(_x_) ? x_logical : 0))
145    
146  /* requires 'x' slot: */  /* requires 'x' slot: */
147  #define Real_kind(_x_)  (isReal(GET_SLOT(_x_, Matrix_xSym)) ? 0 :       \  #define Real_kind(_x_)  (isReal(GET_SLOT(_x_, Matrix_xSym)) ? 0 :       \

Legend:
Removed from v.2586  
changed lines
  Added in v.2628

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