Matrix r4655
Loading...
Searching...
No Matches
Macros | Functions
matmult.c File Reference
#include "Lapack-etc.h"
#include "cholmod-etc.h"
#include "Mdefines.h"
#include "idz.h"
#include "coerce.h"
#include "dense.h"
#include "sparse.h"
#include "matmult.h"

Go to the source code of this file.

Macros

#define MULTIPLY_COMPLEX(_X_, _D_)
 
#define MULTIPLY_REAL(_X_, _D_)    (_X_) = (_X_) * (_D_)
 
#define MULTIPLY_LOGICAL(_X_, _D_)    (_X_) = (_X_) && (_D_)
 
#define SCALE_CASES(_J_)
 
#define SCALE(_CTYPE_, _PTR_, _OP_, _J_)
 
#define SCALE(_CTYPE_, _PTR_, _OP_, _J_)
 
#define SCALE(_CTYPE_, _PTR_, _OP_, _J_)
 

Functions

static void matmultDim (SEXP x, SEXP y, int *xtrans, int *ytrans, int *ztrans, int *m, int *n, int *v)
 
static void matmultDN (SEXP dest, SEXP asrc, int ai, SEXP bsrc, int bi)
 
static SEXP dgeMatrix_matmult (SEXP a, SEXP b, int atrans, int btrans)
 
static SEXP dsyMatrix_matmult (SEXP a, SEXP b, int aleft, int btrans)
 
static SEXP dspMatrix_matmult (SEXP a, SEXP b, int aleft, int btrans)
 
static SEXP dtrMatrix_matmult (SEXP a, SEXP b, int aleft, int atrans, int btrans, int triangular)
 
static SEXP dtpMatrix_matmult (SEXP a, SEXP b, int aleft, int atrans, int btrans, int triangular)
 
SEXP R_dense_matmult (SEXP x, SEXP y, SEXP xtrans, SEXP ytrans)
 
static SEXP dgCMatrix_dgCMatrix_matmult (SEXP x, SEXP y, int xtrans, int ytrans, int ztrans, int triangular, int boolean)
 
static SEXP dgCMatrix_dgeMatrix_matmult (SEXP x, SEXP y, int xtrans, int ytrans, int ztrans, int triangular, int symmetric)
 
SEXP R_sparse_matmult (SEXP x, SEXP y, SEXP xtrans, SEXP ytrans, SEXP ztrans, SEXP boolean)
 
static void dense_colscale (SEXP obj, SEXP d, int m, int n, char uplo, char diag)
 
static void dense_rowscale (SEXP obj, SEXP d, int m, int n, char uplo, char diag)
 
static void Csparse_colscale (SEXP obj, SEXP d)
 
static void Csparse_rowscale (SEXP obj, SEXP d, SEXP iSym)
 
static void Tsparse_rowscale (SEXP obj, SEXP d, SEXP iSym)
 
SEXP R_diagonal_matmult (SEXP x, SEXP y, SEXP xtrans, SEXP ytrans, SEXP boolean)
 

Macro Definition Documentation

◆ MULTIPLY_COMPLEX

#define MULTIPLY_COMPLEX (   _X_,
  _D_ 
)
Value:
do { \
tmp = (_X_); \
(_X_).r = tmp.r * (_D_).r - tmp.i * (_D_).i; \
(_X_).i = tmp.r * (_D_).i + tmp.i * (_D_).r; \
} while (0)

Definition at line 1116 of file matmult.c.

◆ MULTIPLY_LOGICAL

#define MULTIPLY_LOGICAL (   _X_,
  _D_ 
)     (_X_) = (_X_) && (_D_)

Definition at line 1124 of file matmult.c.

◆ MULTIPLY_REAL

#define MULTIPLY_REAL (   _X_,
  _D_ 
)     (_X_) = (_X_) * (_D_)

Definition at line 1122 of file matmult.c.

◆ SCALE [1/3]

#define SCALE (   _CTYPE_,
  _PTR_,
  _OP_,
  _J_ 
)

◆ SCALE [2/3]

#define SCALE (   _CTYPE_,
  _PTR_,
  _OP_,
  _J_ 
)
Value:
do { \
_CTYPE_ *px = _PTR_(x), *pd = _PTR_(d); \
for (j = 0; j < n; ++j) { \
kend = pp[j]; \
while (k < kend) { \
_OP_(*px, *pd); \
++px; \
++k; \
} \
++pd; \
} \
} while (0)

◆ SCALE [3/3]

#define SCALE (   _CTYPE_,
  _PTR_,
  _OP_,
  _J_ 
)
Value:
do { \
_CTYPE_ *px = _PTR_(x), *pd = _PTR_(d); \
for (k = 0; k < nnz; ++k) { \
_OP_(*px, pd[*pi]); \
++px; \
++pi; \
} \
} while (0)

◆ SCALE_CASES

