Struct nekolib::ds::BicrementalMedianDev
source · pub struct BicrementalMedianDev<M: CommutativeGroup>where
M::Set: Ord + Clone,{ /* private fields */ }
Expand description
中央値と偏差の管理。
多重集合 $S$ への要素の追加と削除を行いつつ、中央値と偏差を管理する。 ここで、偏差は中央値との絶対値の総和とする。 $S$ のうち小さい方から $\lceil|S|/2\rceil$ 個取り出したものを $L$、 残りの $\lfloor|S|/2\rfloor$ 個取り出したものを $R$ とする。 中央値を $L$ の最大値として定義し、$a_{\text{med}}$ と書く。 このとき、偏差 $\sigma$ は次のように書ける。 $$ \sigma = \sum_{a\in L} (a_{\text{med}}-a) + \sum_{a\in R} (a-a_{\text{med}}). $$ $\sum_{a\in L} a = \sigma_L$、$\sum_{a\in R} a = \sigma_R$ とすると、 $$ \begin{aligned} \sigma &= \begin{cases} -\sigma_L + \sigma_R, & \text{if } |L| = |R|; \\ -\sigma_L + \sigma_R + a_{\text{med}}, & \text{if } |L| = |R|+1. \\ \end{cases} \end{aligned} $$
Implementations§
source§impl<M: CommutativeGroup> BicrementalMedianDev<M>where
M::Set: Ord + Clone,
impl<M: CommutativeGroup> BicrementalMedianDev<M>where M::Set: Ord + Clone,
Trait Implementations§
source§impl<M: Clone + CommutativeGroup> Clone for BicrementalMedianDev<M>where
M::Set: Ord + Clone + Clone,
impl<M: Clone + CommutativeGroup> Clone for BicrementalMedianDev<M>where M::Set: Ord + Clone + Clone,
source§fn clone(&self) -> BicrementalMedianDev<M>
fn clone(&self) -> BicrementalMedianDev<M>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<M: Debug + CommutativeGroup> Debug for BicrementalMedianDev<M>where
M::Set: Ord + Clone + Debug,
impl<M: Debug + CommutativeGroup> Debug for BicrementalMedianDev<M>where M::Set: Ord + Clone + Debug,
source§impl<M: PartialEq + CommutativeGroup> PartialEq<BicrementalMedianDev<M>> for BicrementalMedianDev<M>where
M::Set: Ord + Clone + PartialEq,
impl<M: PartialEq + CommutativeGroup> PartialEq<BicrementalMedianDev<M>> for BicrementalMedianDev<M>where M::Set: Ord + Clone + PartialEq,
source§fn eq(&self, other: &BicrementalMedianDev<M>) -> bool
fn eq(&self, other: &BicrementalMedianDev<M>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<M: Eq + CommutativeGroup> Eq for BicrementalMedianDev<M>where M::Set: Ord + Clone + Eq,
impl<M: CommutativeGroup> StructuralEq for BicrementalMedianDev<M>where M::Set: Ord + Clone,
impl<M: CommutativeGroup> StructuralPartialEq for BicrementalMedianDev<M>where M::Set: Ord + Clone,
Auto Trait Implementations§
impl<M> RefUnwindSafe for BicrementalMedianDev<M>where M: RefUnwindSafe, <M as Magma>::Set: RefUnwindSafe,
impl<M> Send for BicrementalMedianDev<M>where M: Send, <M as Magma>::Set: Send,
impl<M> Sync for BicrementalMedianDev<M>where M: Sync, <M as Magma>::Set: Sync,
impl<M> Unpin for BicrementalMedianDev<M>where M: Unpin, <M as Magma>::Set: Unpin,
impl<M> UnwindSafe for BicrementalMedianDev<M>where M: UnwindSafe, <M as Magma>::Set: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more