Expand description
Safe wrappers for AOCL-Sparse.
Modules§
- complex
- Complex-precision sparse operations (
Complex32/Complex64).
Structs§
- Complex32
- Single-precision complex number, ABI-compatible with the C struct
{ float real; float imag; }used by BLIS’sscomplex, LAPACK’slapack_complex_float, and FFTW’sfftwf_complex. - Complex64
- Double-precision complex number, ABI-compatible with the C struct
{ double real; double imag; }used by BLIS’sdcomplex, LAPACK’slapack_complex_double, and FFTW’sfftw_complex. - Iter
Solver - RAII handle for the AOCL-Sparse iterative-solver suite.
- MatDescr
- RAII wrapper for
aoclsparse_mat_descr. - Sparse
Matrix - RAII wrapper around an
aoclsparse_matrixhandle holding a CSR matrix.
Enums§
- Diag
Type - Whether the diagonal of a triangular matrix is implicitly unit
(
Unit) or explicitly stored (NonUnit). - Error
- Errors that can be returned by safe AOCL wrappers.
- Fill
Mode - Which triangle of a symmetric / triangular matrix is stored.
- Index
Base - Index base for sparse-format index arrays.
- MatType
- Storage type of a sparse matrix’s nonzero pattern.
- Memory
Usage - Memory-usage hint to give the analysis pass.
- Order
- Storage order used when converting from CSR to a dense matrix.
- SorType
- Sweep direction for
sorv. - Stage
- Stage of a multi-pass sparse-sparse matrix product (see
csr2m). - Trans
- How to interpret a matrix operand: as-is, transposed, or conjugate-transposed.
Traits§
- Scalar
- Scalar element type usable with the wrapped sparse routines.
Functions§
- add
- Compute
C := α · op(A) + Breturning a fresh sparse CSR matrix. - axpyi
- Sparse
y[indx] := α·x + y[indx](sparse vector AXPY). - blkcsrmv_
f64 - Block-CSR mat-vec with a per-block bitmask.
masks[i]is a u8 bit pattern indicating which rows of blockiparticipate.n_rows_blkis the block height. (f64) - bsrmv
- Compute
y := α · op(A) · x + β · yfor a BSR-formatA. - copy_
mat_ descr - Make a deep copy of a
MatDescrwith the same options. - create_
csc_ f32 f32CSC creator. Seecreate_csc_f64.- create_
csc_ f64 - Build a CSC matrix handle. Column-major analogue of CSR. (
f64) - create_
tcsr_ f32 f32TCSR creator. Seecreate_tcsr_f64.- create_
tcsr_ f64 - Build a TCSR matrix handle from two CSR sub-arrays describing the
strict-lower (
*_L) and strict-upper (*_U) parts. (f64) - csr2bsr_
f32 f32CSR → BSR. Seecsr2bsr_f64.- csr2bsr_
f64 - Convert CSR → BSR. Run
csr2bsr_nnzfirst to size the output. (f64) - csr2bsr_
nnz - Compute the number of nonzero blocks (
bsr_nnz) andbsr_row_ptrfor a CSR → BSR conversion with the givenblock_dim. - csr2dia_
f32 f32CSR → DIA. Seecsr2dia_f64.- csr2dia_
f64 - Convert CSR → DIA (diagonal storage).
dia_offsetanddia_valmust be pre-allocated;dia_num_diagis the number of distinct diagonals. (f64) - csr2ell_
f32 f32CSR → ELLPACK. Seecsr2ell_f64.- csr2ell_
f64 - Convert CSR → ELLPACK.
ell_widthis the chosen padded row length; caller must allocateell_col_indandell_valof sizem * ell_width. (f64) - csr2m
- Compute
C := op_A(A) · op_B(B)between two CSR matrices, returning a freshly allocated CSR result. Both inputs must have matching scalar precision; complex precisions are not yet exposed by these wrappers. - csr_
to_ csc - Convert a CSR matrix to CSC. Output arrays must be pre-sized.
- csr_
to_ dense - Convert a CSR sparse matrix to a dense
m × nmatrix inout. - csrmm
- Compute
C := α · op(A) · B + β · CwhereAis sparse (CSR via the matrix handle) andB,Care dense matrices laid out perorder. - csrmv
- Compute
y := α · A · x + β · yfor a CSR matrixA. - csrsv
- Solve
op(A) · y = α · xwhereAis sparse triangular in CSR format. The triangle is determined by thedescr’s fill mode (set via theaoclsparse_set_mat_*C-API; defaults to upper, non-unit). - doti_
f32 f32sparse dot. Seedoti_f64.- doti_
f64 - Sparse vector dot product:
Σᵢ x[i] · y[indx[i]].xandindxmust have the same length (the nnz count). - dotmv_
f32 f32fused dot + mat-vec. Seedotmv_f64.- dotmv_
f64 - Fused dot product and mat-vec:
y := α · op(A) · x + β · yandd := xᵀ · y(ord := xᴴ · yfor complex). Saves one pass over the matrix versus callingmvthendotseparately. (f64) - ellmv
- Compute
y := α · op(A) · x + β · yfor an ELLPACK-formatA. - gthr
- Sparse gather:
x[i] := y[indx[i]]fori ∈ [0, nnz). - gthrs_
f32 f32strided gather. Seegthrs_f64.- gthrs_
f64 - Strided sparse gather:
x[i] := y[i · stride]fori ∈ [0, nnz). (f64) - gthrz_
f32 f32gather-and-zero. Seegthrz_f64.- gthrz_
f64 - Gather-and-zero: copy
y[indx[i]]intox[i]and zero the source. (f64) - ilu_
smoother - Apply one ILU(0) smoothing step in-place to
x, with right-hand sideb. - mv_f32
f32mat-vec via the matrix-handle interface. Seemv_f64.- mv_f64
- Real high-level mat-vec
y := α · op(A) · x + β · yagainst aSparseMatrix<f64>handle (per-precision; complex variants live in thecomplexsubmodule). - optimize
- Run AOCL-Sparse’s analysis / optimization step on a matrix handle.
Use this after declaring hints (e.g.
set_mv_hint) to let the library choose specialised kernels for repeated operations. - roti_
f32 f32sparse rotation. Seeroti_f64.- roti_
f64 - Sparse rotation: simultaneously rotate
(x, y)at indicesindxby(c, s).xis sparse withindxindices into the densey. (f64) - sctr
- Sparse scatter:
y[indx[i]] := x[i]fori ∈ [0, nnz). - sctrs_
f32 f32strided scatter. Seesctrs_f64.- sctrs_
f64 - Strided sparse scatter:
y[i · stride] := x[i]. (f64) - set_
memory_ hint - Tell the library how much extra memory it may consume on this
matrix. Pair with
optimize. - set_
value_ f32 f32set_value. Seeset_value_f64.- set_
value_ f64 - Set a single value at
(row_idx, col_idx)in a CSR matrix handle. Element must already exist in the sparsity pattern. (f64) - sorv
- One step of (S)SOR / forward / backward Gauss-Seidel relaxation:
x_new := (1 − ω) x + ω · A⁻¹ (α · b). Useful as a smoother inside iterative-solver loops. - sorv_
f32 f32SOR / forward / backward Gauss-Seidel sweep. The existing genericsorvdispatches to this via the Scalar trait; this is a per-precision direct alias.- sp2md
- Compute
C := α · op_A(A) · op_B(B) + β · Cwhere bothAandBare sparse andCis dense. - spmmd
- Compute
C := op(A) · Bwhere bothAandBare sparse andCis a dense matrix.ldcis the leading dimension ofCperlayout. - symgs_
f32 f32symmetric Gauss-Seidel. Seesymgs_f64.- symgs_
f64 - Symmetric Gauss-Seidel sweep
x := x + α · D⁻¹ (b − A·x)against a symmetric matrix handle. (f64) - symgs_
mv_ f32 f32fused symmetric Gauss-Seidel + mat-vec. Seesymgs_mv_f64.- symgs_
mv_ f64 - Fused Gauss-Seidel + matrix-vector: produces both the updated
xandy := A·xin one pass. (f64) - syprd_
f32 f32symmetric triple product. Seesyprd_f64.- syprd_
f64 - Symmetric triple product from a sparse
Aand denseB:C := α · op(A) · B · op(A)ᵀ + β · C. (f64) - syrkd_
f32 f32symmetric rank-k update from sparseA. Seesyrkd_f64.- syrkd_
f64 - Symmetric rank-k update from a sparse matrix:
C := α · op(A) · op(A)ᵀ + β · C(real) /C := α · op(A) · op(A)ᴴ + β · C(complex).Cis dense. (f64) - trsm_
f32 f32multi-RHS triangular solve. Seetrsm_f64.- trsm_
f64 - Multi-RHS triangular solve:
op(A) · X = α · Bforn_rhsright-hand sides,B/Xdensem × n_rhs. - trsv_
f32 f32triangular solve. Seetrsv_f64.- trsv_
f64 - Solve
op(A) · x = α · bfor sparse triangularAagainst aSparseMatrix<f64>handle. The fill mode and unit/non-unit diag must be set ondescrfirst. - update_
values_ f32 f32update_values. Seeupdate_values_f64.- update_
values_ f64 - Update the values array of a CSR handle without rebuilding.
len = nnz; the new values must respect the existing sparsity pattern. (f64) - version
- AOCL-Sparse library version string (e.g.
"AOCL-Sparse 5.1.0").
Type Aliases§
- Result
- Crate result alias — used by every
aocl-*safe wrapper crate.