#define SCALE_CASES (   _J_)
Value:
do { \
switch (TYPEOF(d)) { \
case CPLXSXP: \
{ \
Rcomplex tmp; \
SCALE(Rcomplex, COMPLEX, MULTIPLY_COMPLEX, _J_); \
break; \
} \
case REALSXP: \
SCALE(double, REAL, MULTIPLY_REAL, _J_); \
break; \
default: \
SCALE(int, LOGICAL, MULTIPLY_LOGICAL, _J_); \
break; \
} \
} while (0)
#define MULTIPLY_COMPLEX(_X_, _D_)
Definition matmult.c:1116
#define MULTIPLY_REAL(_X_, _D_)
Definition matmult.c:1122
#define MULTIPLY_LOGICAL(_X_, _D_)
Definition matmult.c:1124

Definition at line 1127 of file matmult.c.

Function Documentation

◆ Csparse_colscale()

static void Csparse_colscale ( SEXP  obj,
SEXP  d 
)
static

Definition at line 1215 of file matmult.c.

References GET_SLOT, Matrix_pSym, Matrix_xSym, and SCALE_CASES.

Referenced by R_diagonal_matmult().

◆ Csparse_rowscale()

static void Csparse_rowscale ( SEXP  obj,
SEXP  d,
SEXP  iSym 
)
static

Definition at line 1246 of file matmult.c.

References GET_SLOT, Matrix_pSym, Matrix_xSym, and SCALE_CASES.

Referenced by R_diagonal_matmult().

◆ dense_colscale()

static void dense_colscale ( SEXP  obj,
SEXP  d,
int  m,
int  n,
char  uplo,
char  diag 
)
static

Definition at line 1146 of file matmult.c.

References GET_SLOT, Matrix_xSym, and SCALE_CASES.

Referenced by R_diagonal_matmult().

◆ dense_rowscale()

static void dense_rowscale ( SEXP  obj,
SEXP  d,
int  m,
int  n,
char  uplo,
char  diag 
)
static

Definition at line 1201 of file matmult.c.

References GET_SLOT, Matrix_xSym, and SCALE_CASES.

Referenced by R_diagonal_matmult().

◆ dgCMatrix_dgCMatrix_matmult()

static SEXP dgCMatrix_dgCMatrix_matmult ( SEXP  x,
SEXP  y,
int  xtrans,
int  ytrans,
int  ztrans,
int  triangular,
int  boolean 
)
static

◆ dgCMatrix_dgeMatrix_matmult()

static SEXP dgCMatrix_dgeMatrix_matmult ( SEXP  x,
SEXP  y,
int  xtrans,
int  ytrans,
int  ztrans,
int  triangular,
int  symmetric 
)
static

◆ dgeMatrix_matmult()

static SEXP dgeMatrix_matmult ( SEXP  a,
SEXP  b,
int  atrans,
int  btrans 
)
static

◆ dspMatrix_matmult()

static SEXP dspMatrix_matmult ( SEXP  a,
SEXP  b,
int  aleft,
int  btrans 
)
static

◆ dsyMatrix_matmult()

static SEXP dsyMatrix_matmult ( SEXP  a,
SEXP  b,
int  aleft,
int  btrans 
)
static

◆ dtpMatrix_matmult()

static SEXP dtpMatrix_matmult ( SEXP  a,
SEXP  b,
int  aleft,
int  atrans,
int  btrans,
int  triangular 
)
static

◆ dtrMatrix_matmult()

static SEXP dtrMatrix_matmult ( SEXP  a,
SEXP  b,
int  aleft,
int  atrans,
int  btrans,
int  triangular 
)
static

◆ matmultDim()

static void matmultDim ( SEXP  x,
SEXP  y,
int *  xtrans,
int *  ytrans,
int *  ztrans,
int *  m,
int *  n,
int *  v 
)
static

Definition at line 11 of file matmult.c.

References _, GET_SLOT, and Matrix_DimSym.

Referenced by R_dense_matmult(), R_diagonal_matmult(), and R_sparse_matmult().

◆ matmultDN()

static void matmultDN ( SEXP  dest,
SEXP  asrc,
int  ai,
SEXP  bsrc,
int  bi 
)
static

◆ R_dense_matmult()

SEXP R_dense_matmult ( SEXP  x,
SEXP  y,
SEXP  xtrans,
SEXP  ytrans 
)

◆ R_diagonal_matmult()

SEXP R_diagonal_matmult ( SEXP  x,
SEXP  y,
SEXP  xtrans,
SEXP  ytrans,
SEXP  boolean 
)

◆ R_sparse_matmult()

SEXP R_sparse_matmult ( SEXP  x,
SEXP  y,
SEXP  xtrans,
SEXP  ytrans,
SEXP  ztrans,
SEXP  boolean 
)

◆ Tsparse_rowscale()

static void Tsparse_rowscale ( SEXP  obj,
SEXP  d,
SEXP  iSym 
)
static

Definition at line 1271 of file matmult.c.

References GET_SLOT, Matrix_xSym, and SCALE_CASES.

Referenced by R_diagonal_matmult().