Copyright | (c) OleksandrZhabenko 2020-2023 |
---|---|
License | MIT |
Maintainer | oleksandr.zhabenko@yahoo.com |
Stability | Experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Extensions |
|
Provides several the most important variants of constraints for the
permutations. All the Array
here must consists of unique Int
starting from 0 to n-1 and the Int
arguments must be in the range [0..n-1] though these inner constraints are
not checked. It is up to user to check them.
Uses arrays instead of vectors.
The word "unsafe" in the names means that there is no checking whether the arguments are
within the elements of the arrays, this checking is intended to be done elsewhere before applying
the functions here. Without such a checking the result are meaningless.
Synopsis
- unsafeOrderIJ :: Int -> Int -> Array Int Int -> Bool
- unsafeSignDistanceIJ :: Int -> Int -> Int -> Array Int Int -> Bool
- unsafeUnsignDistanceIJ :: Int -> Int -> Int -> Array Int Int -> Bool
- isSignDistIJK3 :: Int -> Int -> Int -> Int -> Int -> Array Int Int -> Bool
- isUnsignDistIJK3 :: Int -> Int -> Int -> Int -> Int -> Array Int Int -> Bool
- isMixedDistIJK3 :: Int -> Int -> Int -> Int -> Int -> Array Int Int -> Bool
- isTripleOrdered :: Int -> Int -> Int -> Array Int Int -> Bool
- isQuadrupleOrdered :: Int -> Int -> Int -> Int -> Array Int Int -> Bool
- isSeveralAOrdered :: Int -> Array Int Int -> Array Int Int -> Bool
- isSeveralBOrdered :: Int -> Array Int Int -> Array Int Int -> Bool
- isFixedPointTup :: Array Int (Int, Int) -> Array Int Int -> Bool
- isFixedPoint :: Array Int Int -> Array Int Int -> Bool
- notSignDistIJK3 :: Int -> Int -> Int -> Int -> Int -> Array Int Int -> Bool
- notUnsignDistIJK3 :: Int -> Int -> Int -> Int -> Int -> Array Int Int -> Bool
- notMixedDistIJK3 :: Int -> Int -> Int -> Int -> Int -> Array Int Int -> Bool
- notTripleOrdered :: Int -> Int -> Int -> Array Int Int -> Bool
- notQuadrupleOrdered :: Int -> Int -> Int -> Int -> Array Int Int -> Bool
- notSeveralAOrdered :: Int -> Array Int Int -> Array Int Int -> Bool
- notSeveralBOrdered :: Int -> Array Int Int -> Array Int Int -> Bool
- notFixedPointTup :: Array Int (Int, Int) -> Array Int Int -> Bool
- notFixedPoint :: Array Int Int -> Array Int Int -> Bool
- filterOrderIJ :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> t (Array Int Int) -> t (Array Int Int)
- unsafeTriples :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int)
- unsafeQuadruples :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int)
- unsafeSeveralA :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Array Int Int -> t (Array Int Int) -> t (Array Int Int)
- unsafeSeveralB :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Array Int Int -> t (Array Int Int) -> t (Array Int Int)
- fixedPointsG :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Array Int (Int, Int) -> t (Array Int Int) -> t (Array Int Int)
- fixedPointsS :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Array Int Int -> t (Array Int Int) -> t (Array Int Int)
- filterSignDistanceIJ :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int)
- filterUnsignDistanceIJ :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int)
- filterSignDistanceIJK3 :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int)
- filterUnsignDistanceIJK3 :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int)
- filterMixedDistanceIJK3 :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int)
Predicates
unsafeOrderIJ :: Int -> Int -> Array Int Int -> Bool Source #
Being given the data satisfying the constraints in the module header checks whether in the Array
the first argument stands before the second one.
:: Int | |
-> Int | |
-> Int | Can be of both signs, but not equal to 0. The positive value gives |
-> Array Int Int | |
-> Bool |
Being given the data satisfying the constraints in the module header checks whether in the
Array
the distance between positions of the first two arguments values is equal to the signed
third argument.
unsafeUnsignDistanceIJ Source #
:: Int | |
-> Int | |
-> Int | Only for positive values can give |
-> Array Int Int | |
-> Bool |
Being given the data satisfying the constraints in the module header checks whether in the
Array
the distance between positions of the first two arguments values is equal to the unsigned
third argument. The following is true: if unsafeSignDistanceIJ
i
j
d
array
== True
then
unsafeUnsignDistanceIJ
i
j
d
array
== True
, but not necessarily vice versa.
Functions to work with permutations with basic constraints (Array
-based)
filterOrderIJ :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header returns the elements that satisfy unsafeOrderIJ
as a predicate.
unsafeTriples :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header reduces the number of further computations in the foldable structure of
the permutations each one being represented as Array
Int
Int
where the elements are all the numbers in the range [0..n-1] without duplication if the
arguments are the indeces of the duplicated words or their concatenated combinations in the corresponding line.
The first three arguments
are the indices of the the triple duplicated elements (words or their concatenated combinations in the phonetic-languages
series of packages).
unsafeQuadruples :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header reduces the number of further computations in the foldable structure of
the permutations each one being represented as Array
Int
Int
where the elements are all the numbers in the range [0..n-1] without duplication if the
arguments are the indeces of the duplicated words or their concatenated combinations in the corresponding line.
The first four arguments
are the indices of the the quadruple duplicated elements (words or their concatenated combinations in the phonetic-languages
series of packages).
With multiple elements specified
unsafeSeveralA :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Array Int Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header reduces the number of further computations in the foldable structure of
the permutations each one being represented as Array
Int
Int
where the elements are all the numbers in the range [0..n-1] without duplication.
The first argument
is the index of the the element (a word or their concatenated combination in the phonetic-languages
series of packages), the second argument
is Array
Int
of indices that are in the range [0..n-1]. Filters (and reduces further complex computations) the permutations so that only the
variants with the indices in the second argument all stand AFTER the element with the index equal to the first argument.
unsafeSeveralB :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Array Int Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header reduces the number of further computations in the foldable structure of
the permutations each one being represented as Array
Int
Int
where the elements are all the numbers in the range [0..n-1] without duplication.
The first argument
is the index of the the element (a word or their concatenated combination in the phonetic-languages
series of packages), the second argument
is Array
of indices that are in the range [0..n-1]. Filters (and reduces further complex computations) the permutations so that only the
variants with the indices in the second argument all stand BEFORE the element with the index equal to the first argument.
With fixed points
fixedPointsG :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Array Int (Int, Int) -> t (Array Int Int) -> t (Array Int Int) Source #
Reduces the number of permutations using filtering leaving just those ones permutations where elements on the
first elements in the tuples in the first argument Array
places are moved to the places indexed with the second
elements in the tuples respectively.
fixedPointsS :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Array Int Int -> t (Array Int Int) -> t (Array Int Int) Source #
A simplified variant of the fixedPointsG
function where the specified elements stay on their place and that is
why are 'fixed points' in the permutation specified.
Distances between elements
filterSignDistanceIJ :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header returns the elements that satisfy unsafeSignDistanceIJ
as a predicate.
filterUnsignDistanceIJ :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header returns the elements that satisfy unsafeUnsignDistanceIJ
as a predicate.
filterSignDistanceIJK3 :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header returns the elements that pairwisely (1 and 2, 2 and 3) satisfy unsafeSignDistanceIJ
as a predicate.
filterUnsignDistanceIJK3 :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header returns the elements that pairwisely (1 and 2, 2 and 3) satisfy unsafeUnsignDistanceIJ
as a predicate.
filterMixedDistanceIJK3 :: (InsertLeft t (Array Int Int), Monoid (t (Array Int Int))) => Int -> Int -> Int -> Int -> Int -> t (Array Int Int) -> t (Array Int Int) Source #
Being given the data satisfying the constraints in the module header returns the elements that satisfy both unsafeSignDistanceIJ
with the 1st, 2nd and 4th arguments and unsafeUnsignDistanceIJ
with the 2nd, 3rd and 5th arguments as predicates.