Matrix  $Rev: 3071 $ at $LastChangedDate: 2015-03-26 15:35:47 +0100 (Thu, 26 Mar 2015) $
TMatrix_as.c File Reference
#include "TMatrix_as.h"
Include dependency graph for TMatrix_as.c:

Go to the source code of this file.

Macros

#define ALLOC_val_x_SLOT(__SEXP__, __S_TYPE__)   vx = __SEXP__(ALLOC_SLOT(val, Matrix_xSym,__S_TYPE__, nv))
 
#define Matrix_sT_as_GENERAL(_C_TYPE_, _SEXP_, _SEXPTYPE_)
 
#define Matrix_T_as_DENSE(_C_TYPE_, _SEXP_, _SEXPTYPE_, _SYMM_)
 
#define Matrix_T_as_DENSE_FINISH(_X_k_)
 
#define MAYBE_ALLOC_val_x_SLOT(_S1_, _S2_)   ALLOC_val_x_SLOT(_S1_, _S2_)
 
#define MAYBE_ALLOC_val_x_SLOT(_S1_, _S2_)
 
#define MAYBE_DECLARE_AND_GET_X_SLOT(__T__, __S__)   DECLARE_AND_GET_X_SLOT(__T__, __S__)
 
#define MAYBE_DECLARE_AND_GET_X_SLOT(__T__, __S__)   DECLARE_AND_GET_X_SLOT(__T__, __S__), *vx
 
#define MAYBE_DECLARE_AND_GET_X_SLOT(__T__, __S__)
 
#define MAYBE_MEMCPY_x_SLOT   MEMCPY_x_SLOT
 
#define MAYBE_MEMCPY_x_SLOT
 
#define MAYBE_SET_x_SLOT   SET_x_SLOT
 
#define MAYBE_SET_x_SLOT
 
#define MEMCPY_x_SLOT   Memcpy(&vx[nv], xx, nnz)
 
#define SET_x_SLOT   vx[nv] = xx[i]
 

Functions

SEXP dsTMatrix_as_dgTMatrix (SEXP x)
 
SEXP dsTMatrix_as_dsyMatrix (SEXP x)
 
SEXP dtTMatrix_as_dtrMatrix (SEXP x)
 
SEXP lsTMatrix_as_lgTMatrix (SEXP x)
 
SEXP lsTMatrix_as_lsyMatrix (SEXP x)
 
SEXP ltTMatrix_as_ltrMatrix (SEXP x)
 
SEXP nsTMatrix_as_ngTMatrix (SEXP x)
 
SEXP nsTMatrix_as_nsyMatrix (SEXP x)
 
SEXP ntTMatrix_as_ntrMatrix (SEXP x)
 

Macro Definition Documentation

#define ALLOC_val_x_SLOT (   __SEXP__,
  __S_TYPE__ 
)    vx = __SEXP__(ALLOC_SLOT(val, Matrix_xSym,__S_TYPE__, nv))

Definition at line 73 of file TMatrix_as.c.

#define Matrix_sT_as_GENERAL (   _C_TYPE_,
  _SEXP_,
  _SEXPTYPE_ 
)
#define Matrix_T_as_DENSE (   _C_TYPE_,
  _SEXP_,
  _SEXPTYPE_,
  _SYMM_ 
)
Value:
SEXP dimP = GET_SLOT(x, Matrix_DimSym), \
xiP = GET_SLOT(x, Matrix_iSym); \
int k, n = INTEGER(dimP)[0], nnz = length(xiP); \
int *xi = INTEGER(xiP), *xj = INTEGER(GET_SLOT(x, Matrix_jSym)), \
sz = n * n; \
_C_TYPE_ *tx = _SEXP_(ALLOC_SLOT(val, Matrix_xSym, _SEXPTYPE_, sz)); \
MAYBE_DECLARE_AND_GET_X_SLOT(_C_TYPE_, _SEXP_); \
\
SET_SLOT(val, Matrix_DimSym, duplicate(dimP)); \
if(_SYMM_) \
SET_DimNames(val, x); \
slot_dup(val, x, Matrix_uploSym)
SEXP Matrix_DimSym
Definition: Syms.h:2
SEXP Matrix_xSym
Definition: Syms.h:2
SEXP Matrix_uploSym
Definition: Syms.h:2
SEXP Matrix_jSym
Definition: Syms.h:2
SEXP Matrix_iSym
Definition: Syms.h:2
void SET_DimNames_symm(SEXP dest, SEXP src)
Set 'Dimnames' slot of 'dest' from the one of 'src' when 'src' is a "symmetricMatrix" with possibly a...
Definition: Mutils.c:1328
static R_INLINE void SET_DimNames(SEXP dest, SEXP src)
Definition: Mutils.h:161
static R_INLINE SEXP ALLOC_SLOT(SEXP obj, SEXP nm, SEXPTYPE type, int length)
Allocate an SEXP of given type and length, assign it as slot nm in the object, and return the SEXP...
Definition: Mutils.h:240

