Package overview
primate
, short for Probabalistic Implicit Matrix Trace Estimator, is a Python package that provides estimators of quantities derived from matrix functions; that is, matrices parameterized by functions:
f(A) \triangleq U f(\Lambda) U^{\intercal}, \quad \quad f : [a,b] \to \mathbb{R}
Estimator approximations are obtained via the Lanczos1 and stochastic Lanczos quadrature2 methods, which are well-suited for sparse or structured operators supporting fast v \mapsto Av actions.
Notable features of primate
include:
- Efficient methods for trace, quadrature, and matrix function approximation
- Various distribution / engine choices for random vector generation (the stochastic part!)
- Support for arbitrary matrix functions, i.e.
Callable
’s (Python) andinvocable
’s3 (C++) - Support for arbitrary
LinearOperator
’s, e.g. those in SciPy or Pylops - Matrix-free interface to the Lanczos, Golub-Welsch, and Gram Schmidt methods
primate
was partially inspired by the imate
package—for a comparison of the two, see here.
Footnotes
Musco, Cameron, Christopher Musco, and Aaron Sidford. (2018) “Stability of the Lanczos method for matrix function approximation.”↩︎
Ubaru, S., Chen, J., & Saad, Y. (2017). Fast estimation of tr(f(A)) via stochastic Lanczos quadrature.↩︎
This includes std::function’s, C-style function pointers, functors, and lambda expressions.↩︎