Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Wavelet Matrix without index comperssion.
Synopsis
- data RawWaveletMatrix = RawWaveletMatrix {}
- buildRWM :: Int -> Vector Int -> RawWaveletMatrix
- accessRWM :: RawWaveletMatrix -> Int -> Int
- _goDownRWM :: RawWaveletMatrix -> Int -> Int -> Int -> (Int, Int, Int, Int)
- _goUpRWM :: RawWaveletMatrix -> Int -> Int -> Maybe Int
- kthMinRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int
- ikthMinRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe (Int, Int)
- kthMaxRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int
- ikthMaxRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe (Int, Int)
- unsafeKthMinRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int
- unsafeIKthMinRWM :: RawWaveletMatrix -> Int -> Int -> Int -> (Int, Int)
- unsafeKthMaxRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int
- unsafeIKthMaxRWM :: RawWaveletMatrix -> Int -> Int -> Int -> (Int, Int)
- freqLTRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int
- freqInRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int -> Int
- freqRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int
- findIndexRWM :: RawWaveletMatrix -> Int -> Maybe Int
- findKthIndexRWM :: RawWaveletMatrix -> Int -> Int -> Maybe Int
- lrFindIndexRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int
- lrFindKthIndexRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int -> Maybe Int
- lookupLERWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int
- lookupLTRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int
- lookupGERWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int
- lookupGTRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int
- _assocsWithRWM :: RawWaveletMatrix -> Int -> Int -> (Int -> Int) -> [(Int, Int)]
- _descAssocsWithRWM :: RawWaveletMatrix -> Int -> Int -> (Int -> Int) -> [(Int, Int)]
- assocsRWM :: RawWaveletMatrix -> Int -> Int -> [(Int, Int)]
- descAssocsRWM :: RawWaveletMatrix -> Int -> Int -> [(Int, Int)]
Documentation
data RawWaveletMatrix #
Wavelet Matrix without index comperssion.
RawWaveletMatrix | |
|
Instances
Show RawWaveletMatrix # | |
Defined in Data.WaveletMatrix.Raw showsPrec :: Int -> RawWaveletMatrix -> ShowS # show :: RawWaveletMatrix -> String # showList :: [RawWaveletMatrix] -> ShowS # | |
Eq RawWaveletMatrix # | |
Defined in Data.WaveletMatrix.Raw (==) :: RawWaveletMatrix -> RawWaveletMatrix -> Bool # (/=) :: RawWaveletMatrix -> RawWaveletMatrix -> Bool # |
buildRWM :: Int -> Vector Int -> RawWaveletMatrix #
\(O(N \log N)\) Creates a RawWaveletMatrix
.
nx
: The number of differentx
, starting from zero. In other words, everyx
is in \([0, nx)\).
kth min (safe)
_goDownRWM :: RawWaveletMatrix -> Int -> Int -> Int -> (Int, Int, Int, Int) #
\(O(\log a)\) Goes down the wavelet matrix for collecting kth minimum value.
_goUpRWM :: RawWaveletMatrix -> Int -> Int -> Maybe Int #
\(O(\log a)\) Goes up the wavelet matrix for collecting the value x
.
kthMinRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int #
\(O(\log a)\) Returns k-th (0-based) smallest number in [l, r]. Two different values are treated as separate values. Quantile with index.
ikthMinRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe (Int, Int) #
\(O(\log a)\)
kthMaxRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int #
\(O(\log a)\) Returns k-th (0-based) biggest number in [l, r]. Two different values are treated as separate values.
ikthMaxRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe (Int, Int) #
\(O(\log a)\)
kth min (no boundary check)
unsafeKthMinRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int #
\(O(\log a)\) Returns k-th (0-based) smallest number in [l, r]. Two different values are treated as separate values. Quantile with index.
unsafeIKthMinRWM :: RawWaveletMatrix -> Int -> Int -> Int -> (Int, Int) #
\(O(\log a)\)
unsafeKthMaxRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int #
\(O(\log a)\) Returns k-th (0-based) biggest number in [l, r]. Two different values are treated as separate values.
unsafeIKthMaxRWM :: RawWaveletMatrix -> Int -> Int -> Int -> (Int, Int) #
\(O(\log a)\)
Freq
freqLTRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int #
\(O(\log a)\) Returns the number of \(x s.t. x < \mathcal{upper} in [l .. r]\).
freqInRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int -> Int #
\(O(\log a)\) Returns the number of x in [l .. r] in [xl, xr].
freqRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int #
\(O(\log a)\) Returns the number of x in [l .. r].
Find index
findIndexRWM :: RawWaveletMatrix -> Int -> Maybe Int #
\(O(\log a)\) Finds index of x
. Select.
findKthIndexRWM :: RawWaveletMatrix -> Int -> Int -> Maybe Int #
\(O(\log a)\) Finds kth index of x
. Select.
lrFindIndexRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int #
\(O(\log a)\) Finds index of x
. Select.
lrFindKthIndexRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Int -> Maybe Int #
\(O(\log a)\) Finds kth index of x
. Select.
Lookup
lookupLERWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int #
\(O(\log a)\) Finds maximum \(x\) in \([l, r]\) s.t. \(x_{ref} \le x\).
lookupLTRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int #
\(O(\log a)\) Finds maximum \(x\) in \([l, r]\) s.t. \(x_{ref} \lt x\).
lookupGERWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int #
\(O(\log a)\) Finds minimum \(x\) in \([l, r]\) s.t. \(x_{ref} \gt x\).
lookupGTRWM :: RawWaveletMatrix -> Int -> Int -> Int -> Maybe Int #
\(O(\log a)\) Finds minimum \(x\) in \([l, r]\) s.t. \(x_{ref} \ge x\).
Associations of (freq, value)
_assocsWithRWM :: RawWaveletMatrix -> Int -> Int -> (Int -> Int) -> [(Int, Int)] #
\(O(\log A \min(|A|, L))\) Internal implementation of assocs
.
_descAssocsWithRWM :: RawWaveletMatrix -> Int -> Int -> (Int -> Int) -> [(Int, Int)] #
\(O(\log A \min(|A|, L))\) Internal implementation of descAssoc
.
assocsRWM :: RawWaveletMatrix -> Int -> Int -> [(Int, Int)] #
\(O(\log A \min(|A|, L))\) Collects \((x, freq)\) in range \([l, r]\) in ascending order of
x
. Be warned that it's very slow unless the domain \(A\) is very small.
descAssocsRWM :: RawWaveletMatrix -> Int -> Int -> [(Int, Int)] #
\(O(\log A \min(|A|, L))\) Collects \((x, freq)\) in range \([l, r]\) in descending order of
x
. Be warned that it's very slow unless the domain \(A\) is very small.