prysm.mathops

A submodule which imports and exports math functions from different libraries.

The intend is to make the backend for prysm interoperable, allowing users to utilize more high performance engines if they have them installed, or fall back to more widely available options in the case that they do not.

prysm.mathops.jit(signature_or_function=None, locals={}, target='cpu', cache=False, **options)

Passthrough duplicate of numba jit.

Parameters
  • signature_or_function (None, optional) – a function or signature to compile

  • locals (dict, optional) – local variables for the compiled code

  • target (str, optional) – architecture to compile for

  • cache (bool, optional) – whether to cache compilation to disk

  • **options – various options

Returns

a callable

Return type

callable

prysm.mathops.vectorize(signature_or_function=None, locals={}, target='cpu', cache=False, **options)

Passthrough duplicate of numba jit.

Parameters
  • signature_or_function (None, optional) – a function or signature to compile

  • locals (dict, optional) – local variables for the compiled code

  • target (str, optional) – architecture to compile for

  • cache (bool, optional) – whether to cache compilation to disk

  • **options – various options

Returns

a callable

Return type

callable

class prysm.mathops.MathEngine(source=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/prysm/envs/v0.16.1/lib/python3.7/site-packages/numpy/__init__.py'>)

Bases: object

An engine allowing an interchangeable backend for mathematical functions.

change_backend(backend)

Function to run when changing the backend.