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

Go to the source code of this file.

Macros

#define MAKE_gTMatrix_to_geMatrix(_t1_, _SEXPTYPE_, _SEXP_)
 
#define MAKE_gTMatrix_to_matrix(_t1_, _SEXPTYPE_, _SEXP_)
 

Functions

static void d_insert_triplets_in_array (int m, int n, int nnz, const int xi[], const int xj[], const double xx[], double vx[])
 
static void l_insert_triplets_in_array (int m, int n, int nnz, const int xi[], const int xj[], const int xx[], int vx[])
 
SEXP xTMatrix_validate (SEXP x)
 

Macro Definition Documentation

#define MAKE_gTMatrix_to_geMatrix (   _t1_,
  _SEXPTYPE_,
  _SEXP_ 
)
Value:
SEXP _t1_ ## gTMatrix_to_ ## _t1_ ## geMatrix(SEXP x) \
{ \
SEXP dd = GET_SLOT(x, Matrix_DimSym), \
islot = GET_SLOT(x, Matrix_iSym), \
ans = PROTECT(NEW_OBJECT(MAKE_CLASS(#_t1_ "geMatrix"))); \
\
int *dims = INTEGER(dd), \
m = dims[0], \
n = dims[1]; \
double len = m * (double)n; \
\
if (len > R_XLEN_T_MAX) \
error(_("Cannot coerce to too large *geMatrix with %.0f entries"), \
len); \
\
SET_SLOT(ans, Matrix_factorSym, allocVector(VECSXP, 0)); \
SET_SLOT(ans, Matrix_DimSym, duplicate(dd)); \
SET_DimNames(ans, x); \
SET_SLOT(ans, Matrix_xSym, allocVector(_SEXPTYPE_, (R_xlen_t)len)); \
_t1_ ## _insert_triplets_in_array(m, n, length(islot), \
INTEGER(islot), \
INTEGER(GET_SLOT(x, Matrix_jSym)),\
_SEXP_(GET_SLOT(x, Matrix_xSym)), \
_SEXP_(GET_SLOT(ans, Matrix_xSym))); \
UNPROTECT(1); \
return ans; \
}
SEXP Matrix_DimSym
Definition: Syms.h:2
SEXP Matrix_xSym
Definition: Syms.h:2
SEXP Matrix_factorSym
Definition: Syms.h:2
SEXP Matrix_jSym
Definition: Syms.h:2
#define _(String)
Definition: Mutils.h:32
SEXP Matrix_iSym
Definition: Syms.h:2

Definition at line 84 of file dgTMatrix.c.

#define MAKE_gTMatrix_to_matrix (   _t1_,
  _SEXPTYPE_,
  _SEXP_ 
)
Value:
SEXP _t1_ ## gTMatrix_to_matrix(SEXP x) \
{ \
SEXP dd = GET_SLOT(x, Matrix_DimSym), \
dn = GET_SLOT(x, Matrix_DimNamesSym), \
islot = GET_SLOT(x, Matrix_iSym); \
int m = INTEGER(dd)[0], \
n = INTEGER(dd)[1]; \
SEXP ans = PROTECT(allocMatrix(_SEXPTYPE_, m, n)); \
if(VECTOR_ELT(dn, 0) != R_NilValue || VECTOR_ELT(dn, 1) != R_NilValue) \
/* matrix() with non-trivial dimnames */ \
setAttrib(ans, R_DimNamesSymbol, duplicate(dn)); \
_t1_ ## _insert_triplets_in_array(m, n, length(islot), \
INTEGER(islot), \
INTEGER(GET_SLOT(x, Matrix_jSym)),\
_SEXP_(GET_SLOT(x, Matrix_xSym)), \
_SEXP_(ans)); \
UNPROTECT(1); \
return ans; \
}
SEXP Matrix_DimSym
Definition: Syms.h:2
SEXP Matrix_xSym
Definition: Syms.h:2
SEXP Matrix_DimNamesSym
Definition: Syms.h:2
SEXP Matrix_jSym
Definition: Syms.h:2
SEXP Matrix_iSym
Definition: Syms.h:2

Function Documentation

static void d_insert_triplets_in_array ( int  m,
int  n,
int  nnz,
const int  xi[],
const int  xj[],
const double  xx[],
double  vx[] 
)
static

Definition at line 20 of file dgTMatrix.c.

References _.

static void l_insert_triplets_in_array ( int  m,
int  n,
int  nnz,
const int  xi[],
const int  xj[],
const int  xx[],
int  vx[] 
)
static

Definition at line 49 of file dgTMatrix.c.

References _.

SEXP xTMatrix_validate ( SEXP  x)

Definition at line 9 of file dgTMatrix.c.

References _, Matrix_iSym, and Matrix_xSym.

Referenced by tTMatrix_validate().

Here is the caller graph for this function: