SCM

SCM Repository

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

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

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

revision 3075, Mon Mar 30 10:21:58 2015 UTC revision 3076, Mon Mar 30 10:23:42 2015 UTC
# Line 583  Line 583 
583  }  }
584    
585    
586  /** Duplicate a [dln]denseMatrix _or_ a numeric matrix or even vector as  /** Generalized -- "geMatrix" -- dispatch where needed :
587      * Duplicate a [dln]denseMatrix _or_ a numeric matrix or even vector as
588   *  a [dln]geMatrix.   *  a [dln]geMatrix.
589   *  This is for the many "*_matrix_{prod,crossprod,tcrossprod, etc.}"   *  This is for the many "*_matrix_{prod,crossprod,tcrossprod, etc.}"
590   *  functions that work with both classed and unclassed matrices.   *  functions that work with both classed and unclassed matrices.
591   *   *
592   * @param A       either a denseMatrix object or a matrix object   * @param A either a denseMatrix, a diagonalMatrix or a traditional matrix object
593   */   *
 /* NOTA BENE: If you enlarge this list, do change '14' and '6' below !  
  * ---------  ddiMatrix & ldiMatrix  are no longer ddense or ldense on the R level,  
  *            ---         ---        but are still dealt with here.  
594   */   */
   
 /* Generalized -- "geMatrix" -- dispatch where needed : */  
595  SEXP dup_mMatrix_as_geMatrix(SEXP A)  SEXP dup_mMatrix_as_geMatrix(SEXP A)
596  {  {
597      SEXP ans, ad = R_NilValue, an = R_NilValue; /* -Wall */   /* NOTA BENE: If you enlarge this list, do change '14' and '6' below !
598      * ---------  ddiMatrix & ldiMatrix  are no longer ddense or ldense on the R level,
599      *            ---         ---        but are still dealt with here: */
600      static const char *valid[] = {      static const char *valid[] = {
601          "_NOT_A_CLASS_",/* *_CLASSES defined in ./Mutils.h */          "_NOT_A_CLASS_",// *_CLASSES defined in ./Mutils.h  :
602          MATRIX_VALID_ddense, /* 14 */          MATRIX_VALID_ddense, /* 14 */
603          MATRIX_VALID_ldense, /* 6  */          MATRIX_VALID_ldense, /* 6  */
604          MATRIX_VALID_ndense, /* 5  */          MATRIX_VALID_ndense, /* 5  */
605          ""};          ""};
606        SEXP ans, ad = R_NilValue, an = R_NilValue; /* -Wall */
607      int sz, ctype = Matrix_check_class_etc(A, valid),      int sz, ctype = Matrix_check_class_etc(A, valid),
608          nprot = 1;          nprot = 1;
609      enum dense_enum { ddense, ldense, ndense } M_type = ddense /* -Wall */;      enum dense_enum { ddense, ldense, ndense } M_type = ddense /* -Wall */;
610    
611      if (ctype > 0) { /* a [nld]denseMatrix object */      if (ctype > 0) { /* a [nld]denseMatrix or [dl]diMatrix object */
612          ad = GET_SLOT(A, Matrix_DimSym);          ad = GET_SLOT(A, Matrix_DimSym);
613          an = GET_SLOT(A, Matrix_DimNamesSym);          an = GET_SLOT(A, Matrix_DimNamesSym);
614          M_type = (ctype <= 14) ? ddense :          M_type = (ctype <= 14) ? ddense :

Legend:
Removed from v.3075  
changed lines
  Added in v.3076

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge