Expand description
Sparse matrix powers and polynomial evaluation.
Computes A^k via repeated SpGEMM with binary exponentiation and optional
structure reuse optimization. Also provides matrix polynomial evaluation
via Horner’s method: p(A) = c0*I + c1*A + c2*A^2 + ... + ck*A^k.
All operations work on CSR (Compressed Sparse Row) format stored as
(row_offsets, col_indices, values) triple on the host side.
(C) 2026 COOLJAPAN OU (Team KitaSan)
Structs§
- Matrix
Power Config - Configuration for sparse matrix power computation.
- Matrix
Power Result - Result of a sparse matrix power computation.
Functions§
- add_csr
- Add two CSR matrices with the same number of rows:
C = A + B. - estimate_
power_ nnz - Heuristic estimate of
nnz(A^k)based on average degree. - host_
spgemm - Host-side sparse matrix-matrix multiplication:
C = A * B. - scalar_
multiply_ csr - Multiply all values of a CSR matrix by a scalar, keeping the sparsity structure unchanged.
- sparse_
identity - Construct the CSR representation of an
n x nidentity matrix. - sparse_
matrix_ polynomial - Evaluate a polynomial
p(A) = c0*I + c1*A + c2*A^2 + ... + ck*A^kusing Horner’s method. - sparse_
matrix_ power - Compute
A^powerfor a sparse CSR matrix using binary exponentiation.