BeBOP Optimized Sparse Kernel Interface Library  1.0.1h
Files | Typedefs | Functions
Matrix Type Interface
Matrix Types

This interface defines the list of possible routines the library expects a matrix type may implement. More...

Files

file  matmodexport.h
 

Declares prototypes for the 'standard' set of dynamically exportable methods stored in matrix type modules.


Typedefs

typedef int(* oski_GetMatReprEntry_funcpt )(const void *mat, const oski_matcommon_t *props, oski_index_t row, oski_index_t col, oski_value_t *p_value)
 Matrix type-specific implementation of oski_GetMatEntry().
typedef int(* oski_SetMatReprEntry_funcpt )(void *mat, const oski_matcommon_t *props, oski_index_t row, oski_index_t col, oski_value_t new_val)
 Matrix type-specific implementation of oski_SetMatEntry().
typedef int(* oski_GetMatReprClique_funcpt )(const void *mat, const oski_matcommon_t *props, const oski_index_t *rows, oski_index_t num_rows, const oski_index_t *cols, oski_index_t num_cols, oski_vecview_t vals)
 Matrix type-specific implementation of oski_GetMatClique().
typedef int(* oski_SetMatReprClique_funcpt )(void *mat, const oski_matcommon_t *props, const oski_index_t *rows, oski_index_t num_rows, const oski_index_t *cols, oski_index_t num_cols, const oski_vecview_t vals)
 Matrix type-specific implementation of oski_SetMatClique().
typedef int(* oski_GetMatReprDiagValues_funcpt )(const void *mat, const oski_matcommon_t *props, oski_index_t diag_num, oski_vecview_t vals)
 Matrix type-specific implementation of oski_GetMatDiagValues().
typedef int(* oski_SetMatReprDiagValues_funcpt )(void *mat, const oski_matcommon_t *props, oski_index_t diag_num, const oski_vecview_t vals)
 Matrix type-specific implementation of oski_SetMatDiagValues().

Functions

void oski_DestroyMatRepr (void *mat)
 Method: Destroy matrix type-specific representation.
void * oski_CreateMatReprFromCSR (const oski_matCSR_t *mat, const oski_matcommon_t *props,...)
 Method: Instantiate from an existing CSR representation.
oski_matCSR_toski_ConvertMatReprToCSR (const void *mat, const oski_matcommon_t *props)
 Method: Convert to CSR format.
void * oski_CopyMatRepr (const void *mat, const oski_matcommon_t *props)
 Method: Duplicate a matrix representation.
int oski_MatReprMult (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)
 Matrix type-specific implementation of sparse matrix-vector multiply.
int oski_MatReprTrisolve (const void *T, const oski_matcommon_t *props, oski_matop_t opT, oski_value_t alpha, oski_vecview_t x_view)
 Matrix type specific implementation of oski_MatTrisolve().
int oski_MatReprTransMatReprMult (const void *A, const oski_matcommon_t *props, oski_ataop_t op, oski_value_t alpha, const oski_vecview_t x_view, oski_value_t beta, oski_vecview_t y_view, oski_vecview_t t_view)
 Matrix type specific implementation of oski_MatTransMatMult().
int oski_MatReprMultAndMatReprTransMult (const void *A, const oski_matcommon_t *props, oski_value_t alpha, const oski_vecview_t x_view, oski_value_t beta, oski_vecview_t y_view, oski_matop_t opA, oski_value_t omega, const oski_vecview_t w_view, oski_value_t zeta, oski_vecview_t z_view)
 Matrix type specific implementation of oski_MatMultAndMatTransMult().
int oski_MatReprPowMult (const void *A, const oski_matcommon_t *props, oski_matop_t opA, int power, oski_value_t alpha, const oski_vecview_t x_view, oski_value_t beta, oski_vecview_t y_view, oski_vecview_t T_view)
 Matrix type specific implementation of oski_MatPowMult().

Default base names for shared methods.

typedef void(* oski_simple_funcpt )(void)
 Pointer to a function that takes no arguments and returns nothing.

Detailed Description

This interface defines the list of possible routines the library expects a matrix type may implement.


Function Documentation

