#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <oski/config.h>
#include <oski/common.h>
#include <oski/modloader.h>
#include <oski/matrix.h>
#include <oski/CSR/format.h>
#include <oski/MBCSR/format.h>
#include <oski/MBCSR/module.h>
#include <oski/xforms_internal.h>
Defines | |
#define | IS_BOUNDED(j, j_min, j_max) ((j) >= (j_min) && (j) <= (j_max)) |
Returns a non-zero value <==> j is in [j_min, j_max]. | |
Enumerations | |
enum | mirrordir_t { NO_MIRROR = 0, LOWER_TO_UPPER = 1, LOWER_TO_UPPER_CONJ = 2, UPPER_TO_LOWER = 3, UPPER_TO_LOWER_CONJ = 4 } |
Direction option for MirrorDiagBlocks(). | |
Functions | |
static oski_index_t | ScatterBlockRow (const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_index_t n, oski_index_t indbase, oski_index_t i0, oski_index_t r, oski_index_t c, oski_index_t d0, oski_index_t *has_block_col, oski_index_t *inds, oski_value_t *blocks, oski_value_t *diag) |
Scatter. | |
static void | UnscatterBlockRow (const oski_index_t *ptr, const oski_index_t *ind, oski_index_t indbase, oski_index_t i0, oski_index_t r, oski_index_t c, oski_index_t d0, oski_index_t *has_block_col) |
Unscatter. | |
static int | AllocateBlocks (oski_index_t num_block_rows, oski_index_t num_blocks, oski_index_t r, oski_index_t c, oski_index_t **p_ind, oski_value_t **p_blocks, oski_value_t **p_diagblocks) |
Allocate space for a given number of blocks, including their indices and diagonal blocks. | |
static int | ConvertSubmatFromCSR (oski_index_t M, oski_index_t n, oski_index_t i0, oski_index_t d0, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_index_t indbase, oski_index_t r, oski_index_t c, oski_index_t **p_bptr, oski_index_t **p_bind, oski_value_t **p_bval, oski_value_t **p_bdiag) |
Given an input matrix stored in CSR format, convert a submatrix to MBCSR format. | |
static void | SetUnitDiag (oski_index_t num_blocks, oski_index_t block_size, oski_value_t *blocks) |
Given a packed array of blocks, sets the diagonal entries of each block to 1. | |
static int | ConvertFromCSR (oski_index_t m, oski_index_t n, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_index_t indbase, oski_index_t has_unit_diag_implicit, oski_index_t r, oski_index_t c, oski_index_t *p_M1, oski_index_t **p_ptr1, oski_index_t **p_ind1, oski_value_t **p_val1, oski_value_t **p_diag1, oski_index_t *p_M2, oski_index_t *p_r2, oski_index_t **p_ptr2, oski_index_t **p_ind2, oski_value_t **p_val2, oski_value_t **p_diag2, oski_index_t *p_num_rows_left) |
Convert the portions of the CSR matrix that correspond to partitions and in MBCSR format. | |
static void | SetModuleName (oski_submatMBCSR_t *B) |
Initializes the cached module name for an MBCSR submatrix. | |
static void | InitSubmatCSR (const oski_matCSR_t *A, const oski_matcommon_t *props, oski_index_t row_start, oski_index_t num_rows, oski_matCSR_t *A_sub, oski_matcommon_t *props_sub) |
Given a CSR matrix , compute a shallow copy corresponding to a subset of the rows of . | |
static int | ConvertCSRLeftoverRows (const oski_matCSR_t *A, const oski_matcommon_t *props, oski_index_t row_start, oski_index_t num_rows, oski_index_t r, oski_index_t c, oski_matBCSR_t **p_B) |
Given a CSR matrix , convert all the rows beginning at some row to BCSR format. | |
static void | MirrorDiagBlocks (mirrordir_t dir, oski_value_t *blocks, oski_index_t num_blocks, oski_index_t b) |
For each diagonal block of a matrix which is either symmetric or Hermitian, store using full-storage such that where , as appropriate. | |
static oski_index_t | CalcNnzStored_CSR (oski_index_t m, const oski_matCSR_t *A) |
static oski_index_t | CalcNnzStored_BCSR (const oski_matBCSR_t *A) |
static oski_index_t | CalcNnzStored_submatMBCSR (const oski_submatMBCSR_t *A) |
static oski_index_t | CalcNnzStored_MBCSR (const oski_matMBCSR_t *A) |
static double | CalcFillRatio (const oski_matMBCSR_t *A, const oski_matCSR_t *A_orig, 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. | |
oski_matCSR_t * | oski_ConvertMatReprToCSR (const void *mat, const oski_matcommon_t *props) |
Method: Convert to CSR format. | |
static int | CopySubmat (const oski_submatMBCSR_t *A, oski_submatMBCSR_t *B) |
static void | DestroySubmat (oski_submatMBCSR_t *const A) |
Destroys any memory allocated for the fields of a submatrix. | |
static void | DestroySubmatBCSR (oski_matBCSR_t *A) |
Free BCSR matrix representation. | |
void | oski_DestroyMatRepr (void *mat) |
Method: Destroy matrix type-specific representation. | |
void * | oski_CopyMatRepr (const void *mat, const oski_matcommon_t *props) |
Method: Duplicate a matrix representation. | |
int | oski_CreateLuaMatReprFromCSR (lua_State *L) |
Matrix-type specific method to convert from a CSR matrix, with arguments passed on the Lua stack. | |
void | oski_EnableMBCSRMatTransMatMult (oski_matMBCSR_t *A, int v) |
void | oski_EnableMBCSRMatMultAndMatMult (oski_matMBCSR_t *A, int v) |
void | oski_EnableMBCSRMatMultAndMatTransMult (oski_matMBCSR_t *A, int v) |
void | oski_EnableMBCSRMatPowMult (oski_matMBCSR_t *A, int v) |
void | oski_EnableMBCSRMatTransPowMult (oski_matMBCSR_t *A, int v) |
|
Allocate space for a given number of blocks, including their indices and diagonal blocks. All returned arrays are initialized to 0.
|
|
Convert the portions of the CSR matrix that correspond to partitions and in MBCSR format.
|
|
Given an input matrix stored in CSR format, convert a submatrix to MBCSR format. The caller must also select an arbitrary starting column of to be the starting point for the block diagonal of blocks.
|
|
Given a CSR matrix , compute a shallow copy corresponding to a subset of the rows of .
|
|
For each diagonal block of a matrix which is either symmetric or Hermitian, store using full-storage such that where , as appropriate.
|
|
Scatter. ..
|
|
Given a packed array of blocks, sets the diagonal entries of each block to 1.
|
|
Unscatter. ..
|