spectral_galerkin_heat.backends

Math backends: dispatch array operations and kernels to CPU or GPU.

A MathBackend bundles an array module (NumPy or CuPy) with its matching physics-kernel module. Inject one into SpectralSolver to run on CPU or GPU from the same solver code. To run on a different library (PyTorch, JAX, …), add a MathBackend with a matching physics-kernel module, see the docs for more details.

Examples

>>> from spectral_galerkin_heat.backends import get_backend
>>> backend = get_backend("numpy")
>>> backend.name
'numpy'

Submodules