packages feed

sym 0.1 → 0.1.1

raw patch · 3 files changed

+24/−13 lines, 3 files

Files

Math/Sym.hs view
@@ -79,7 +79,7 @@ toVector :: StPerm -> Vector Int toVector = perm0 --- | Convert a vector to a standard permutation. The vector should a+-- | Convert a vector to a standard permutation. The vector should be a -- permutation of the elements @[0..k-1]@ for some positive @k@. No -- checks for this are done. fromVector :: Vector Int -> StPerm@@ -98,7 +98,7 @@ infixl 6 /-/  -- | The /skew sum/ of two permutations. (A definition of the--- /direct sum/ is provided by the Monoid instance.)+-- /direct sum/ is provided by 'mappend' of the 'Monoid' instance for 'StPerm'.) (/-/) :: StPerm -> StPerm -> StPerm u /-/ v = fromVector $ (SV.++) u' v'     where@@ -126,8 +126,7 @@  -- | The class of permutations. Minimal complete definition: 'st' and -- 'act'. The default implementations of 'size' and 'idperm' can be--- somewhat slow, so you may want to consider implementing them as--- well.+-- somewhat slow, so you may want to implement them as well. class Perm a where      -- | The standardization map. If there is an underlying linear
Math/Sym/D8.hs view
@@ -43,44 +43,51 @@ import qualified Math.Sym (inverse) import Math.Sym.Internal (revIdperm) + -- The group elements -- ------------------ -r0, r1, r2, r3, s0, s1, s2, s3 :: Perm a => a -> a- -- | Ration by 0 degrees, i.e. the identity map.+r0 :: Perm a => a -> a r0 w = w  -- | Ration by 90 degrees clockwise.+r1 :: Perm a => a -> a r1 = s2 . s1  -- | Ration by 2*90 = 180 degrees clockwise.+r2 :: Perm a => a -> a r2 = r1 . r1  -- | Ration by 3*90 = 270 degrees clockwise.+r3 :: Perm a => a -> a r3 = r2 . r1  -- | Reflection through a horizontal axis (also called 'complement').+s0 :: Perm a => a -> a s0 = r1 . s2  -- | Reflection through a vertical axis (also called 'reverse').+s1 :: Perm a => a -> a s1 w = (fromVector . revIdperm . size) w `act` w  -- | Reflection through the main diagonal (also called 'inverse').+s2 :: Perm a => a -> a s2 = Math.Sym.inverse  -- | Reflection through the anti-diagonal.+s3 :: Perm a => a -> a s3 = s1 . r1 + -- D8, the klein four-group, and orbits -- ------------------------------------ -d8, klein4 :: Perm a => [a -> a]- -- | The dihedral group of order 8 (the symmetries of a square); that is, --  -- > d8 = [r0, r1, r2, r3, s0, s1, s2, s3] -- +d8 :: Perm a => [a -> a] d8 = [r0, r1, r2, r3, s0, s1, s2, s3]  -- | The Klein four-group (the symmetries of a non-equilateral@@ -88,6 +95,7 @@ --  -- > klein4 = [r0, r2, s0, s1] -- +klein4 :: Perm a => [a -> a] klein4 = [r0, r2, s0, s1]  -- | @orbit fs x@ is the orbit of @x@ under the functions in @fs@. E.g.,@@ -97,22 +105,26 @@ orbit :: Ord a => Perm a => [a -> a] -> a -> [a] orbit fs x = map head . group $ sort [ f x | f <- fs ] + -- Aliases -- ------- -id, rotate, complement, reverse, inverse :: Perm a => a -> a- -- | @id = r0@+id :: Perm a => a -> a id = r0  -- | @rotate = r1@+rotate :: Perm a => a -> a rotate = r1  -- | @complement = s0@+complement :: Perm a => a -> a complement = s0  -- | @reverse = s1@+reverse :: Perm a => a -> a reverse = s1  -- | @inverse = s2@+inverse :: Perm a => a -> a inverse = s2
sym.cabal view
@@ -1,12 +1,12 @@ Name:                sym-Version:             0.1+Version:             0.1.1 Synopsis:            Permutations, patterns, and statistics Description:            Definitions for permutations with an emphasis on permutation   patterns and statistics.   .   ["Math.Sym"] Provides an efficient definition of standard-  permutations (@StPerm@) together with a typeclass (@Perm@) whose+  permutations, @StPerm@, together with a typeclass, @Perm@,  whose   functionality is largely inherited from @StPerm@ using a group   action and the standardization map.   .@@ -40,7 +40,7 @@    Build-depends:       base >= 3 && < 5, random, vector   -  ghc-prof-options:    -auto-all -caf-all+  ghc-prof-options:    -auto-all   ghc-options:         -Wall -O2   cc-options:          -Wall