iota-0.1.0.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.ByteString.SuffixArray

Synopsis

Documentation

newtype SuffixArray a Source #

Constructors

SuffixArray 

Fields

Instances

Instances details
(Show a, Unbox a) => Show (SuffixArray a) Source # 
Instance details

Defined in Data.ByteString.SuffixArray

(Unbox a, Eq a) => Eq (SuffixArray a) Source # 
Instance details

Defined in Data.ByteString.SuffixArray

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 #

Minimal complete definition

isL, isS, unLS, setLS

Methods

isL :: a -> Bool Source #

isS :: a -> Bool Source #

unLS :: a -> a Source #

setLS :: a -> a -> a Source #

sentinelLS :: a Source #

isLMS :: (LSInt a, LSInt b, Unbox a, Unbox b) => Vector a -> b -> Bool 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 #

reduceLMS :: (LSInt a, LSInt b, Unbox a, Unbox b) => MVector s a -> Vector b -> ST s (MVector s a, a, Vector a) Source #

neqLMS :: (LSInt a, LSInt b, Unbox a) => Vector a -> Int -> Int -> b Source #

sais Source #

Arguments

:: (LSInt a, LSInt b, Unbox a, Unbox b) 
=> MVector s b

filled with (-1)

-> a

the maximum alphabet

-> Vector a

LS typed

-> ST s ()