pub struct IterativeParams { /* private fields */ }
Expand description

The parameters of an iterative variable

This parameters are used by the step_limitation() method from the Iterative trait to reduce the size of a step

Implementations

The parameters are used by the step_limitation() method from the Iterative trait to reduce the size of a step

Both value max_step_abs and max_step_rel must be positive

The min_value must be lower than the max_value

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Formats the value using the given formatter. Read more

Compute a limited update step

The step size is reduced according to the following criteria :

 abs(step_size) < max_step_abs
 abs(step_size) < max_step_rel*abs(iterative_value)

Also, the step must not violated the constraints on the min_value and max_value of the iterative variable.

Warning: setting the parameters max_step_rel to a value different from infinity might lead to very reduced step size if the iterative value is near zero.

Examples
use newton_rootfinder as nrf;
use nrf::iteratives::*;

let (max_step_abs, max_step_rel, min_value, max_value) = (1.0, 1.0, f64::NEG_INFINITY, f64::INFINITY);
let mut iterative_var = IterativeParams::new(max_step_abs, max_step_rel, min_value, max_value);
assert_eq!(iterative_var.step_limitation(1.0, 1.0), 2.0);
assert_eq!(iterative_var.step_limitation(1.0, 3.0), 2.0);

let (max_step_abs, max_step_rel, min_value, max_value) = (0.1, 0.5, f64::NEG_INFINITY, f64::INFINITY);
let mut iterative_var = IterativeParams::new(max_step_abs, max_step_rel, min_value, max_value);
assert_eq!(iterative_var.step_limitation(1.5, 0.5), 1.6);
assert_eq!(iterative_var.step_limitation(0.1, 3.0), 0.15000000000000002);
Compute the perturbation (only valid if it is working with finite differences) Read more
Method to differente without panicking if it is working with finite differences
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.