3 releases
0.1.2 | Nov 18, 2023 |
---|---|
0.1.1 | Oct 31, 2023 |
0.1.0 | Oct 31, 2023 |
#1002 in Math
Used in 4 crates
27KB
630 lines
lib.rs
:
The crate provides various mathematics solver:
- factory to create various type of sequences with map/fold OPs for derived sequences
- utility to calculate various Lp norm for n-dimension vectors
- utility to calculate various mean & average moving for n-dimension vectors
License
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT) at your option.
Usage
Add the following to your '''Cargo.toml''':
[dependencies]
hipparchus-mean = "0.1"
Example
Lp Norm
Here's an example to calculate L1 norm of a vector via hipparchus
:
use hipparchus_mean::LpNorm;
let v = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let norm = v.iter().l0norm().unwrap();
Below is a full list of all norm algorithms hipperchus
has supported:
Norm | Syntax | Feature |
---|---|---|
l0norm | - | L0 norm |
l1norm | - | L1 norm |
l2norm | - | L2 norm |
lpnorm | (f32) | Lp norm with p factor |
lpnorm_inf | - | Lp norm (p=inf) |
Mean & Moving Average
Here's an example to calculate the arithmetic mean of a vector via hipparchus
:
use hipparchus_mean::Mean;
let v = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let mean = v.iter().arithmetic_mean().unwrap();
Below is a full list of all mean algorithm hipperchus
has supported:
Mean | Syntax | Feature |
---|---|---|
ArithmeticMean | - | arithmetic mean |
GeometricMean | - | geometric mean |
QuadraticMean | - | quadratic mean |
HarmonicMean | - | harmonic mean |
SimpleMovingAverage | - | simple moving average |
CumulativeMovingAverage | - | cumulative moving average |
WeightedMovingAverage | - | weighted moving average |
ExponentialMovingAverage | (f32) | exponential moving average with decay |
Contributing
We welcome all people who want to contribute. Please see the contributing instructions for more information.
Contributions in any form (issues, pull requests, etc.) to this project must adhere to Rust's Code of Conduct.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in hipparchus-* by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~660KB
~13K SLoC