Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype SuffixArray a = SuffixArray {
- getSuffixArray :: Vector a
- indexSA :: Unbox a => SuffixArray a -> Int -> a
- findSubstringsSA :: ByteString -> SuffixArray Int32 -> ByteString -> Vector Int32
- buildSuffixArray :: ByteString -> SuffixArray Int32
- viewSuffixArray :: ByteString -> SuffixArray Int32 -> [String]
- class (Ord a, Num a, Integral a) => LSInt a where
- isLMS :: (LSInt a, LSInt b, Unbox a, Unbox b) => Vector a -> b -> Bool
- buildInitialBucket :: (LSInt a, Unbox a) => a -> Vector a -> Vector Int32
- findLMSIndices :: (LSInt a, Unbox a) => Vector a -> Vector Int
- induceSortL :: (LSInt a, LSInt b, Unbox a, Unbox b) => MVector s a -> MVector s Int32 -> Vector b -> Vector Int32 -> ST s ()
- induceSortS :: (LSInt a, LSInt b, Unbox a, Unbox b) => MVector s a -> MVector s Int32 -> Vector b -> Vector Int32 -> ST s ()
- reduceLMS :: (LSInt a, LSInt b, Unbox a, Unbox b) => MVector s a -> Vector b -> ST s (MVector s a, a, Vector a)
- neqLMS :: (LSInt a, LSInt b, Unbox a) => Vector a -> Int -> Int -> b
- sais :: (LSInt a, LSInt b, Unbox a, Unbox b) => MVector s b -> a -> Vector a -> ST s ()
Documentation
newtype SuffixArray a Source #
SuffixArray | |
|
Instances
(Show a, Unbox a) => Show (SuffixArray a) Source # | |
Defined in Data.ByteString.SuffixArray showsPrec :: Int -> SuffixArray a -> ShowS # show :: SuffixArray a -> String # showList :: [SuffixArray a] -> ShowS # | |
(Unbox a, Eq a) => Eq (SuffixArray a) Source # | |
Defined in Data.ByteString.SuffixArray (==) :: SuffixArray a -> SuffixArray a -> Bool # (/=) :: SuffixArray a -> SuffixArray a -> Bool # |
indexSA :: Unbox a => SuffixArray a -> Int -> a Source #
findSubstringsSA :: ByteString -> SuffixArray Int32 -> ByteString -> Vector Int32 Source #
O(Tlog S)
>>>
:set -XOverloadedStrings
>>>
bs = "ababab"
>>>
sa = buildSuffixArray bs
>>>
findSubstringsSA bs sa "ab"
[4,2,0]>>>
findSubstringsSA bs sa "xxx"
[]>>>
findSubstringsSA bs sa ""
[6,4,2,0,5,3,1]
buildSuffixArray :: ByteString -> SuffixArray Int32 Source #
SA-IS O(n)
>>>
:set -XOverloadedStrings
>>>
buildSuffixArray "aaa"
[3,2,1,0]>>>
buildSuffixArray "mississippi"
[11,10,7,4,1,0,9,8,6,3,5,2]>>>
buildSuffixArray "abracadabra"
[11,10,7,0,3,5,8,1,4,6,9,2]>>>
buildSuffixArray "ababab"
[6,4,2,0,5,3,1]>>>
buildSuffixArray ""
[0]>>>
buildSuffixArray "sentinel\0"
[-1,8,6,1,4,7,5,2,0,3]
viewSuffixArray :: ByteString -> SuffixArray Int32 -> [String] Source #
>>>
:set -XOverloadedStrings
>>>
viewSuffixArray "abc" $ buildSuffixArray "abc"
["","abc","bc","c"]>>>
viewSuffixArray " a b c" $ buildSuffixArray " a b c"
[""," a b c"," b c"," c","a b c","b c","c"]
class (Ord a, Num a, Integral a) => LSInt a where Source #
sentinelLS :: a Source #
buildInitialBucket :: (LSInt a, Unbox a) => a -> Vector a -> Vector Int32 Source #
findLMSIndices :: (LSInt a, Unbox a) => Vector a -> Vector Int Source #
induceSortL :: (LSInt a, LSInt b, Unbox a, Unbox b) => MVector s a -> MVector s Int32 -> Vector b -> Vector Int32 -> ST s () Source #
induceSortS :: (LSInt a, LSInt b, Unbox a, Unbox b) => MVector s a -> MVector s Int32 -> Vector b -> Vector Int32 -> ST s () Source #