primate
, short for Probabilistic Implicit Matrix Trace Estimator, is a Python package that provides estimators of quantities from matrices, linear operators, and matrix functions:
This definition is quite general in that different parameterizations of
Composing these with trace and diagonal estimators yields approximations for the numerical rank, the log-determinant, the Schatten norms, the eigencount, the Estrada index, the Heat Kernel Signature, and so on.
Notable features of primate
include:
- Efficient methods for trace, diagonal, and matrix function approximation
- Support for arbitrary matrix types, e.g. NumPy arrays, sparse matrices, or LinearOperator's
- Support for arbitrary matrix functions, i.e.
Callable
's (Python) andinvocable
's1 (C++) - Matrix-free interface to the Lanczos and Golub-Welsch methods
- Various composable stopping criteria for easy and adaptive convergence checking
primate
was partially inspired by the imate
package---for a comparison of the two, see here.
primate
is a standard PEP-517 package, and thus can be installed via pip:
python -m pip install scikit-primate
Assuming your platform is supported, no compilation is needed.
See the installation page for details.
Applications of matrix functions include characterizing folding in proteins, principal component regression, spectral clustering, Gaussian process likelihood estimation, counting triangles in distributed-memory networks, characterizing graph similarity, and deep neural loss landscape analysis.
If you have a particular application, feel free to make a computational notebook to illustrate it as a use-case!
Footnotes
-
This includes std::function's, C-style function pointers, functors, and lambda expressions. ↩