function#
import tensorwaves.function
Express mathematical expressions in terms of computational functions.
- class PositionalArgumentFunction(function: Callable[..., ndarray], argument_order: Iterable[str])[source]#
Bases:
Function
[dict
[str
,ndarray
],ndarray
]Wrapper around a function with positional arguments.
This class provides a
__call__()
that can take aDataSample
for a function with positional arguments. Itsargument_order
redirect the keys in theDataSample
to the argument positions in its underlyingfunction
.See also
- class ParametrizedBackendFunction(function: Callable[..., ndarray], argument_order: Iterable[str], parameters: Mapping[str, ParameterValue])[source]#
Bases:
ParametrizedFunction
[dict
[str
,ndarray
],ndarray
]Implements
ParametrizedFunction
for a specific computational back-end.See also
- update_parameters(new_parameters: Mapping[str, ParameterValue]) None [source]#
Update the collection of parameters.
- get_source_code(function: Function) str [source]#
Get the backend source code used to compile this function.
>>> import sympy as sp >>> from tensorwaves.function.sympy import create_function >>> x, y = sp.symbols("x y") >>> expr = x**2 + y**2 >>> func = create_function(expr, backend="jax", use_cse=False) >>> src = get_source_code(func) >>> print(src) def _lambdifygenerated(x, y): return x**2 + y**2
Submodules and Subpackages