BeBOP Optimized Sparse Kernel Interface Library  1.0.1h
Data Fields
oski_matCSR_t Struct Reference

Compressed sparse row (CSR) format. More...

#include <format.h>

Data Fields

oski_index_t base_index
 Integer index starting value (0 or 1).
int has_unit_diag_implicit
 $=1 \Longleftrightarrow A(i,i)=1$ for all diagonal elements and no diagonal elements are explicitly stored; 0 otherwise.
int has_sorted_indices
 $=1 \Longleftrightarrow$ within each row, the column indices are sorted in increasing order; 0 otherwise.
struct {
   int   is_upper
 Upper triangle stored.
   int   is_lower
 Lower triangle stored.
stored
 Mutually exclusive non-zero pattern properties.
oski_index_t * ptr
 Row pointers.
oski_index_t * ind
 Column indices.
oski_value_t * val
 Stored values.
int is_shared
 Buffers ptr, ind, val are shared.

Detailed Description

Compressed sparse row (CSR) format.

An $m\times n$ matrix $A$ is stored CSR format using three arrays, $(P, J, V)$, and a constant base index $b \in \{0,1\}$, such that

  1. $P$ is an integer array of row pointers, of length at least $m+1$.
  2. $J$ is an integer array of column indices, of length at least $P[m]-b$.
  3. $V$ is an array of real/complex stored values, of length at least $P[m]-b$.

If the full non-zero pattern is stored, then the matrix elements $A(i,j)$ are computed as follows:

If the matrix is symmetric or Hermitian and the upper triangle is stored, then $A(i,j)$ are computed as above only for $i \leq j$. If instead the lower triangle is stored, then $A(i,j)$ are computed as above only for $i \geq j$.

If all the diagonal elements are identically 1 but not explicitly stored, then $K_{i,i} = \emptyset$. Otherwise, any non-zero diagonal elements must be stored explicitly.

If the matrix is logically upper triangular, then only elements $A(i,j)$ such that $j \geq i$ are stored.

If instead the matrix is logically lower triangular, then only elements $A(i,j)$ such that $j \geq i$ are stored.

Todo:
Add a flag to indicate whether the matrix has a full (all non-zero) diagonal so that the triangular solve kernel does not have to check this condition explicitly.

Field Documentation

oski_index_t* oski_matCSR_t::ind
oski_index_t* oski_matCSR_t::ptr
struct { ... } oski_matCSR_t::stored

Mutually exclusive non-zero pattern properties.

These properties work in conjunction with the 'pattern' properties in oski_matcommon_t. If the matrix is symmetric or Hermitian, then one of these flags indicates which non-zero values are actually stored.

is_upper == is_lower <==> full storage.

If the matrix is triangular, these flags are ignored.

Referenced by InitSubmatCSR(), MatReprMult_Normal(), MatReprMult_Trans(), oski_CalcMatRepr1Norm(), oski_ConditionallyExpandCSRToFull(), oski_ConvertMatReprToCSR(), oski_CreateMatReprFromCSR(), oski_ExpandCSRToFull(), oski_MatReprMult(), and SetMatTypeProps().

oski_value_t* oski_matCSR_t::val

The documentation for this struct was generated from the following file: