jackpolynomials 1.1.1.0 → 1.1.2.0
raw patch · 7 files changed
+116/−16 lines, 7 filesdep +combinatdep +containers
Dependencies added: combinat, containers
Files
- CHANGELOG.md +4/−0
- README.md +1/−1
- jackpolynomials.cabal +5/−3
- src/Math/Algebra/Jack.hs +24/−4
- src/Math/Algebra/Jack/Internal.hs +37/−2
- src/Math/Algebra/JackPol.hs +25/−3
- tests/Main.hs +20/−3
CHANGELOG.md view
@@ -24,3 +24,7 @@ * cleaned the code * tested with higher versions of GHC * new unit tests + +1.1.2.0 +------- +* skew Schur polynomials (functions `skewSchur` and `skewSchurPol`)
README.md view
@@ -1,6 +1,6 @@ # jackpolynomials -*Jack, zonal, and Schur polynomials.* +*Jack, zonal, Schur and skew Schur polynomials.* <!-- badges: start --> [](https://github.com/stla/jackpolynomials/actions/workflows/Stack-lts.yml)
jackpolynomials.cabal view
@@ -1,7 +1,7 @@ name: jackpolynomials -version: 1.1.1.0 -synopsis: Jack, zonal, and Schur polynomials -description: This library can evaluate Jack polynomials, zonal polynomials and Schur polynomials. It is also able to compute them in symbolic form. +version: 1.1.2.0 +synopsis: Jack, zonal, Schur and skew Schur polynomials +description: This library can evaluate Jack polynomials, zonal polynomials, Schur and skew Schur polynomials. It is also able to compute them in symbolic form. homepage: https://github.com/stla/jackpolynomials#readme license: GPL-3 license-file: LICENSE @@ -27,6 +27,8 @@ , math-functions >= 0.3.4.2 && < 0.3.5 , hspray >= 0.2.2.0 && < 1 , numeric-prelude >= 0.4.4 && < 0.5 + , combinat >= 0.2.10 && < 0.3 + , containers >= 0.6.4.1 && < 0.8 other-extensions: ScopedTypeVariables , BangPatterns default-language: Haskell2010
src/Math/Algebra/Jack.hs view
@@ -1,25 +1,29 @@ {-| -Module : Math.Algebra.JackPol +Module : Math.Algebra.Jack Description : Evaluation of Jack polynomials. Copyright : (c) Stéphane Laurent, 2024 License : GPL-3 Maintainer : laurent_step@outlook.fr -Evaluation of Jack polynomials, zonal polynomials, and Schur polynomials. +Evaluation of Jack polynomials, zonal polynomials, Schur polynomials and skew Schur polynomials. See README for examples and references. -} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE ScopedTypeVariables #-} module Math.Algebra.Jack - (jack, zonal, schur) + (jack, zonal, schur, skewSchur) where import qualified Algebra.Additive as AA import qualified Algebra.Ring as AR import Control.Lens ( (.~), element ) import Data.Array ( Array, (!), (//), listArray ) import Data.Maybe ( fromJust, isJust ) -import Math.Algebra.Jack.Internal ( _N, hookLengths, _betaratio, _isPartition, Partition ) +import qualified Data.Map.Strict as DM +import Math.Algebra.Jack.Internal ( _N, hookLengths + , _betaratio, _isPartition + , Partition, skewSchurLRCoefficients + , isSkewPartition, _fromInt ) import Numeric.SpecFunctions ( factorial ) -- | Evaluation of Jack polynomial @@ -134,3 +138,19 @@ go (ss AA.+ x!!(m-1) AR.* sch (m-1) 1 nu' arr') (ii + 1) else go ss (ii+1) + +-- | Evaluation of a skew Schur polynomial +skewSchur :: forall a. AR.C a + => [a] -- ^ values of the variables + -> Partition -- ^ the outer partition of the skew partition + -> Partition -- ^ the inner partition of the skew partition + -> a +skewSchur xs lambda mu = + if isSkewPartition lambda mu + then DM.foldlWithKey' f AA.zero lrCoefficients + else error "skewSchur: invalid skew partition" + where + lrCoefficients = skewSchurLRCoefficients lambda mu + f :: a -> Partition -> Int -> a + f x nu k = x AA.+ (_fromInt k) AR.* (schur xs nu) +
src/Math/Algebra/Jack/Internal.hs view
@@ -1,8 +1,20 @@ {-# LANGUAGE BangPatterns #-} module Math.Algebra.Jack.Internal - (Partition, hookLengths, _betaratio, _isPartition, _N) + (Partition + , hookLengths + , _betaratio + , _isPartition + , _N + , _fromInt + , skewSchurLRCoefficients + , isSkewPartition) where -import Data.List.Index ( iconcatMap ) +import qualified Algebra.Additive as AA +import qualified Algebra.Ring as AR +import Data.List.Index ( iconcatMap ) +import qualified Math.Combinat.Partitions.Integer as MCP +import Math.Combinat.Tableaux.LittlewoodRichardson (_lrRule) +import qualified Data.Map.Strict as DM type Partition = [Int] @@ -69,3 +81,26 @@ prod1 = product $ map (\x -> x / (x + alpha - 1)) u prod2 = product $ map (\x -> (x + alpha) / x) v prod3 = product $ map (\x -> (x + alpha) / x) w + +(.^) :: AA.C a => Int -> a -> a +(.^) k x = if k >= 0 + then AA.sum (replicate k x) + else AA.negate $ AA.sum (replicate (-k) x) + +_fromInt :: AR.C a => Int -> a +_fromInt k = k .^ AR.one + +skewSchurLRCoefficients :: Partition -> Partition -> DM.Map Partition Int +skewSchurLRCoefficients lambda mu = + DM.mapKeys toPartition (_lrRule lambda' mu') + where + toPartition :: MCP.Partition -> Partition + toPartition (MCP.Partition part) = part + fromPartition :: Partition -> MCP.Partition + fromPartition part = MCP.Partition part + lambda' = fromPartition lambda + mu' = fromPartition mu + +isSkewPartition :: Partition -> Partition -> Bool +isSkewPartition lambda mu = + _isPartition lambda && _isPartition mu && all (>= 0) (zipWith (-) lambda mu)
src/Math/Algebra/JackPol.hs view
@@ -5,21 +5,25 @@ License : GPL-3 Maintainer : laurent_step@outlook.fr -Computation of symbolic Jack polynomials, zonal polynomials, and Schur polynomials. +Computation of symbolic Jack polynomials, zonal polynomials, Schur polynomials and skew Schur polynomials. See README for examples and references. -} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE ScopedTypeVariables #-} module Math.Algebra.JackPol - (jackPol, zonalPol, schurPol) + (jackPol, zonalPol, schurPol, skewSchurPol) where +import qualified Algebra.Module as AM import qualified Algebra.Ring as AR import Control.Lens ( (.~), element ) import Data.Array ( Array, (!), (//), listArray ) +import qualified Data.Map.Strict as DM import Data.Maybe ( fromJust, isJust ) import Math.Algebra.Jack.Internal ( _betaratio, hookLengths, _N - , _isPartition, Partition ) + , _isPartition, Partition + , skewSchurLRCoefficients + , isSkewPartition, _fromInt ) import Math.Algebra.Hspray ( (*^), (^**^), (^*^), (^+^) , lone, Spray , zeroSpray, unitSpray ) @@ -135,3 +139,21 @@ go (ss ^+^ ((x!!(m-1)) ^*^ sch (m-1) 1 nu' arr')) (ii + 1) else go ss (ii+1) + +-- | Symbolic skew Schur polynomial +skewSchurPol :: forall a. (Ord a, AR.C a) + => Int -- ^ number of variables + -> Partition -- ^ outer partition of the skew partition + -> Partition -- ^ inner partition of the skew partition + -> Spray a +skewSchurPol n lambda mu = + case isSkewPartition lambda mu of + False -> error "skewSchurPol: invalid skew partition" + True -> DM.foldlWithKey' f zeroSpray lrCoefficients + where + lrCoefficients = skewSchurLRCoefficients lambda mu + f :: Spray a -> Partition -> Int -> Spray a + f spray nu k = spray ^+^ (_fromInt' k) AM.*> (schurPol n nu) + _fromInt' :: Int -> a + _fromInt' = _fromInt +
tests/Main.hs view
@@ -1,10 +1,10 @@ module Main where import Data.Ratio ( (%) ) -import Math.Algebra.Hspray ( (^+^), (*^), Spray +import Math.Algebra.Hspray ( (^+^), (*^), (^*^), (^**^), Spray, lone , evalSpray, isSymmetricSpray ) -import Math.Algebra.Jack ( jack, zonal, schur ) +import Math.Algebra.Jack ( jack, zonal, schur, skewSchur ) import Math.Algebra.Jack.HypergeoPQ ( hypergeoPQ ) -import Math.Algebra.JackPol ( zonalPol, jackPol, schurPol ) +import Math.Algebra.JackPol ( zonalPol, jackPol, schurPol, skewSchurPol ) import Math.HypergeoMatrix ( hypergeomat ) import Test.Tasty ( defaultMain , testGroup @@ -51,6 +51,23 @@ sp4 = schur [1, 1, 1, 1] [2, 1, 1] sp5 = schur [1, 1, 1, 1] [1, 1, 1, 1] :: Int assertEqual "" (sp1 + 3 * sp2 + 2 * sp3 + 3 * sp4 + sp5) 256 + + , testCase "skewSchur" $ do + let x = [2, 3, 4] :: [Int] + assertEqual "" (skewSchur x [3, 2, 1] [1, 1]) 1890 + + , testCase "skewSchurPol" $ do + let x = lone 1 :: Spray Rational + y = lone 2 :: Spray Rational + z = lone 3 :: Spray Rational + skp = skewSchurPol 3 [2, 2, 1] [1, 1] + p = x^**^2 ^*^ y ^+^ x^**^2 ^*^ z ^+^ x ^*^ y^**^2 ^+^ 3 *^ (x ^*^ y ^*^ z) + ^+^ x ^*^ z^**^2 ^+^ y^**^2 ^*^ z ^+^ y ^*^ z^**^2 + assertEqual "" skp p + + , testCase "skewSchurPol is symmetric" $ do + let skp = skewSchurPol 3 [3, 2, 1] [1, 1] :: Spray Rational + assertBool "" (isSymmetricSpray skp) , testCase "zonalPol" $ do let zp1 = zonalPol 4 [3] :: Spray Rational