#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/VBR/format.h>
#include <oski/VBR/module.h>
#include <oski/xforms_internal.h>
Defines | |
#define | MAX(a, b) ((a) > (b) ? (a) : (b)) |
Return max of two side-effect free values. | |
Typedefs | |
typedef unsigned char | flag_t |
Flag type (takes the values 0 or 1). | |
Functions | |
static int | ExpandSymm (const oski_matCSR_t *mat, const oski_matcommon_t *props, oski_matCSR_t **p_mat_full) |
static int | TransposeSymm (const oski_matCSR_t *mat, const oski_matcommon_t *props, oski_matCSR_t **p_mat_trans) |
static void | DestroyCSR (oski_matCSR_t *mat) |
static void | SetFlags (oski_index_t n_x, const oski_index_t *restrict x, flag_t value, oski_index_t n, flag_t *restrict f) |
Scatters a specified value to all elements of a dense flag vector corresponding to the structurally non-zero elements of a sparse vector . | |
static oski_index_t | CountUnique (oski_index_t n_x, const oski_index_t *restrict x, oski_index_t n, flag_t *restrict workspace) |
Counts the number of unique structurally non-zero elements in a sparse vector . | |
static oski_index_t | CountNumCommonSpVec (oski_index_t i1, oski_index_t n1, const oski_index_t *restrict ind1, oski_index_t i2, oski_index_t n2, const oski_index_t *restrict ind2, oski_index_t b, int has_unit_diag, oski_index_t n, flag_t *restrict workspace) |
Returns the number of unique elements that two sparse vectors, and , have in common. | |
static oski_index_t | FindBlockPart (oski_index_t m, const oski_index_t *restrict ptr, const oski_index_t *restrict ind, oski_index_t b, int has_unit_diag, double threshold, oski_index_t *b_start, oski_index_t n_max, flag_t *workspace) |
Determine a partitioning of a CSR structure into groups of consecutive rows that have similar non-zero patterns. | |
static void | MakeBlockMap (const oski_index_t *restrict I_starts, oski_index_t M, oski_index_t *restrict map) |
Computes a row-to-block-row lookup table. | |
static int | GetPart (oski_index_t m, oski_index_t n, const oski_index_t *ptr, const oski_index_t *ind, oski_index_t b, int has_unit_diag, int is_symm, const oski_index_t *Tptr, const oski_index_t *Tind, oski_index_t b_T, int has_unit_diag_T, double threshold_r, double threshold_c, oski_index_t *p_M, oski_index_t *p_N, oski_index_t **p_brow, oski_index_t **p_bcol, flag_t *work_f) |
static void | CountVBRSize (oski_index_t m, oski_index_t n, const oski_index_t *restrict ptr, const oski_index_t *restrict ind, oski_index_t b, int has_unit_diag, oski_index_t M, oski_index_t N, oski_index_t *restrict brow, oski_index_t *restrict bcol, oski_index_t *p_nb, oski_index_t *p_nnz, flag_t *restrict f_workspace, oski_index_t *restrict i_workspace) |
Given a CSR matrix and a candidate block row/column partitioning, counts the number of non-zero blocks and stored non-zero values required to represent a VBR version of the matrix. | |
static void | CopyToVBR (oski_index_t m, oski_index_t n, const oski_index_t *restrict ptr, const oski_index_t *restrict ind, const oski_value_t *restrict val, oski_index_t b, int has_unit_diag, oski_index_t M, oski_index_t N, oski_index_t *restrict brow, oski_index_t *restrict bcol, oski_index_t nb, oski_index_t nnz, oski_index_t *V_ptr, oski_index_t *V_ind, oski_index_t *V_valptr, oski_value_t *V_val, flag_t *restrict f_workspace, oski_index_t *restrict i_workspace) |
Given a CSR matrix and a candidate block row/column partitioning, counts the number of non-zero blocks and stored non-zero values required to represent a VBR version of the matrix. | |
static int | ConvertToVBR (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 b, int has_unit_diag, int is_symm, const oski_index_t *Tptr, const oski_index_t *Tind, oski_index_t b_T, int has_unit_diag_T, double threshold_r, double threshold_c, oski_index_t *p_M, oski_index_t *p_N, oski_index_t **p_brow, oski_index_t **p_bcol, oski_index_t **p_V_ptr, oski_index_t **p_V_ind, oski_index_t **p_V_valptr, oski_value_t **p_V_val) |
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. | |
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. |
|
Given a CSR matrix and a candidate block row/column partitioning, counts the number of non-zero blocks and stored non-zero values required to represent a VBR version of the matrix.
|
|
Returns the number of unique elements that two sparse vectors, and , have in common. These vectors are assumed to be row (or column) vectors of a larger matrix, located at positions row (column) and , respectively.
|
|
Counts the number of unique structurally non-zero elements in a sparse vector .
|
|
Given a CSR matrix and a candidate block row/column partitioning, counts the number of non-zero blocks and stored non-zero values required to represent a VBR version of the matrix.
|
|
Determine a partitioning of a CSR structure into groups of consecutive rows that have similar non-zero patterns. This routine finds a block row partitioning, defined as a sequence of block row starting positions , where the block row consists of all rows starting at and ending at . The block rows satisfy the following property.
|
|
Computes a row-to-block-row lookup table.
|
|
Scatters a specified value to all elements of a dense flag vector corresponding to the structurally non-zero elements of a sparse vector . More specifically, sets for all such that .
|