API reference¶
flashquad.integrator.FlashQuad¶
The main entry point. Create an instance bound to a backend, then call any integration method.
from flashquad import FlashQuad
fq = FlashQuad(backend="numpy")
fq = FlashQuad(backend="torch", dtype=torch.float32, device="cuda:0")
Parameters:
backend (
str) — One of"numpy","torch","cupy","jax".dtype (optional) — Floating-point dtype compatible with the backend. Defaults to
float64.device (optional) — Compute device (relevant for
"torch"and"jax"). Auto-selects GPU when available.
Integration methods¶
All methods share a common signature:
fq.method(func, intervals, num_points, *, params=None, boundary=None)
Method |
Description |
Constraints |
|---|---|---|
Composite trapezoidal rule |
— |
|
Composite Simpson’s 1/3 rule |
|
|
Composite Boole’s rule |
|
|
Gauss-Legendre quadrature |
— |
|
Monte Carlo sampling |
|
Common arguments:
func — Integrand callable. Called as
func(*coords)orfunc(*coords, params).intervals — Integration bounds per dimension, e.g.
[[0, 1], [0, 1]].num_points — Grid points per dimension (list), or total samples (int, for MC methods).
params (optional) — Array shaped
(batch, num_params)for batched evaluation.boundary (optional) — Mask function to restrict the integration domain.
For full auto-generated module documentation, see the package index.