Definition at line 7 of file TMatrix_as.c.

Referenced by dsTMatrix_as_dsyMatrix(), dtTMatrix_as_dtrMatrix(), lsTMatrix_as_lsyMatrix(), ltTMatrix_as_ltrMatrix(), nsTMatrix_as_nsyMatrix(), and ntTMatrix_as_ntrMatrix().

#define Matrix_T_as_DENSE_FINISH (   _X_k_)
Value:
AZERO(tx, sz); \
for (k = 0; k < nnz; k++) \
tx[xi[k] + xj[k] * n] = _X_k_; \
UNPROTECT(1); \
return val
#define AZERO(x, n)
Definition: Mutils.h:140

Definition at line 23 of file TMatrix_as.c.

Referenced by dsTMatrix_as_dsyMatrix(), dtTMatrix_as_dtrMatrix(), lsTMatrix_as_lsyMatrix(), ltTMatrix_as_ltrMatrix(), nsTMatrix_as_nsyMatrix(), and ntTMatrix_as_ntrMatrix().

#define MAYBE_ALLOC_val_x_SLOT (   _S1_,
  _S2_ 
)    ALLOC_val_x_SLOT(_S1_, _S2_)

Definition at line 146 of file TMatrix_as.c.

#define MAYBE_ALLOC_val_x_SLOT (   _S1_,
  _S2_ 
)

Definition at line 146 of file TMatrix_as.c.

#define MAYBE_DECLARE_AND_GET_X_SLOT (   __T__,
  __S__ 
)    DECLARE_AND_GET_X_SLOT(__T__, __S__)

Definition at line 144 of file TMatrix_as.c.

#define MAYBE_DECLARE_AND_GET_X_SLOT (   __T__,
  __S__ 
)    DECLARE_AND_GET_X_SLOT(__T__, __S__), *vx

Definition at line 144 of file TMatrix_as.c.

#define MAYBE_DECLARE_AND_GET_X_SLOT (   __T__,
  __S__ 
)

Definition at line 144 of file TMatrix_as.c.

#define MAYBE_MEMCPY_x_SLOT   MEMCPY_x_SLOT

Definition at line 148 of file TMatrix_as.c.

#define MAYBE_MEMCPY_x_SLOT

Definition at line 148 of file TMatrix_as.c.

#define MAYBE_SET_x_SLOT   SET_x_SLOT

Definition at line 150 of file TMatrix_as.c.

#define MAYBE_SET_x_SLOT

Definition at line 150 of file TMatrix_as.c.

#define MEMCPY_x_SLOT   Memcpy(&vx[nv], xx, nnz)

Definition at line 79 of file TMatrix_as.c.

#define SET_x_SLOT   vx[nv] = xx[i]

Definition at line 82 of file TMatrix_as.c.

Function Documentation

SEXP dsTMatrix_as_dgTMatrix ( SEXP  x)

Definition at line 128 of file TMatrix_as.c.

References Matrix_sT_as_GENERAL.

SEXP dsTMatrix_as_dsyMatrix ( SEXP  x)

Definition at line 31 of file TMatrix_as.c.

References Matrix_T_as_DENSE, and Matrix_T_as_DENSE_FINISH.

SEXP dtTMatrix_as_dtrMatrix ( SEXP  x)

Definition at line 49 of file TMatrix_as.c.

References Matrix_diagSym, Matrix_T_as_DENSE, Matrix_T_as_DENSE_FINISH, and slot_dup.

SEXP lsTMatrix_as_lgTMatrix ( SEXP  x)

Definition at line 135 of file TMatrix_as.c.

References Matrix_sT_as_GENERAL.

SEXP lsTMatrix_as_lsyMatrix ( SEXP  x)

Definition at line 39 of file TMatrix_as.c.

References Matrix_T_as_DENSE, and Matrix_T_as_DENSE_FINISH.

SEXP ltTMatrix_as_ltrMatrix ( SEXP  x)

Definition at line 58 of file TMatrix_as.c.

References Matrix_diagSym, Matrix_T_as_DENSE, Matrix_T_as_DENSE_FINISH, and slot_dup.

SEXP nsTMatrix_as_ngTMatrix ( SEXP  x)

Definition at line 169 of file TMatrix_as.c.

References Matrix_sT_as_GENERAL.

SEXP nsTMatrix_as_nsyMatrix ( SEXP  x)

Definition at line 152 of file TMatrix_as.c.

References Matrix_T_as_DENSE, and Matrix_T_as_DENSE_FINISH.

SEXP ntTMatrix_as_ntrMatrix ( SEXP  x)

Definition at line 160 of file TMatrix_as.c.

References Matrix_diagSym, Matrix_T_as_DENSE, Matrix_T_as_DENSE_FINISH, and slot_dup.