Struct curve_sampling::Param

source ·
pub struct Param<F> { /* private fields */ }
Expand description

Options for sampling the image of functions ℝ → ℝ². See Sampling::param.

Implementations§

Set the maximum number of evaluations of the function to build the sampling. Panic if n < 2.

Set the zone of interest for the sampling. Segments that end up outside this box will not be refined.

Add initial values of t such that f(t) (see [Sampling :: param]) must be included into the sampling in addition to the n evaluations. Only the values between a and b are taken into account (other values are ignored).

Add initial points (t, f(t)) to include into the sampling in addition to the n evaluations. This allows you to use previous evaluations of f. Only the couples with first coordinate t between a and b (see [Sampling :: param]) are considered (other values are ignored).

Return the sampling.

Examples found in repository?
examples/nice.rs (line 9)
7
8
9
10
11
12
13
14
15
16
fn main() -> Result<(), Box<dyn Error>> {
    let f = |t: f64| [t.cos(), (2. * t).sin()];
    let s = Sampling::param(f, 0., 2. * PI).build();
    s.write(&mut BufWriter::new(File::create("/tmp/nice1.dat")?))?;

    let f = |x: f64| (- x.powi(2)).exp();
    let s = Sampling::fun(f, -2.5, 2.5).n(53).build();
    s.write(&mut BufWriter::new(File::create("/tmp/nice2.dat")?))?;
    Ok(())
}

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.

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.