Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type Orbit a = Vector a
- data Permutation a = Permutation {}
- orbits :: forall a a. Lens (Permutation a) (Permutation a) (Vector (Orbit a)) (Vector (Orbit a))
- indexes :: forall a. Lens' (Permutation a) (Vector (Int, Int))
- elems :: Permutation a -> Vector a
- size :: Permutation a -> Int
- cycleOf :: Enum a => Permutation a -> a -> Orbit a
- next :: Vector v a => v a -> Int -> a
- lookupIdx :: Enum a => Permutation a -> a -> (Int, Int)
- apply :: Enum a => Permutation a -> a -> a
- orbitFrom :: Eq a => a -> (a -> a) -> [a]
- cycleRep :: (Vector v a, Enum a, Eq a) => v a -> (a -> a) -> Permutation a
- toCycleRep :: Enum a => Int -> [[a]] -> Permutation a
- genIndexes :: Enum a => Int -> [[a]] -> Vector (Int, Int)
- ix' :: (Vector v a, Index (v a) ~ Int, IxValue (v a) ~ a, Ixed (v a)) => Int -> Lens' (v a) a
Documentation
data Permutation a Source #
Cyclic representation of a permutation.
Functor Permutation Source # | |
Foldable Permutation Source # | |
Traversable Permutation Source # | |
Eq a => Eq (Permutation a) Source # | |
Show a => Show (Permutation a) Source # | |
orbits :: forall a a. Lens (Permutation a) (Permutation a) (Vector (Orbit a)) (Vector (Orbit a)) Source #
elems :: Permutation a -> Vector a Source #
size :: Permutation a -> Int Source #
lookupIdx :: Enum a => Permutation a -> a -> (Int, Int) Source #
Lookup the indices of an element, i.e. in which orbit the item is, and the index within the orbit.
runnign time: \(O(1)\)
apply :: Enum a => Permutation a -> a -> a Source #
Apply the permutation, i.e. consider the permutation as a function.
orbitFrom :: Eq a => a -> (a -> a) -> [a] Source #
Find the cycle in the permutation starting at element s
toCycleRep :: Enum a => Int -> [[a]] -> Permutation a Source #
Given the size n, and a list of Cycles, turns the cycles into a cyclic representation of the Permutation.