oski_matCSR_t* oski_ConvertMatReprToCSR ( const void *  mat,
const oski_matcommon_t props 
)
void* oski_CopyMatRepr ( const void *  mat,
const oski_matcommon_t props 
)
void* oski_CreateMatReprFromCSR ( const oski_matCSR_t mat,
const oski_matcommon_t props,
  ... 
)

Method: Instantiate from an existing CSR representation.

Parameters:
[in]matCSR representation.
[in]propsAdditional global properties of the matrix, mat.
Returns:
A pointer to a matrix type-specific representation in the current module's format.

The variable argument list specifies a matrix type-dependent sequence of arguments, allowing the final data structure to be customized accordingly.

Precondition:
props != NULL
See also:
oski_CreateMatCSR, oski_CreateMatCSC, #oski_ConvertMatReprFromCSR_funcpt

Method: Instantiate from an existing CSR representation.

    oski_CreateMatReprFromCSR( mat, props, r, c );

where $R\times C$ is the desired cache block size.

Method: Instantiate from an existing CSR representation.

  1. $r$: The desired row block size.
  2. $c$: The desired column block size.
Returns:
A pointer to a new oski_matMBCSR_t object containing the input matrix in MBCSR format. If an error occurs, returns NULL.
Precondition:
The variable part of the argument list has been specified correctly, and $1 \leq r, c \leq 12$.

Method: Instantiate from an existing CSR representation.

  1. $\rho_r$: Block-row partitioning threshold.
  2. $\rho_c$: Block-column partitioning threshold.
Returns:
A pointer to a new oski_matVBR_t object containing the input matrix in VBR format, or NULL on error.
Todo:
This fill ratio is wrong for symmetric matrices.

References tagBebop_matMBCSR_t::A1, tagBebop_matMBCSR_t::A2, oski_matCSR_t::base_index, tagOski_submatMBCSR_t::bdiag, tagOski_submatMBCSR_t::bind, tagBebop_matBCSR_t::bptr, tagOski_submatMBCSR_t::bptr, tagOski_submatMBCSR_t::bval, tagOski_submatMBCSR_t::c, oski_matCB_t::cache_blocks, oski_matGCSR_t::cind, tagBebop_matBCSR_t::col_block_size, ConvertCSRLeftoverRows(), ConvertFromCSR(), ConvertToCSR(), ConvertToCSR_Sorted(), COPY_INPUTMAT, CopyPointers(), ERR_OUT_OF_MEMORY, oski_matCSR_t::has_sorted_indices, tagBebop_matBCSR_t::has_unit_diag_implicit, oski_matCSR_t::has_unit_diag_implicit, oski_matCSR_t::ind, oski_matcommon_t::is_herm, oski_matCSR_t::is_lower, oski_matcommon_t::is_symm, oski_matCSR_t::is_upper, oski_matDENSE_t::lead_dim, tagBebop_matBCSR_t::leftover, oski_matCSC_t::mat_trans, MirrorDiagBlocks(), tagBebop_matBCSR_t::mod_cached, tagBebop_matBCSR_t::mod_name, tagBebop_matBCSR_t::num_block_cols, tagBebop_matBCSR_t::num_block_rows, tagOski_submatMBCSR_t::num_block_rows, oski_matcommon_t::num_cols, oski_matcommon_t::num_nonzeros, oski_matcommon_t::num_rows, tagBebop_matBCSR_t::num_rows_leftover, oski_matGCSR_t::num_stored_rows, tagOski_submatMBCSR_t::offset, oski_CopyMem, oski_CreateMatReprFromCSR, oski_DestroyMatRepr, OSKI_ERR, OSKI_ERR_MATTYPE_MEMBER, OSKI_ERR_NOT_IMPLEMENTED, oski_Free, OSKI_IND_ID, oski_MakeModuleName(), oski_Malloc, OSKI_MATTYPE_METHOD, oski_matVBR_t, oski_PrintDebugMessage(), OSKI_VAL_ID, tagBebop_matMBCSR_t::p_A3, oski_matcommon_t::pattern, oski_matGCSR_t::ptr, oski_matCSR_t::ptr, tagOski_submatMBCSR_t::r, oski_matGCSR_t::rind, tagBebop_matBCSR_t::row_block_size, SetModuleName(), simplelist_Create(), simplelist_Destroy(), simplelist_GetLength(), oski_matCSR_t::stored, tagBebop_matMBCSR_t::stored, oski_matDENSE_t::val, oski_matGCSR_t::val, and oski_matCSR_t::val.

