Skip to content

Lambda function

flowMC.strategy.lambda_function ¤

Lambda ¤

Bases: Strategy

A strategy that applies a function to the resources.

This should be used for simple functions or calling methods from a class. If you find yourself writing a Lambda strategy that is more than a few lines long, consider writing a custom strategy instead.

lambda_function = lambda_function instance-attribute ¤
__init__(lambda_function: Callable) ¤

Initialize the lambda strategy.

Parameters:

Name Type Description Default
lambda_function Callable

A callable that takes a resource and applies the lambda function.

required
__call__(rng_key: Key, resources: dict[str, Resource], initial_position: Float[Array, 'n_chains n_dim'], data: dict) -> tuple[Key, dict[str, Resource], Float[Array, 'n_chains n_dim']] ¤