pcw_fn

Crates.iopcw_fn
lib.rspcw_fn
version0.2.1
sourcesrc
created_at2023-01-22 12:07:30.99747
updated_at2023-01-23 14:36:53.152263
descriptionGeneric piecewise function trait and impls.
homepage
repositoryhttps://github.com/SV-97/pcw_fn/
max_upload_size
id764959
size57,406
Stefan V. (SV-97)

documentation

README

Generic piecewise function trait and impls

pcw_fn is a library for handling piecewise defined functions (or other "piecewise data") generically.

Currently the PcwFn trait the library is built around is implemented for a single type: VecPcwFn. This type represents a piecewise function f given by a collection of jump positions and functions such that

       ╭ f₁(x)   if      x < x₀
       │ f₂(x)   if x₀ ≤ x < x₁
f(x) = ┤ f₃(x)   if x₁ ≤ x < x₂
       │  ⋮               ⋮
       ╰ fₙ(x)   if xₙ ≤ x

for all x ∈ X where f₁,...,fₙ : X -> Y, and x₀ < x₁ < ... < xₙ from some strictly totally ordered set X (so X is Ord). Note that for most functionality it's not required that the funcs actually behave like a function so the type can be used very well for "non-functional" funcs.

It's trivial to add impls backed by other types like SmallVec or StaticVec.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 7

cargo fmt