Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Sliding window data structures. See also SlideMin
.
Typical Problems
Synopsis
- data StackSlidingFold s a = StackSlidingFold {
- bufferSSF :: !(Buffer s a)
- bufferFoldSSF :: !(MVector s a)
- dualScanrSSF :: !(Buffer s a)
- newSSF :: (PrimMonad m, Monoid a, Unbox a) => Int -> m (StackSlidingFold (PrimState m) a)
- clearSSF :: (PrimMonad m, Monoid a, Unbox a) => StackSlidingFold (PrimState m) a -> m ()
- pushBackSSF :: (PrimMonad m, Semigroup a, Unbox a) => StackSlidingFold (PrimState m) a -> a -> m ()
- popFrontSSF :: (PrimMonad m, Monoid a, Unbox a) => StackSlidingFold (PrimState m) a -> m ()
- foldSSF :: (PrimMonad m, Semigroup a, Unbox a) => StackSlidingFold (PrimState m) a -> m a
- data DequeSlidingFold s a = DequeSlidingFold {
- frontBufferDSF :: !(Buffer s a)
- frontScanDSF :: !(Buffer s a)
- backBufferDSF :: !(Buffer s a)
- backScanDSF :: !(Buffer s a)
- newDSF :: (PrimMonad m, Monoid a, Unbox a) => Int -> m (DequeSlidingFold (PrimState m) a)
- clearDSF :: (PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m ()
- pushFrontDSF :: (HasCallStack, PrimMonad m, Semigroup a, Unbox a) => DequeSlidingFold (PrimState m) a -> a -> m ()
- pushBackDSF :: (HasCallStack, PrimMonad m, Semigroup a, Unbox a) => DequeSlidingFold (PrimState m) a -> a -> m ()
- popFrontDSF :: (HasCallStack, PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m ()
- popBackDSF :: (HasCallStack, PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m ()
- foldDSF :: (HasCallStack, PrimMonad m, Semigroup a, Unbox a) => DequeSlidingFold (PrimState m) a -> m a
- balanceDSF :: (HasCallStack, PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m ()
Documentation
data StackSlidingFold s a #
Stack-based sliding window folding, going from left to right only. SWAG (sliding window aggregation).
StackSlidingFold | |
|
pushBackSSF :: (PrimMonad m, Semigroup a, Unbox a) => StackSlidingFold (PrimState m) a -> a -> m () #
\(O(1)\)
popFrontSSF :: (PrimMonad m, Monoid a, Unbox a) => StackSlidingFold (PrimState m) a -> m () #
Amortised \(O(1)\).
data DequeSlidingFold s a #
Dequeue-based sliding window folding. Prefer StackSlidingFold
for speed.
SWAG (sliding window aggregation).
DequeSlidingFold | |
|
pushFrontDSF :: (HasCallStack, PrimMonad m, Semigroup a, Unbox a) => DequeSlidingFold (PrimState m) a -> a -> m () #
\(O(1)\)
pushBackDSF :: (HasCallStack, PrimMonad m, Semigroup a, Unbox a) => DequeSlidingFold (PrimState m) a -> a -> m () #
\(O(1)\)
popFrontDSF :: (HasCallStack, PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m () #
Amortised \(O(1)\).
popBackDSF :: (HasCallStack, PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m () #
Amortised \(O(1)\).
foldDSF :: (HasCallStack, PrimMonad m, Semigroup a, Unbox a) => DequeSlidingFold (PrimState m) a -> m a #
\(O(1)\)
balanceDSF :: (HasCallStack, PrimMonad m, Monoid a, Unbox a) => DequeSlidingFold (PrimState m) a -> m () #
\(O(N)\)