Function fixedpoint::fixedpoint
[−]
[src]
pub fn fixedpoint<T, U>(
func: &Fn(U, &T) -> U,
x0: U,
args: &T,
maxiter: Option<usize>,
maxval: Option<U>
) -> Result<U> where
U: PartialEq + PartialOrd + Copy + Debug,
Compute the fixed point of a given function
Given a function func
, compute the fixed point of the function such that func(x, args) = x
args
is a reference to any object that the function uses as auxillary data
maxiter
is used to limit the maximum number of iterations that the function will go through
before giving up. The default is 100.
If a maxval
is provided, then the fixedpoint computation will stop when the value of the
function exceeds maxval
. This is mostly useful in providing upper bounds on monotonic
functions.
The args
parameter is generic. So you can pass arbitrary data types to it that only the
provided function needs to know how to interpret. This allows you to pass a Option
, struct
,
Result
or any other type of complex object as well.