false_position
- torchdr.false_position(f, n, begin=None, end=None, max_iter=1000, tol=1e-09, verbose=False, dtype=torch.float64, device='cpu')[source]
Implement the false position root finding method.
Perform a batched false position method to find the root of an increasing function f. The domain of f is restricted to positive floats.
- Parameters:
f (function \(\mathbb{R}_{>0} \to \mathbb{R}\)) – increasing function which root should be computed.
n (int) – size of the input of f.
begin (torch.Tensor of shape (n) or float, optional) – initial lower bound of the root.
end (torch.Tensor of shape (n) or float, optional) – initial upper bound of the root.
max_iter (int, optional) – maximum iterations of search.
tol (float, optional) – precision threshold at which the algorithm stops.
verbose (bool, optional) – if True, prints current bounds.
dtype (torch.dtype, optional) – data type of the input.
device (str, optional) – device on which the computation is performed.
- Returns:
m – root of f.
- Return type:
torch.Tensor of shape (n)