expand_bound#
- sionna.phy.utils.expand_bound(f: Callable, bound: torch.Tensor, side: str, step_expand: float = 2.0, max_n_iter: int = 100, precision: str | None = None, **kwargs) torch.Tensor[source]#
Expands the left (right, respectively) search interval end point until the function
fbecomes positive (negative, resp.)- Parameters:
f (Callable) – Generic function handle that takes batched inputs and returns batched outputs. Applies a different decreasing univariate function to each of its inputs. Must accept input batches of the same shape as
leftandright.bound (torch.Tensor) – […], torch.float. Left (if
sideis ‘left’) or right (ifsideis ‘right’) end point of the initial search interval, for each batch.side (str) – ‘left’ | ‘right’. See
bound.step_expand (float) – Geometric progression factor at which the bound is expanded. Must be higher than 1.
max_n_iter (int) – Maximum number of iterations.
precision (str | None) – Precision used for internal calculations and outputs. If set to None,
precisionis used.kwargs – Additional arguments for function
f.
- Outputs:
bound – […], torch.float. Final value of expanded bound.
Examples
import torch from sionna.phy.utils.numerics import expand_bound # Define a decreasing univariate function of x def f(x): return -x + 1.0 # Expand right bound until f becomes negative bound = torch.tensor(0.5) result = expand_bound(f, bound, side='right', step_expand=2.0) print(result)