module.h File Reference


Detailed Description

Compressed sparse row implementation.

#include <oski/matmodexport.h>

Go to the source code of this file.

Name mangling.

#define oski_WrapCSR   MANGLE_MOD_(oski_WrapCSR)
#define oski_CheckCSR   MANGLE_MOD_(oski_CheckCSR)
#define oski_StreamMatRepr   MANGLE_MOD_(oski_StreamMatRepr)
#define oski_SortIndices   MANGLE_MOD_(oski_SortIndices)
#define oski_ExpandCSRToFull   MANGLE_MOD_(oski_ExpandCSRToFull)
#define oski_ConditionallyExpandCSRToFull   MANGLE_MOD_(oski_ConditionallyExpandCSRToFull)
#define oski_ChangeIndexBase   MANGLE_MOD_(oski_ChangeIndexBase)
#define oski_TransposeCSR   MANGLE_MOD_(oski_TransposeCSR)
#define oski_CountZeroRowsCSR   MANGLE_MOD_(oski_CountZeroRowsCSR)

CSR-based sparse triangular solve kernel driver mangling.

#define CSR_MatTrisolveLower   MANGLE_(CSR_MatTrisolveLower)
#define CSR_MatTransTrisolveLower   MANGLE_(CSR_MatTransTrisolveLower)
#define CSR_MatConjTrisolveLower   MANGLE_(CSR_MatConjTrisolveLower)
#define CSR_MatConjTransTrisolveLower   MANGLE_(CSR_MatConjTransTrisolveLower)
#define CSR_MatTrisolveUpper   MANGLE_(CSR_MatTrisolveUpper)
#define CSR_MatTransTrisolveUpper   MANGLE_(CSR_MatTransTrisolveUpper)
#define CSR_MatConjTrisolveUpper   MANGLE_(CSR_MatConjTrisolveUpper)
#define CSR_MatConjTransTrisolveUpper   MANGLE_(CSR_MatConjTransTrisolveUpper)

CSR wrapper.

oski_matCSR_toski_WrapCSR (oski_matcommon_t *out_props, oski_index_t *Aptr, oski_index_t *Aind, oski_value_t *Aval, oski_index_t num_rows, oski_index_t num_cols, oski_inmatpropset_t *props, oski_copymode_t mode)
 Create a new CSR-specific wrapper around a raw CSR array representation.

CSR-based sparse triangular solve kernel drivers.

void CSR_MatTrisolveLower (oski_index_t m, oski_index_t indbase, int is_unit, int is_sorted, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_value_t alpha, oski_value_t *x, oski_index_t num_vecs, oski_index_t rowinc, oski_index_t colinc)
void CSR_MatConjTrisolveLower (oski_index_t m, oski_index_t indbase, int is_unit, int is_sorted, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_value_t alpha, oski_value_t *x, oski_index_t num_vecs, oski_index_t rowinc, oski_index_t colinc)
void CSR_MatTransTrisolveLower (oski_index_t m, oski_index_t indbase, int is_unit, int is_sorted, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_value_t alpha, oski_value_t *x, oski_index_t num_vecs, oski_index_t rowinc, oski_index_t colinc)
void CSR_MatConjTransTrisolveLower (oski_index_t m, oski_index_t indbase, int is_unit, int is_sorted, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_value_t alpha, oski_value_t *x, oski_index_t num_vecs, oski_index_t rowinc, oski_index_t colinc)
void CSR_MatTrisolveUpper (oski_index_t m, oski_index_t indbase, int is_unit, int is_sorted, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_value_t alpha, oski_value_t *x, oski_index_t num_vecs, oski_index_t rowinc, oski_index_t colinc)
void CSR_MatTransTrisolveUpper (oski_index_t m, oski_index_t indbase, int is_unit, int is_sorted, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_value_t alpha, oski_value_t *x, oski_index_t num_vecs, oski_index_t rowinc, oski_index_t colinc)
void CSR_MatConjTrisolveUpper (oski_index_t m, oski_index_t indbase, int is_unit, int is_sorted, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_value_t alpha, oski_value_t *x, oski_index_t num_vecs, oski_index_t rowinc, oski_index_t colinc)
void CSR_MatConjTransTrisolveUpper (oski_index_t m, oski_index_t indbase, int is_unit, int is_sorted, const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_value_t alpha, oski_value_t *x, oski_index_t num_vecs, oski_index_t rowinc, oski_index_t colinc)

Defines

#define INC_OSKI_CSR_MODULE_H
 oski/CSR/module.h included.

Functions

int oski_CheckCSR (const oski_index_t *ptr, const oski_index_t *ind, oski_index_t m, oski_index_t n, oski_inmatpropset_t *props)
 Verify that a CSR matrix representation satisfies asserted properties.
double oski_StreamMatRepr (const void *mat, const oski_matcommon_t *props)
 Stream through a matrix.
oski_matCSR_toski_ExpandCSRToFull (const oski_matCSR_t *S, const oski_matcommon_t *props)
 Convert a half-storage symmetric or Hermitian matrix to full storage.
int oski_ConditionallyExpandCSRToFull (const oski_matCSR_t *S, const oski_matcommon_t *props, oski_matCSR_t **p_mat_full)
 Conditionally convert a half-storage symmetric or Hermitian matrix to full storage.
