desc.integrals.Bounce1D.batch
- static Bounce1D.batch(fun, data, grid, *, names=(), custom_data=None, flux_data=None, batch_size=1, sparse=True)Source
Compute function
funbatched over flux surfaces.You may want to also JIT compile your code which calls this utility method.
Examples
desc/compute/_old.py
- Parameters:
fun (callable) – A function which takes a single argument
fun_dataand computes bounce integrals assumingfun_dataholds all required quantities to construct aBounce1Doperator as well as call its methods.data (dict[str, jnp.ndarray]) – Data dictionary with the same structure as the data returned by the functions in
desc.compute. Must contain the quantities inBounce1D.required_names,min_tz |B|,max_tz |B|, and any entries requested bynames.grid (Grid) – Grid on which
datawas computed.names (tuple[str]) – Optional, things in
datathat are not constant on each flux surface. These will be passed tofunin batches.custom_data (dict[str, jnp.ndarray]) – Optional, other data that is not constant on each flux surface. These will be passed to
funin batches.flux_data (dict[str, jnp.ndarray]) – Optional, other data constant on each flux surface. These will be passed to
funas a scalar for each surface. All arrays must have dimension one.batch_size (int or None) – Number of flux surfaces to compute simultaneously. Default is
1.sparse (bool) – Whether to use sparsity preserving pullbacks. Default is
True, which makes the most sense if the output has shape (num rho, ). Otherwise, if the output shape is larger, and the final objective of interest is a lower dimensional quantity than the output, it may be preferable to delay the vjp by setting toFalse.
- Returns:
The output
fun(fun_data).