Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-compute/src/ewm/mod.rs
7884 views
1
pub mod cov;
2
pub mod mean;
3
pub mod options;
4
use arrow::array::Array;
5
pub use cov::{EwmCovState, EwmStdState, EwmVarState, ewm_std, ewm_var};
6
pub use mean::{EwmMeanState, ewm_mean};
7
pub use options::EWMOptions;
8
9
pub trait EwmStateUpdate {
10
fn ewm_state_update(&mut self, values: &dyn Array) -> Box<dyn Array>;
11
}
12
13
#[cfg(test)]
14
macro_rules! assert_allclose {
15
($xs:expr, $ys:expr, $tol:expr) => {
16
assert!($xs.iter().zip($ys.iter()).all(|(x, z)| {
17
match (x, z) {
18
(Some(a), Some(b)) => (a - b).abs() < $tol,
19
(None, None) => true,
20
_ => false,
21
}
22
}));
23
};
24
}
25
26
#[cfg(test)]
27
use assert_allclose;
28
29