void oski_ChangeIndexBase (oski_matCSR_t *A, const oski_matcommon_t *props, const oski_index_t new_base)
 Change the index base of a matrix.
int oski_SortIndices (oski_matCSR_t *A, oski_index_t m)
 Sort the column indices of a CSR matrix with m rows using b-based indexing.
oski_matCSR_toski_TransposeCSR (const oski_matCSR_t *A, const oski_matcommon_t *props)
 Given a matrix $A$ in CSR format, returns a copy of its explicit transpose $A^T$ in CSR format.
oski_index_t oski_CountZeroRowsCSR (const oski_matCSR_t *A, const oski_matcommon_t *props)
 Returns the number of rows in a given CSR matrix that contain no structural non-zeros.


Function Documentation

int oski_CheckCSR const oski_index_t *  ptr,
const oski_index_t *  ind,
oski_index_t  m,
oski_index_t  n,
oski_inmatpropset_t props
 

Verify that a CSR matrix representation satisfies asserted properties.

This routine verifies that the following properties, if asserted, are true:

  • Row pointer indices are non-decreasing
  • 0- or 1-based indexing and indices bound by matrix dimensions.
  • Sorted column indices
  • Unique column indices.
  • Triangular storage
  • Implicit unit diagonal (i.e., if asserted, no diagonals elements must be present).

The implementation relies on O(nnz) algorithms to verify these properties.

If any of the properties can be strengthened to improve kernel performance, then the properties are modified to reflect the stronger assertion. There are two specific examples:

  • The caller asserts that column indices are not sorted but they are.
  • The caller asserts that indices are not unique within a row but they are.

Parameters:
[in] ptr Row pointers.
[in] ind Column indices.
[in] m Number of rows.
[in] n Number of columns.
[in,out] props Asserted properties.
Returns:
This routine performs a series of O(nnz) checks to verify asserted properties of the given CSR matrix pattern. If any false properties are detected, this routine returns 0. Otherwise, it returns 1. If any properties can be strengthened, the corresponding property is changed in props.
Precondition:
Pointer arguments are not NULL and dimensions are non-negative.

int oski_SortIndices oski_matCSR_t A,
oski_index_t  m
 

Sort the column indices of a CSR matrix with m rows using b-based indexing.

Parameters:
[in,out] A Matrix whose indices are to be sorted.
[in] m Number of rows in A.
Returns:
0 on success, and an error code on error. Also sets the 'has_sorted_indices' flag of A to 1 on successful execution. If this flag was already set to 1 on entry, then no action is taken and 0 returned.

double oski_StreamMatRepr const void *  mat,
const oski_matcommon_t props
 

Stream through a matrix.

This routine streams through the matrix data structure, performs some dummy computations, and returns the results. We use this routine to help estimate the cost of a matrix-vector multiply operation on a given matrix without actually having to perform matrix-vector multiply.

oski_matCSR_t* oski_TransposeCSR const oski_matCSR_t A,
const oski_matcommon_t props
 

Given a matrix $A$ in CSR format, returns a copy of its explicit transpose $A^T$ in CSR format.

Parameters:
[in] A Matrix $A$ to transpose.
[in] props Common properties of $A$.
Returns:
A pointer to a new CSR matrix storing $A^T$, or NULL on memory error.
This implementation maintains symmetric/Hermitian properties if they apply to $A$.

oski_matCSR_t* oski_WrapCSR oski_matcommon_t out_props,
oski_index_t *  Aptr,
oski_index_t *  Aind,
oski_value_t *  Aval,
oski_index_t  num_rows,
oski_index_t  num_cols,
oski_inmatpropset_t props,
oski_copymode_t  mode
 

Create a new CSR-specific wrapper around a raw CSR array representation.

If any of the asserted properties can be strengthened, then the parameter props (below) is changed accordingly. See oski_CheckCSR() for details.

Parameters:
[out] out_props Matrix type-independent properties, derived from the input properties props.
[in] Aptr Row pointers.
[in] Aind Column indices.
[in] Aval Non-zero values.
[in,out] props Semantic properties of the matrix represented by
[in] num_rows Number of rows.
[in] num_cols Number of columns. Aptr, Aind, and Aval.
[in] mode Specify the copy mode for the returned representation.
Precondition:
All pointer arguments are non-NULL

num_rows, num_cols are non-negative

mode is a legal value.

See also:
oski_wrapCSR_funcpt
Returns:
A matrix type-specific representation of the input matrix, or NULL on error.
Todo:
The output properties data structure actually defines a more general property about the diagonal, namely, that it is all ones. However, the available input matrix properties only allow the user to specify whether or not there is an implicit unit diagonal. Thus, it is possible that the user could create an input matrix with an explicit unit diagonal, but this condition is not checked when wrapping the data structure. It might be desirable to do this to make optimized triangular solve for the unit diagonal case more efficient.
Todo:
Similarly, the oski_matCSR_t data structure has "is_upper" and "is_lower" flags, which could be set even if the user asserts that the matrix has a "general" pattern.

Basic steps:

  1. Check asserted properties.
  2. Create a CSR handle.
  3. Copy buffers (deep or shallow copy, depending on mode)
  4. Set common properties.
  5. Set matrix-specific properties.
  6. Return.


Generated on Wed Sep 19 16:41:23 2007 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.4.6