Skip to content
Specular Differentiation

specular.backends.BackendName

The public type alias for supported calculation backend names:

from typing import Literal

type BackendName = Literal["numpy", "numba", "jax"]

Literal comes from typing. BackendName describes the allowed string values; it is not a function or a class constructor. It is also available as specular.BackendName.

Values

Value Meaning
"numpy" Default backend, included with the package.
"numba" Optional backend using Numba-compiled callbacks.
"jax" Optional backend using JAX arrays and transformations.

Notes

The alias includes every supported name, regardless of which optional packages are installed. Use available_backends to probe the current environment. Runtime name validation takes place when a backend is selected by set_backend or by entering use_backend.

Examples

from specular.backends import BackendName, set_backend

backend: BackendName = "numpy"
set_backend(backend)

See the backend user guide for installation and differences between the backends.

Source code.