void oski_DestroyMatRepr ( void *  mat)
int oski_MatReprMult ( const void *  pA,
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 
)

Matrix type-specific implementation of sparse matrix-vector multiply.

See also:
oski_MatMult, oski_MatReprMult_funcpt
Precondition:
All arguments have legal values and meet basic dimensionality compatibility requirements.

This implementation does not need 'props', i.e., props == NULL is OK.

Precondition:
All arguments have legal values and meet basic dimensionality compatibility requirements.

This implementation does not need props, i.e., props == NULL is OK.

Precondition:
All arguments have legal values and meet basic dimensionality compatibility requirements.
All arguments have legal values and meet basic dimensionality compatibility requirements.
Note:
'props' is not required unless the matrix is stored using symmetric/Hermitian half-storage. Otherwise, the caller may set props to NULL.
Todo:
Delete the following assignment statements, made obsolete by above call to oski_TransposeProps().
Todo:
Could theoretically encounter OP_CONJ
Todo:
Call xGEMM in multiple vector case

References tagBebop_matMBCSR_t::A1, tagBebop_matMBCSR_t::A2, oski_matCB_t::cache_blocks, oski_submatCB_t::col, oski_vecstruct_t::colinc, ERR_BAD_ARG, ERR_NOT_IMPLEMENTED, GCSR_MatReprMult_1x1(), tagBebop_matBCSR_t::has_unit_diag_implicit, oski_matcommon_t::is_herm, oski_matCSR_t::is_lower, oski_matcommon_t::is_symm, oski_matCSR_t::is_upper, IS_VAL_ZERO, oski_matDENSE_t::lead_dim, oski_submatCB_t::mat, oski_matCSC_t::mat_trans, MatConjMult(), MatHermMult(), MatMult(), MatReprMult, MatReprMult_Normal(), MatReprMult_Trans(), MatReprMultCore(), MatTransMult(), tagOski_submatMBCSR_t::num_block_rows, oski_matcommon_t::num_cols, oski_vecstruct_t::num_cols, oski_submatCB_t::num_cols, oski_matcommon_t::num_rows, oski_vecstruct_t::num_rows, oski_submatCB_t::num_rows, OP_CONJ, OP_CONJ_TRANS, OP_NORMAL, OP_TRANS, oski_CopyMem, OSKI_ERR_BAD_MATOP, OSKI_ERR_MATTYPE_MEMBER, OSKI_ERR_NOT_IMPLEMENTED, oski_MatReprMult, OSKI_MATTYPE_METHOD, oski_matVBR_t, tagBebop_matMBCSR_t::p_A3, oski_matcommon_t::pattern, tagOski_submatMBCSR_t::r, oski_submatCB_t::row, oski_vecstruct_t::rowinc, simplelist_BeginIter(), simplelist_NextIter(), oski_matCSR_t::stored, tagBebop_matMBCSR_t::stored, SymmMatMult(), oski_matDENSE_t::val, and oski_vecstruct_t::val.

int oski_MatReprMultAndMatReprTransMult ( const void *  pA,
const oski_matcommon_t props,
oski_value_t  alpha,
const oski_vecview_t  x_view,
oski_value_t  beta,
oski_vecview_t  y_view,
oski_matop_t  opA,
oski_value_t  omega,
const oski_vecview_t  w_view,
oski_value_t  zeta,
oski_vecview_t  z_view 
)

Matrix type specific implementation of oski_MatMultAndMatTransMult().

See also:
oski_MatMultAndMatTransMult
oski_MatReprMultAndMatReprTransMult_funcpt
Note:
'props' is not required unless the matrix is stored using symmetric/Hermitian half-storage. That is, the caller may set props to NULL.
Todo:
What to do here if either of these calls fails?

