phonetic-languages-permutations-array 0.1.0.0 → 0.2.0.0
raw patch · 4 files changed
+76/−5 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Phonetic.Languages.Permutations.ArrMini: genPairwisePermutations :: Int -> Array Int [Int]
+ Phonetic.Languages.Permutations.ArrMini: genPairwisePermutationsArr :: Array Int (Array Int [Int])
+ Phonetic.Languages.Permutations.ArrMini: genPairwisePermutationsArrL :: Array Int [Array Int Int]
+ Phonetic.Languages.Permutations.ArrMini: genPairwisePermutationsArrLN :: Int -> Array Int [Array Int Int]
+ Phonetic.Languages.Permutations.ArrMini: genPairwisePermutationsArrN :: Int -> Array Int (Array Int [Int])
+ Phonetic.Languages.Permutations.ArrMini: genPairwisePermutationsL :: [Array Int Int]
+ Phonetic.Languages.Permutations.ArrMini: genPairwisePermutationsLN :: Int -> [Array Int Int]
+ Phonetic.Languages.Permutations.ArrMini: pairsSwapP :: [Int] -> [[Int]]
Files
- CHANGELOG.md +4/−0
- Phonetic/Languages/Permutations/Arr.hs +3/−3
- Phonetic/Languages/Permutations/ArrMini.hs +67/−0
- phonetic-languages-permutations-array.cabal +2/−2
CHANGELOG.md view
@@ -3,3 +3,7 @@ ## 0.1.0.0 -- 2020-12-31 * First version. Released on an unsuspecting world.++## 0.2.0.0 -- 2021-10-02++* Second version. Added module Phonetic.Languages.Permutations.ArrMini with pairwise permutations related functionality.
Phonetic/Languages/Permutations/Arr.hs view
@@ -1,11 +1,11 @@ -- | -- Module : Phonetic.Languages.Permutations.Arr--- Copyright : (c) OleksandrZhabenko 2020+-- Copyright : (c) OleksandrZhabenko 2020-2021 -- License : MIT -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com ----- Permutation and universal set functions for the phonetic-languages series of packages. This+-- Permutations and universal set functions for the phonetic-languages series of packages. This -- module uses no vectors, but instead uses arrays. module Phonetic.Languages.Permutations.Arr (@@ -22,7 +22,7 @@ import qualified Data.Foldable as F (concat,foldr',foldl') import Data.Monoid --- | A key point of the evaluation -- the universal set of the task represented as a 'VB.Vector' of 'VB.Vector' of @a@. Because the order is not+-- | A key point of the evaluation -- the universal set of the task represented as a @[[a]]@. universalSetGL :: (Eq a, Foldable t, InsertLeft t a, Monoid (t a), Monoid (t (t a))) => t a -> t (t a)
+ Phonetic/Languages/Permutations/ArrMini.hs view
@@ -0,0 +1,67 @@+-- |+-- Module : Phonetic.Languages.Permutations.ArrMini+-- Copyright : (c) OleksandrZhabenko 2021+-- License : MIT+-- Stability : Experimental+-- Maintainer : olexandr543@yahoo.com+--+-- Special permutations functions for the phonetic-languages series of packages. This+-- module uses no vectors, but instead uses arrays.++module Phonetic.Languages.Permutations.ArrMini (+ genPairwisePermutations+ , pairsSwapP+ , genPairwisePermutationsArrN+ , genPairwisePermutationsArr+ , genPairwisePermutationsLN+ , genPairwisePermutationsL+ , genPairwisePermutationsArrLN+ , genPairwisePermutationsArrL+) where++import GHC.Arr++genPairwisePermutations :: Int -> Array Int [Int]+genPairwisePermutations n = listArray (0,(n*(n-1)) `quot` 2) . pairsSwapP . take n $ [0..]+{-# INLINE genPairwisePermutations #-}++pairsSwapP :: [Int] -> [[Int]]+pairsSwapP xs = xs:[swap2Ls k m xs | k <- xs, m <- xs , k < m]+{-# INLINABLE pairsSwapP #-}++-- | The first two arguments are considered not equal, though it is not checked.+swap2ns :: Int -> Int -> Int -> Int+swap2ns k m n+ | n /= k = if n /= m then n else k+ | otherwise = m+{-# INLINE swap2ns #-}++swap2Ls :: Int -> Int -> [Int] -> [Int]+swap2Ls k m = map (swap2ns k m)+{-# INLINE swap2Ls #-}++genPairwisePermutationsArrN :: Int -> Array Int (Array Int [Int])+genPairwisePermutationsArrN n = amap genPairwisePermutations . listArray (0,n - 2) $ [2..n]+{-# INLINE genPairwisePermutationsArrN #-}++genPairwisePermutationsArr :: Array Int (Array Int [Int])+genPairwisePermutationsArr = genPairwisePermutationsArrN 7+{-# INLINE genPairwisePermutationsArr #-}++genPairwisePermutationsLN :: Int -> [Array Int Int]+genPairwisePermutationsLN n = map (\xs -> listArray (0,n - 1) xs) . pairsSwapP . take n $ [0..]+{-# INLINE genPairwisePermutationsLN #-}++genPairwisePermutationsL :: [Array Int Int]+genPairwisePermutationsL = genPairwisePermutationsLN 7+{-# INLINE genPairwisePermutationsL #-}++genPairwisePermutationsArrLN :: Int -> Array Int [Array Int Int]+genPairwisePermutationsArrLN n = amap genPairwisePermutationsLN . listArray (0,n - 2) $ [2..n]+{-# INLINE genPairwisePermutationsArrLN #-}++genPairwisePermutationsArrL :: Array Int [Array Int Int]+genPairwisePermutationsArrL = genPairwisePermutationsArrLN 7+{-# INLINE genPairwisePermutationsArrL #-}++
phonetic-languages-permutations-array.cabal view
@@ -2,7 +2,7 @@ -- For further documentation, see http://haskell.org/cabal/users-guide/ name: phonetic-languages-permutations-array-version: 0.1.0.0+version: 0.2.0.0 synopsis: Permutations and universal set related functions for the phonetic-languages series description: Permutations-related to produce universal set of the task. Uses arrays instead of vectors. homepage: https://hackage.haskell.org/package/phonetic-languages-permutations-array@@ -17,7 +17,7 @@ cabal-version: >=1.10 library- exposed-modules: Phonetic.Languages.Permutations.Arr+ exposed-modules: Phonetic.Languages.Permutations.Arr, Phonetic.Languages.Permutations.ArrMini -- other-modules: -- other-extensions: build-depends: base >=4.8 && <4.15, subG >=0.4.2 && <1