API Reference#
Welcome to the official API reference for Pyxu. This API documentation is intended to serve as a comprehensive guide to the library’s various modules, classes, functions, and interfaces. It provides detailed descriptions of each component’s role, relations, assumptions, and behavior.
Please note that this API reference is not designed to be a tutorial; it’s a technical resource aimed at users who are already familiar with the library’s basics and wish to dive deeper into its functionalities.
Pyxu is broken down into the following top-level namespaces:
pyxu.abc
: abstract base types and logic used throughout Pyxu.pyxu.info.deps
: array backend tools.pyxu.info.ptype
: type aliases for Python type checkers.pyxu.info.warning
: internal warnings.pyxu.operator
: operator collection.pyxu.operator.interop
: helpers to interface with external packages such as JAX, PyTorch, etc.pyxu.opt.solver
: solver collection.pyxu.opt.stop
: common stopping criteria.pyxu.runtime
: compute precision tools.pyxu.math
: math helpers.pyxu.util
: utility functions.pyxu.experimental
: experimental packages. These may change in the future without warning. Each sub-module underexperimental
must be imported individually:from pyxu.experimental.sampler import ULA
Individual Pyxu components should be imported from these top-level modules. Some low-level routines are not exposed from the former and must be imported explicitly:
from pyxu.operator import Sum # top-level import
from pyxu.util.misc import peaks # low-level import
The import path of each object can be inferred by looking at its canonical path in the alphabetical listings below.
Table of Contents
pyxu.abc#
Arithmetic Rules (low-level)#
|
Arithmetic rules for operator addition: \(C(x) = A(x) + B(x)\). |
|
Arithmetic rules for element-wise parameter scaling: \(B(x) = A(\alpha x)\). |
|
Arithmetic rules for parameter shifting: \(B(x) = A(x + c)\). |
|
Arithmetic rules for operator composition: \(C(x) = (A \circ B)(x)\). |
General arithmetic rule. |
|
|
Arithmetic rules for element-wise scaling: \(B(x) = \alpha A(x)\). |
Arithmetic rules for |
pyxu.experimental#
Sampling Tools#
|
Moreau-Yosida unajusted Langevin algorithm (MYULA). |
|
Pointwise online centered moment. |
Pointwise online kurtosis. |
|
|
Pointwise online moment. |
Pointwise online skewness. |
|
Pointwise online standard deviation. |
|
Pointwise online variance. |
|
|
Unajusted Langevin algorithm (ULA). |
pyxu.info.deps#
Show if CuPy-based backends are available. |
|
|
Supported dense array backends. |
|
Supported sparse array backends. |
List of all supported dense array modules in current Pyxu install. |
|
List of all supported dense array types in current Pyxu install. |
|
List of all supported sparse array modules in current Pyxu install. |
|
List of all supported sparse array types in current Pyxu install. |
pyxu.info.ptype#
Supported dense array modules. |
|
|
|
alias of |
|
Supported dense array types. |
|
Axis/Axes specifier. |
|
|
|
|
|
Top-level abstract |
|
Path-like object. |
|
Mathematical properties attached to |
|
|
To Complex, Real adds the operations that work on real numbers. |
|
|
Solver run-modes. |
|
Top-level abstract |
|
Type variable. |
|
Type variable. |
|
Variable name(s). |
pyxu.info.warning#
Use when a quantity was auto-inferenced with possible caveats. |
|
Inform user of a backend-specific problem to be aware of. |
|
Use for warnings related to Pyxu plugins. |
|
Use for sparse-based algos which revert to dense arrays. |
|
Inform test suite runner of (safe) non-transparent function call. |
|
Use for performance-related warnings. |
|
Use for precision-related warnings. |
|
Parent class of all warnings raised in Pyxu. |
pyxu.math#
|
Backtracking line search algorithm based on the Armijo-Goldstein condition. |
|
Stochastic trace estimation of a linear operator based on the Hutch++ algorithm. |
|
Exact trace of a linear operator based on multiple evaluation of the forward operator. |
pyxu.operator.interop#
General#
|
Define an |
SciPy#
|
Wrap a |
JAX#
|
JAX -> NumPy/CuPy conversion. |
|
NumPy/CuPy -> JAX conversion. |
|
Define an |
PyTorch#
|
PyTorch -> NumPy/CuPy conversion. |
|
NumPy/CuPy -> PyTorch conversion. |
|
Define an |
pyxu.operator#
Functionals#
Norms & Loss Functions#
|
Generalised Kullback-Leibler divergence \(D_{KL}(\mathbf{y}||\mathbf{x}) := \sum_{i} y_{i} \log(y_{i} / x_{i}) - y_{i} + x_{i}\). |
|
\(\ell_{1}\)-norm, \(\Vert\mathbf{x}\Vert_{1} := \sum_{i} |x_{i}|\). |
|
Mixed \(\ell_{2}-\ell_{1}\) norm, \(\Vert\mathbf{x}\Vert_{2, 1} := \sum_{i} \sqrt{\sum_{j} x_{i, j}^{2}}\). |
|
\(\ell_{2}\)-norm, \(\Vert\mathbf{x}\Vert_{2} := \sqrt{\sum_{i} |x_{i}|^{2}}\). |
|
\(\ell_{\infty}\)-norm, \(\Vert\mathbf{x}\Vert_{\infty} := \max_{i} |x_{i}|\). |
|
\(\ell_{1}\)-norm, with a positivity constraint. |
|
\(\ell^{2}_{1}\)-norm, \(\Vert\mathbf{x}\Vert^{2}_{1} := (\sum_{i} |x_{i}|)^{2}\). |
|
\(\ell^{2}_{2}\)-norm, \(\Vert\mathbf{x}\Vert^{2}_{2} := \sum_{i} |x_{i}|^{2}\). |
Indicator Functions#
|
Indicator function of a hyperslab. |
|
Indicator function of the \(\ell_{1}\)-ball. |
|
Indicator function of the \(\ell_{2}\)-ball. |
|
Indicator function of the \(\ell_{\infty}\)-ball. |
|
Indicator function of the positive orthant. |
|
Indicator function of a range set. |
Linear Operators#
Basic Operators#
|
Element-wise scaling operator. |
|
Constant scaling operator. |
|
Identity operator. |
|
Null functional. |
|
Null operator. |
|
Multi-dimensional padding operator. |
|
Multi-dimensional sub-sampling operator. |
|
Multi-dimensional sum reduction \(\mathbf{A}: \mathbb{R}^{M_{1} \times\cdots\times M_{D}} \to \mathbb{R}^{N_{1} \times\cdots\times N_{D}}\). |
|
Multi-dimensional trimming operator. |
Transforms#
|
Multi-dimensional Discrete Fourier Transform (DFT) \(A: \mathbb{C}^{M_{1} \times\cdots\times M_{D}} \to \mathbb{C}^{M_{1} \times\cdots\times M_{D}}\). |
|
Multi-dimensional Chirp Z-Transform (CZT) \(C: \mathbb{C}^{N_{1} \times\cdots\times N_{D}} \to \mathbb{C}^{M_{1} \times\cdots\times M_{D}}\). |
Stencils & Convolutions#
|
Multi-dimensional JIT-compiled convolution. |
alias of |
|
|
Multi-dimensional FFT-based convolution. |
|
Multi-dimensional FFT-based correlation. |
|
Multi-dimensional JIT-compiled stencil. |
|
Multi-dimensional JIT-compiled stencil. |
Filters#
|
Multi-dimensional Difference of Gaussians filter. |
|
Alias of |
|
Gaussian, element-wise. |
|
Multi-dimensional Laplace filter. |
|
Multi-dimensional moving average or uniform filter. |
|
Multi-dimensional Prewitt filter. |
|
Multi-dimensional Scharr filter. |
|
Multi-dimensional Sobel filter. |
|
Structure tensor operator. |
Derivatives#
|
Directional derivative operator. |
|
Directional gradient operator. |
|
Directional Hessian operator. |
|
Directional Laplacian operator. |
|
Divergence operator. |
|
Gradient operator. |
|
Hessian operator. |
|
Jacobian operator. |
|
Laplacian operator. |
Partial derivative operator based on Numba stencils. |
Tensor Products#
|
Column-wise Khatri-Rao product \(A \circ B\) between two linear operators. |
|
Kronecker product \(A \otimes B\) between two linear operators. |
Misc#
|
Broadcast an array. |
|
Constant-valued operator \(C: \mathbb{R}^{M_{1} \times\cdots\times M_{D}} \to \mathbb{R}^{N_{1} \times\cdots\times N_{K}}\). |
|
Re-chunk core dimensions to new chunk size. |
|
Reshape an array. |
|
Remove axes of length one. |
|
Reverse or permute the axes of an array. |
Block-defined Operators#
|
Zip operators over parallel inputs. |
|
Map operators over the same input. |
Element-wise Operators#
|
Absolute value, element-wise. |
|
Inverse cosine, element-wise. |
|
Inverse hyperbolic cosine, element-wise. |
|
Inverse sine, element-wise. |
|
Inverse hyperbolic sine, element-wise. |
|
Inverse tangent, element-wise. |
|
Inverse hyperbolic tangent, element-wise. |
|
Cube-root, element-wise. |
|
Clip (limit) values in an array, element-wise. |
|
Trigonometric cosine, element-wise. |
|
Hyperbolic cosine, element-wise. |
|
Exponential, element-wise. |
|
Gaussian, element-wise. |
|
Leaky rectified linear unit, element-wise. |
|
Logarithm, element-wise. |
|
Rectified linear unit, element-wise. |
|
Sigmoid, element-wise. |
|
Number sign indicator, element-wise. |
|
Sigmoid linear unit, element-wise. |
|
Trigonometric sine, element-wise. |
|
Hyperbolic sine, element-wise. |
|
Softplus operator. |
|
Non-negative square-root, element-wise. |
|
Square, element-wise. |
|
Trigonometric tangent, element-wise. |
|
Hyperbolic tangent, element-wise. |
pyxu.opt.solver#
|
Adam solver [ProxAdam]. |
|
Alternating Direction Method of Multipliers. |
|
Conjugate Gradient Method. |
|
Chambolle-Pock primal-dual splitting method. |
|
Condat-Vu primal-dual splitting algorithm. |
|
Alias of |
alias of |
|
|
Davis-Yin primal-dual splitting method. |
|
Douglas-Rachford splitting algorithm. |
|
Alias of |
alias of |
|
alias of |
|
|
Forward-backward splitting algorithm. |
|
Loris-Verhoeven splitting algorithm. |
alias of |
|
|
Nonlinear Conjugate Gradient Method (NLCG). |
|
Primal-Dual Three-Operator Splitting (PD3O) algorithm. |
|
Proximal Gradient Descent (PGD) solver. |
|
Alias of |
|
Proximal-point method. |
pyxu.opt.stop#
|
Stop iterative solver after absolute norm of a variable (or function thereof) reaches threshold. |
Continue-forever criterion. |
|
|
Stop iterative solver after a specified duration has elapsed. |
|
Stop iterative solver after a fixed number of iterations. |
|
Memorize a variable. |
|
Stop iterative solver after relative norm change of a variable (or function thereof) reaches threshold. |
pyxu.runtime#
|
Machine-dependent complex-valued floating-point types. |
|
Machine-dependent floating-point types. |
pyxu.util#
Complex Number Handling#
|
View complex-valued linear operator as its real-valued equivalent. |
Copy array if required to do real/complex view manipulations. |
|
View real-valued array as its complex-valued bijection. |
|
|
View complex-valued array as its real-valued bijection. |
Operator-Related#
|
Transform NDarray axes into tuple-form with positive indices. |
Transform a lone integer into a valid tuple-based shape specifier. |
|
|
Decorator to auto-vectorize a function \(\mathbf{f}: \mathbb{R}^{M_{1} \times\cdots\times M_{D}} \to \mathbb{R}^{N_{1} \times\cdots\times N_{K}}\) to accept stacking dimensions. |
Misc#
Copy array if it is unsafe to do in-place updates on it. |
|
|
Load a Python module dynamically. |
|
Get function parameterization. |
|
Make an array read-only. |
Low-lever Helpers
|
Matlab 2D peaks function. |
|
Star-like test image. |