References tagBebop_matMBCSR_t::A1, tagBebop_matMBCSR_t::A2, CanBeExecuted(), ERR_NOT_IMPLEMENTED, tagBebop_matBCSR_t::num_block_rows, tagOski_submatMBCSR_t::num_block_rows, oski_vecstruct_t::num_rows, tagBebop_matBCSR_t::num_rows_leftover, OP_CONJ, OP_NORMAL, tagBebop_matMBCSR_t::p_A3, tagOski_submatMBCSR_t::r, and tagBebop_matBCSR_t::row_block_size.

int oski_MatReprPowMult ( const void *  A,
const oski_matcommon_t props,
oski_matop_t  opA,
int  power,
oski_value_t  alpha,
const oski_vecview_t  x_view,
oski_value_t  beta,
oski_vecview_t  y_view,
oski_vecview_t  T_view 
)

Matrix type specific implementation of oski_MatPowMult().

See also:
oski_MatPowMult, oski_MatReprPowMult_funcpt
int oski_MatReprTransMatReprMult ( const void *  pA,
const oski_matcommon_t props,
oski_ataop_t  opA,
oski_value_t  alpha,
const oski_vecview_t  x_view,
oski_value_t  beta,
oski_vecview_t  y_view,
oski_vecview_t  t_view 
)

Matrix type specific implementation of oski_MatTransMatMult().

See also:
oski_MatTransMatMult, oski_MatReprTransMatReprMult_funcpt
Precondition:
All arguments have legal values and meet basic dimensionality compatibility requirements.

NOTE: The BCSR implementation does not contain cache-optimized implementations of $AA^Tx$ or $AA^Hx$ kernels, and returns ERR_NOT_IMPLEMENTED in these cases, and the caller should invoke the fall-back routine, MatTransMatMultDefault(), if necessary.

Note:
'props' is not required unless the matrix is stored using symmetric/Hermitian half-storage. That is, the caller may set props to NULL.

References tagBebop_matMBCSR_t::A1, tagBebop_matMBCSR_t::A2, CanBeExecuted(), ERR_NOT_IMPLEMENTED, INVALID_VEC, IS_VAL_ZERO, tagBebop_matBCSR_t::leftover, MAKE_VAL_COMPLEX, tagBebop_matBCSR_t::num_block_rows, tagOski_submatMBCSR_t::num_block_rows, oski_vecstruct_t::num_rows, tagBebop_matBCSR_t::num_rows_leftover, OP_AH_A, OP_AT_A, oski_CopyMem, tagBebop_matMBCSR_t::p_A3, tagOski_submatMBCSR_t::r, tagBebop_matBCSR_t::row_block_size, oski_vecstruct_t::rowinc, and oski_vecstruct_t::val.

int oski_MatReprTrisolve ( const void *  pT,
const oski_matcommon_t props,
oski_matop_t  opT,
oski_value_t  alpha,
const oski_vecview_t  x_view 
)

Matrix type specific implementation of oski_MatTrisolve().

See also:
oski_MatTrisolve, oski_MatReprTrisolve_funcpt
Precondition:
All arguments have legal values and meet basic dimensionality compatibility requirements.
Note:
'props' is not required unless the matrix is stored using symmetric/Hermitian half-storage. That is, the caller may set props to NULL.
Todo:
Could theoretically encounter OP_CONJ
Todo:
Call xTRSM in multiple vector case

References tagBebop_matMBCSR_t::A1, tagBebop_matMBCSR_t::A2, CanBeExecuted(), oski_vecstruct_t::colinc, ERR_BAD_MAT, ERR_NOT_IMPLEMENTED, oski_matcommon_t::is_tri_lower, oski_matcommon_t::is_tri_upper, IS_VAL_ONE, IS_VAL_ZERO, oski_matDENSE_t::lead_dim, oski_matCSC_t::mat_trans, oski_matcommon_t::num_cols, oski_vecstruct_t::num_cols, oski_matcommon_t::num_rows, OP_CONJ, OP_CONJ_TRANS, OP_NORMAL, OP_TRANS, oski_CopyMem, OSKI_ERR_MATTYPE_MEMBER, OSKI_ERR_NOT_IMPLEMENTED, oski_MatReprTrisolve, OSKI_MATTYPE_METHOD, oski_matcommon_t::pattern, oski_vecstruct_t::rowinc, tagBebop_matMBCSR_t::stored, oski_matDENSE_t::val, and oski_vecstruct_t::val.