2 releases
Uses new Rust 2024
| 0.1.1 | Mar 26, 2026 |
|---|---|
| 0.1.0 | Mar 26, 2026 |
#1377 in Algorithms
11KB
182 lines
The P-Square (P2) algorithm for dynamic calculation of quantiles without storing observations.
An implementation based on the algorithm described in this paper.
This algorithm calculates estimates for percentiles of observations sets dynamically, with a O(1) space complexity.
Examples
#
let mut p2 = P2::new(0.3);
for n in 1..=100 {
p2.feed(n as f64);
}
assert_eq!(p2.estimate(), 30.0);
P-Square
The P-Square (P2) algorithm for dynamic calculation of quantiles without storing observations.
See the paper for more about the algorithm.
See the documentation.
License
Licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT).