intervalues
Efficient combining of (valued) intervals of numbers for various applications.
Installing
Alternatively, you can edit your Cargo.toml
directly and run cargo update
:
[]
= "0.2.0"
Getting started
A simple example to show how two valued intervals can be combined. In this case, one interval is on the interval [0, 2] with a value of 1, and the other interval is on the interval [1, 3] with a value of 2. The result of combining is three intervals: [0, 1] with a value of 1, [1, 2] with a value of 3, and [2, 3] with a value of 2. (Note that for now the distinction between open and closed intervals is ignored.)
use HashMap;
use intervalues;
// Two intervals, from 0 to 2 with count 1 and 1 to 3 with count 2
let input: = vec!;
let out: = combine_intervals_values;
// 'out' = {(0, 1): 1, (2, 3): 2, (1, 2): 3}
assert_eq!;
assert_eq!;
assert_eq!;
See the docs for more functions and details.
Motivation & goal
This package is the Rust implementation of the Python package intervalues. The Python package contains organizational functionality around a core interval combination algorithm. In order to explore speeding up this algorithm, this Rust implementation has been started. For now, the main goal is on coming to a stable implementation for that core implementation, but reimplementing some of the convenience wrappers is open to discussion. Feel free to let me know if that would interest you!
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.