rhythmic-sequences-0.1.2.1: Library to deal with rhythmicity of short sequences
Copyright(c) Oleksandr Zhabenko 2022-2023
LicenseMIT
Maintaineroleksandr.zhabenko@yahoo.com
StabilityExperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010
ExtensionsBangPatterns

Rhythmicity.MarkerSeqs

Description

Data and algorithmic basics to evaluate rhythmicity of the lists of Ord instance data type. Similar to phonetic-languages-rhythmicity on Hackage.

Synopsis

Documentation

showBin :: Int -> [Char] Source #

The similar function is since base-4.16.0.0 in the Numeric module. Is not used further, is provided here mostly for testing purposes.

unionCount :: Bits a => a -> a -> Integer Source #

Basic counting of the same bits in the Bits arguments.

countWeightsQs :: Foldable t => [t a -> Int] -> [t a] -> [[Int]] Source #

Some idea function to evaluate the rhythmicity data. Is not used further in the package, can be thought of as an alternative way of computation.

data Sort2 a Source #

Data type used to provide somewhat 'array sorting with its indices'.

Constructors

S2 

Fields

Instances

Instances details
Functor Sort2 Source # 
Instance details

Defined in Rhythmicity.MarkerSeqs

Methods

fmap :: (a -> b) -> Sort2 a -> Sort2 b #

(<$) :: a -> Sort2 b -> Sort2 a #

Show a => Show (Sort2 a) Source # 
Instance details

Defined in Rhythmicity.MarkerSeqs

Methods

showsPrec :: Int -> Sort2 a -> ShowS #

show :: Sort2 a -> String #

showList :: [Sort2 a] -> ShowS #

Eq a => Eq (Sort2 a) Source # 
Instance details

Defined in Rhythmicity.MarkerSeqs

Methods

(==) :: Sort2 a -> Sort2 a -> Bool #

(/=) :: Sort2 a -> Sort2 a -> Bool #

Ord a => Ord (Sort2 a) Source # 
Instance details

Defined in Rhythmicity.MarkerSeqs

Methods

compare :: Sort2 a -> Sort2 a -> Ordering #

(<) :: Sort2 a -> Sort2 a -> Bool #

(<=) :: Sort2 a -> Sort2 a -> Bool #

(>) :: Sort2 a -> Sort2 a -> Bool #

(>=) :: Sort2 a -> Sort2 a -> Bool #

max :: Sort2 a -> Sort2 a -> Sort2 a #

min :: Sort2 a -> Sort2 a -> Sort2 a #

data ASort3 a Source #

Data type to contain the needed for hashing algorithm information about the sorted 'array sorting with its indices'.

Constructors

As3 

Fields

Instances

Instances details
Show a => Show (ASort3 a) Source # 
Instance details

Defined in Rhythmicity.MarkerSeqs

Methods

showsPrec :: Int -> ASort3 a -> ShowS #

show :: ASort3 a -> String #

showList :: [ASort3 a] -> ShowS #

Eq a => Eq (ASort3 a) Source # 
Instance details

Defined in Rhythmicity.MarkerSeqs

Methods

(==) :: ASort3 a -> ASort3 a -> Bool #

(/=) :: ASort3 a -> ASort3 a -> Bool #

splitF :: Int -> [a] -> [[a]] Source #

Split the list into lists of n elements where n is the first parameter.

getHashes2 Source #

Arguments

:: Ord a 
=> Int8

The period of the groups (the length of the lists into which the general sequence is splitted at first).

-> [Int8]

The list must be sorted in the descending order, the elements must be greater than -1 and less than the first argument here and there must not be repetitions in the list.

-> [a] 
-> [[Integer]] 

Function to get basic data for hash-based evaluation of the rhythmicity of the list data. Is used internally in the countHashesG. Provided here mostly for testing purposes.

countHashesPrioritized :: Bits b => [[b]] -> [[Integer]] Source #

Convert hashes into basic simler data to evaluate rhythmicity of the list data.

count1Hashes :: Ord a => Int8 -> [Int8] -> [a] -> Integer Source #

Mostly for testing.

data HashCorrections Source #

Data type to encode the changes that are introduced by the position of the group of values in general sequence to the general result of the createHashesG function. If the second parameter in the HashCorrections is 1 then the result is more sensitive to beginning of the line; if it is set to 2 then the result is more sensitive to ending of the line; if it is greater than 2 then the result is sensitive to some user weights provided as the first parameter to HashCorrections and otherwise the computation result does not depend on the first parameter to HashCorrections (this one can be considered the basic option for the computation).

Constructors

H [Int8] Int8 

hashList :: HashCorrections -> [Int8] Source #

If the second parameter in the HashCorrections is 1 then the result is more sensitive to beginning of the line; if it is set to 2 then the result is more sensitive to ending of the line; if it is greater than 2 then the result is sensitive to some user weights provided as the first parameter to HashCorrections and otherwise the computation result does not depend on the first parameter to HashCorrections (this one can be considered the basic option for the computation).

countHashesG Source #

Arguments

:: Ord a 
=> HashCorrections

Data that specifies how the arguments influence the result. Somewhat the kernel of the countHashesG computation.

-> Int8

The period of the length of the initial list.

-> [Int8]

List of ordinary positions of the maximum-minimum levels for values of the list in the group. The length of the unique elements together in the list is expected to be in the list [1..7].

-> [a] 
-> [Integer] 

General implementation of the hash-based algorithm to evaluate the level of rhythmicity of the list data. The relatively greater result (for PhLADiPreLiO) corresponds to greater detected periodicity.

createNewHash :: [Integer] -> Integer Source #

Provided for testing.

createHashG :: (Int8 -> [Integer] -> Integer) -> Int8 -> [Integer] -> Integer Source #

General implementation of the second hashing of the data for the algorithm.

createNHash :: [Int8] -> [Integer] -> Integer Source #

A variant of the createHashG that actually must be equal to the createNewHash for the second argument lists with less than 8 elements. For greater values is not correctly defined, so do not use it for the lists with 8 or more elements in them. Actually should be equal to createNewHash for the second argument.

idList :: Eq a => [Int8] -> [ASort3 a] -> [Int8] Source #

Function to filter the elements by the second parameter of the ASort3 data and then to get the first ones.

toNum :: [Int8] -> Integer Source #

Function to create bitwise representation of the intermediate data for the algorithm. Should be very optimized to run fast.

toNum2 :: [Int8] -> Integer Source #

The alternative implementation of the toNum (on the Linux x86_64 for some CPU is slower than the former one).