Algorithms¶
- pymbolic.algorithm.integer_power(x, n, one=1)[source]¶
Compute \(x^n\) using only multiplications.
See also the C2 wiki.
- pymbolic.algorithm.extended_euclidean(q, r)[source]¶
Return a tuple (p, a, b) such that \(p = aq + br\), where p is the greatest common divisor of q and r.
See also the Wikipedia article on the Euclidean algorithm.
- pymbolic.algorithm.fft(x, sign: int = 1, *, wrap_intermediate_with_level=None, complex_dtype=None, custom_np=None, level=0)[source]¶
Computes the Fourier transform of x:
\[F[x]_k = \sum_{j=0}^{n-1} z^{kj} x_j\]where \(z = \exp(-2i\pi\operatorname{sign}/n)\) and
n == len(x)
. Works for all positive n.See also Wikipedia.
- pymbolic.algorithm.ifft(x, *, wrap_intermediate_with_level=None, complex_dtype=None, custom_np=None)[source]¶
- pymbolic.algorithm.sym_fft(x, sign=1)[source]¶
Perform a (symbolic) FFT on the
numpy
object array x.Remove near-zero floating point constants, insert
pymbolic.primitives.CommonSubexpression
wrappers at opportune points.
- pymbolic.algorithm.reduced_row_echelon_form(mat: NDArray[np.inexact], *, integral: bool | None = None) NDArray[np.inexact] [source]¶
- pymbolic.algorithm.reduced_row_echelon_form(mat: NDArray[np.inexact], rhs: NDArray[np.inexact], *, integral: bool | None = None) tuple[NDArray[np.inexact], NDArray[np.inexact]]
- pymbolic.algorithm.solve_affine_equations_for(unknowns, equations)[source]¶
- Parameters:
unknowns – A list of variable names for which to solve.
equations – A list of tuples
(lhs, rhs)
.
- Returns:
a dict mapping unknown names to their values.
References¶
- class pymbolic.algorithm.NDArray¶
See
numpy.typing.NDArray
.
- class np.generic¶
See
numpy.generic
.
- class np.inexact¶
See
numpy.inexact
.