BeBOP Optimized Sparse Kernel Interface Library
1.0.1h
|
Sparse matrix-vector multiply implementation. More...
Go to the source code of this file.
Data Structures | |
struct | oski_traceargs_MatMult_t |
Trace argument signature for oski_MatMult(). More... | |
Defines | |
#define | INC_OSKI_MATMULT_H |
oski/matmul.h included. | |
#define | OSKI_MATMULT_COMPAT_DIMS(m_A, k_A, k_B, n_B, m_C, n_C) |
Returns 1 <==> multiply dimensions are compatible. | |
#define | OSKI_MATTRANSMULT_COMPAT_DIMS(m_A, k_A, k_B, n_B, m_C, n_C) |
Returns 1 <==> transpose-multiply dimensions are compatible. | |
#define | OSKI_MATMULT_COMPAT_OBJ_DIMS(A, B, C) |
Returns 1 <==> multiply dimensions are compatible. | |
#define | OSKI_MATTRANSMULT_COMPAT_OBJ_DIMS(A, B, C) |
Returns 1 <==> transpose-multiply dimensions are compatible. | |
Name mangling. | |
#define | oski_MatMult_funcpt MANGLE_(oski_MatMult_funcpt) |
#define | oski_MatReprMult_funcpt MANGLE_(oski_MatReprMult_funcpt) |
#define | oski_MatMult MANGLE_(oski_MatMult) |
#define | oski_CheckArgsMatMult MANGLE_(oski_CheckArgsMatMult) |
#define | oski_traceargs_MatMult_t MANGLE_(oski_traceargs_MatMult_t) |
#define | oski_MakeArglistMatMult MANGLE_(oski_MakeArglistMatMult) |
Typedefs | |
typedef int(* | oski_MatMult_funcpt )(const oski_matrix_t A_tunable, oski_matop_t opA, oski_value_t alpha, const oski_vecview_t x_view, oski_value_t beta, oski_vecview_t y_view) |
Function pointer type for oski_MatMult(). | |
typedef int(* | oski_MatReprMult_funcpt )(const void *A, const oski_matcommon_t *props, oski_matop_t opA, oski_value_t alpha, const oski_vecview_t x_view, oski_value_t beta, oski_vecview_t y_view) |
Function pointer type for a matrix type-specific implementation of oski_MatMult(). | |
Functions | |
int | oski_MatMult (const oski_matrix_t A_tunable, oski_matop_t opA, oski_value_t alpha, const oski_vecview_t x_view, oski_value_t beta, oski_vecview_t y_view) |
Computes ![]() ![]() | |
int | oski_CheckArgsMatMult (const oski_matrix_t A_tunable, oski_matop_t opA, oski_value_t alpha, const oski_vecview_t x_view, oski_value_t beta, const oski_vecview_t y_view, const char *caller) |
Checks validity of arguments to a routine with a matrix vector multiply signature. | |
Tracing. | |
#define | GET_XFLOP_MatMult(args) (2.0*((const oski_traceargs_MatMult_t *)(args))->num_vecs) |
Compute the "flop factor.". | |
void | oski_MakeArglistMatMult (oski_matop_t opA, oski_value_t alpha, const oski_vecview_t x_view, oski_value_t beta, const oski_vecview_t y_view, oski_traceargs_MatMult_t *args) |
Initialize a static argument signature. |
Sparse matrix-vector multiply implementation.
#define INC_OSKI_MATMULT_H |
oski/matmul.h included.
#define OSKI_MATMULT_COMPAT_DIMS | ( | m_A, | |
k_A, | |||
k_B, | |||
n_B, | |||
m_C, | |||
n_C | |||
) |
( OSKI_CHECK_MAT_DIMS(m_A, k_A) && OSKI_CHECK_MAT_DIMS(k_B, n_B) \ && OSKI_CHECK_MAT_DIMS(m_C, n_C) \ && ((m_A) == (m_C)) && ((k_A) == (k_B)) && ((n_B) == (n_C)) )
Returns 1 <==> multiply dimensions are compatible.
Given a desired matrix multiply operation, , returns 1 <==> the dimensions of all three matrices are legal and compatible.
By 'legal,' we mean according to OSKI_CHECK_MAT_DIMS, which this routine also calls.
[in] | m_A | Number of rows in A. |
[in] | k_A | Number of columns in A. |
[in] | k_B | Number of rows in B. |
[in] | n_B | Number of columns in B. |
[in] | m_C | Number of rows in C. |
[in] | n_C | Number of columns in C. |
#define OSKI_MATMULT_COMPAT_OBJ_DIMS | ( | A, | |
B, | |||
C | |||
) |
OSKI_MATMULT_COMPAT_DIMS( (A)->num_rows, (A)->num_cols, \ ((B) == INVALID_VEC) \ || ((B) == SYMBOLIC_VEC) || ((B) == SYMBOLIC_MULTIVEC) \ ? (A)->num_cols : (B)->num_rows, \ ((B) == INVALID_VEC) \ || ((B) == SYMBOLIC_VEC) || ((B) == SYMBOLIC_MULTIVEC) \ ? (C)->num_cols : (B)->num_cols, \ ((C) == INVALID_VEC) \ || ((C) == SYMBOLIC_VEC) || ((C) == SYMBOLIC_MULTIVEC) \ ? (A)->num_rows : (C)->num_rows, \ ((C) == INVALID_VEC) \ || ((C) == SYMBOLIC_VEC) || ((C) == SYMBOLIC_MULTIVEC) \ ? (B)->num_cols : (C)->num_cols \ )
Returns 1 <==> multiply dimensions are compatible.
This routine is a high-level object wrapper around an equivalent call to OSKI_CHECK_MAT_DIMS(). Specifically, this routine assumes the operands A, B, and C are pointers to structs containing 'num_rows' and 'num_cols' fields.
A must be a valid object. However, either B or C may be NULL, in which case the missing argument is assumed to have the correct dimensions. B and C must not both be NULL, however.
Referenced by oski_CheckArgsMatMult(), oski_CheckArgsMatTransMatMult(), and oski_CheckArgsMatTrisolve().
#define OSKI_MATTRANSMULT_COMPAT_DIMS | ( | m_A, | |
k_A, | |||
k_B, | |||
n_B, | |||
m_C, | |||
n_C | |||
) |
( OSKI_CHECK_MAT_DIMS(m_A, k_A) && OSKI_CHECK_MAT_DIMS(k_B, n_B) \ && OSKI_CHECK_MAT_DIMS(m_C, n_C) \ && ((k_A) == (m_C)) && ((m_A) == (k_B)) && ((n_B) == (n_C)) )
Returns 1 <==> transpose-multiply dimensions are compatible.
Given a desired matrix multiply operation, , where
, returns 1 <==> the dimensions of all three matrices are legal and compatible.
By 'legal,' we mean according to OSKI_CHECK_MAT_DIMS, which this routine also calls.
[in] | m_A | Number of rows in A. |
[in] | k_A | Number of columns in A. |
[in] | k_B | Number of rows in B. |
[in] | n_B | Number of columns in B. |
[in] | m_C | Number of rows in C. |
[in] | n_C | Number of columns in C. |
#define OSKI_MATTRANSMULT_COMPAT_OBJ_DIMS | ( | A, | |
B, | |||
C | |||
) |
OSKI_MATTRANSMULT_COMPAT_DIMS( (A)->num_rows, (A)->num_cols, \ ((B) == INVALID_VEC) \ || ((B) == SYMBOLIC_VEC) || ((B) == SYMBOLIC_MULTIVEC) \ ? (A)->num_rows : (B)->num_rows, \ ((B) == INVALID_VEC) \ || ((B) == SYMBOLIC_VEC) || ((B) == SYMBOLIC_MULTIVEC) \ ? (C)->num_cols : (B)->num_cols, \ ((C) == INVALID_VEC) \ || ((C) == SYMBOLIC_VEC) || ((C) == SYMBOLIC_MULTIVEC) \ ? (A)->num_cols : (C)->num_rows, \ ((C) == INVALID_VEC) \ || ((C) == SYMBOLIC_VEC) || ((C) == SYMBOLIC_MULTIVEC) \ ? (B)->num_cols : (C)->num_cols \ )
Returns 1 <==> transpose-multiply dimensions are compatible.
This routine is a high-level object wrapper around an equivalent call to OSKI_CHECK_MAT_DIMS(). Specifically, this routine assumes the operands A, B, and C are pointers to structs containing 'num_rows' and 'num_cols' fields.
A must be a valid object. However, either B or C may be NULL or symbolic, in which case the missing argument is assumed to have the correct dimensions. B and C must not both be NULL (though they may both be symbolic), however.
Referenced by oski_CheckArgsMatMult(), oski_CheckArgsMatTransMatMult(), and oski_CheckArgsMatTrisolve().
int oski_CheckArgsMatMult | ( | const oski_matrix_t | A_tunable, |
oski_matop_t | opA, | ||
oski_value_t | alpha, | ||
const oski_vecview_t | x_view, | ||
oski_value_t | beta, | ||
const oski_vecview_t | y_view, | ||
const char * | caller | ||
) |
Checks validity of arguments to a routine with a matrix vector multiply signature.
References ERR_BAD_ARG, ERR_BAD_MAT, ERR_BAD_VECVIEW, ERR_DIM_MISMATCH, INVALID_MAT, INVALID_VEC, MACRO_TO_STRING, OP_CONJ_TRANS, OP_NORMAL, OP_TRANS, OSKI_CHECK_MATOP, OSKI_ERR_BAD_MAT_MS, OSKI_ERR_BAD_MATOP_MS, OSKI_ERR_BAD_VEC_MS, OSKI_ERR_DIM_MISMATCH_OBJ_MS, OSKI_ERR_DIM_MISMATCH_TRANS_OBJ_MS, OSKI_MATMULT_COMPAT_OBJ_DIMS, OSKI_MATTRANSMULT_COMPAT_OBJ_DIMS, and oski_matstruct_t::props.
void oski_MakeArglistMatMult | ( | oski_matop_t | opA, |
oski_value_t | alpha, | ||
const oski_vecview_t | x_view, | ||
oski_value_t | beta, | ||
const oski_vecview_t | y_view, | ||
oski_traceargs_MatMult_t * | args | ||
) |
Initialize a static argument signature.
References oski_traceargs_MatMult_t::alpha, oski_traceargs_MatMult_t::beta, INVALID_VEC, oski_vecstruct_t::num_cols, oski_traceargs_MatMult_t::num_vecs, oski_traceargs_MatMult_t::opA, oski_vecstruct_t::orient, VAL_SET_ONE, oski_traceargs_MatMult_t::x_orient, and oski_traceargs_MatMult_t::y_orient.