Skip to content

numpy

EinMesher

Bases: _EinMesher

EinMesher bound to the NumPy backend. By default .mesh() will return NumPy arrays without needing to pass a backend.

Source code in src/einmesh/numpy.py
class EinMesher(_EinMesher):
    """
    EinMesher bound to the NumPy backend. By default `.mesh()` will return NumPy arrays
    without needing to pass a backend.
    """

    def __init__(self, pattern: str, **spaces: SpaceType) -> None:
        super().__init__(pattern, backend=NumpyBackend(), **spaces)

    def sample(self) -> np.ndarray[Any, Any] | tuple[np.ndarray[Any, Any], ...]:
        return super().sample()

einmesh(pattern, *unamed_spaces, **named_spaces)

Numpy einmesh function.

Source code in src/einmesh/numpy.py
def einmesh(
    pattern: str, *unamed_spaces: SpaceType, **named_spaces: SpaceType
) -> np.ndarray[Any, Any] | tuple[np.ndarray[Any, Any], ...]:
    """
    Numpy einmesh function.
    """
    return _einmesh(pattern, *unamed_spaces, backend=NumpyBackend(), **named_spaces)