jackpolynomials 1.3.0.0 → 1.4.0.0
raw patch · 7 files changed
+122/−44 lines, 7 filesdep −unordered-containersdep ~hsprayPVP ok
version bump matches the API change (PVP)
Dependencies removed: unordered-containers
Dependency ranges changed: hspray
API changes (from Hackage documentation)
+ Math.Algebra.Jack.SymmetricPolynomials: calogeroSutherland :: (Eq a, C a) => a -> Spray a -> Spray a
+ Math.Algebra.Jack.SymmetricPolynomials: laplaceBeltrami :: (Eq a, C a) => a -> Spray a -> Spray a
Files
- CHANGELOG.md +10/−2
- jackpolynomials.cabal +5/−5
- src/Math/Algebra/Jack/Internal.hs +4/−27
- src/Math/Algebra/Jack/SymmetricPolynomials.hs +50/−3
- src/Math/Algebra/JackPol.hs +1/−1
- src/Math/Algebra/JackSymbolicPol.hs +1/−1
- tests/Main.hs +51/−5
CHANGELOG.md view
@@ -8,7 +8,7 @@ 1.1.0.0 ------- -* replaced the 'mpolynomials' dependency with 'hspray' +* replaced the **mpolynomials** dependency with **hspray** * unit tests 1.1.0.1 @@ -49,4 +49,12 @@ 1.3.0.0 ------- * the type of the Jack polynomials with a symbolic Jack parameter has changed -from `OneParameterSpray a` to `ParametricSpray a`+from `OneParameterSpray a` to `ParametricSpray a` + +1.4.0.0 +------- +* upgraded the **hspray** dependency (an error has been fixed in this new +version) + +* added the Laplace-Beltrami operator and the Calogero-Sutherland operator; +the Jack polynomials are eigenpolynomials of these operators
jackpolynomials.cabal view
@@ -1,5 +1,5 @@ name: jackpolynomials -version: 1.3.0.0 +version: 1.4.0.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 @@ -26,11 +26,10 @@ , ilist >= 0.4.0.1 && < 0.4.1 , array >= 0.5.4.0 && < 0.6 , lens >= 5.0.1 && < 5.3 - , hspray >= 0.4.0.0 && < 0.5.0.0 + , hspray >= 0.5.0.0 && < 0.6.0.0 , numeric-prelude >= 0.4.4 && < 0.5 , combinat >= 0.2.10 && < 0.3 , containers >= 0.6.4.1 && < 0.8 - , unordered-containers >= 0.2.17.0 && < 0.3 other-extensions: ScopedTypeVariables , BangPatterns default-language: Haskell2010 @@ -52,8 +51,9 @@ , tasty >= 1.4 && < 1.6 , tasty-hunit >= 0.10 && < 0.11 , jackpolynomials - , hspray >= 0.4.0.0 && < 0.5.0.0 + , hspray >= 0.5.0.0 && < 0.6.0.0 , hypergeomatrix >= 1.1.0.2 && < 2 + , combinat >= 0.2.10 && < 0.3 Default-Language: Haskell2010 ghc-options: -Wall -Wcompat @@ -71,7 +71,7 @@ Build-Depends: base >= 4.7 && < 5 , miniterion >= 0.1.1.0 && < 0.2 , jackpolynomials - , hspray >= 0.4.0.0 && < 0.5.0.0 + , hspray >= 0.5.0.0 && < 0.6.0.0 Default-Language: Haskell2010 ghc-options: -Wall -Wcompat
src/Math/Algebra/Jack/Internal.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE ScopedTypeVariables #-} module Math.Algebra.Jack.Internal - (Partition + ( Partition , jackCoeffP , jackCoeffQ , jackCoeffC @@ -14,12 +14,11 @@ , _N , _fromInt , skewSchurLRCoefficients - , isSkewPartition) + , isSkewPartition ) where import Prelude hiding ((*), (+), (-), (/), (^), (*>), product, sum, fromIntegral, fromInteger, recip) import Algebra.Additive ( (+), (-), sum ) -import qualified Algebra.Additive as AlgAdd import Algebra.Field ( (/), recip ) import qualified Algebra.Field as AlgField import Algebra.Ring ( (*), product, one @@ -27,18 +26,13 @@ ) import qualified Algebra.Ring as AlgRing import Algebra.ToInteger ( fromIntegral ) -import qualified Data.HashMap.Strict as HM import Data.List.Index ( iconcatMap ) -import Data.Maybe ( fromMaybe ) import qualified Data.Map.Strict as DM -import qualified Data.Sequence as S import Math.Algebra.Hspray ( RatioOfSprays, (%:%) - , Spray + , Spray, (.^) , lone, unitSpray - , (*^), (^**^), (^*^) - , (^+^), (.^), (^-^) - , Powers (..), Term + , FunctionLike (..) ) import qualified Math.Combinat.Partitions.Integer as MCP import Math.Combinat.Tableaux.LittlewoodRichardson ( _lrRule ) @@ -117,23 +111,6 @@ jackCoeffQ lambda alpha = one / product upper where (_, upper) = hookLengths lambda alpha - --- | addition of a term to a spray -addTerm :: (AlgAdd.C a, Eq a) => Spray a -> Term a -> Spray a -addTerm spray (powers, coeff) = - if getCoefficient' powers spray AlgAdd.+ coeff == AlgAdd.zero - then - HM.delete powers spray - else - HM.insertWith (AlgAdd.+) powers coeff spray - where - getCoefficient' pows s = - fromMaybe AlgAdd.zero (HM.lookup pows s) - -(+>) :: (AlgAdd.C a, Eq a) => a -> Spray a -> Spray a -(+>) x spray = if x == AlgAdd.zero - then spray - else addTerm spray (Powers S.empty 0, x) symbolicHookLengthsProducts :: forall a. (Eq a, AlgRing.C a) => Partition -> (Spray a, Spray a)
src/Math/Algebra/Jack/SymmetricPolynomials.hs view
@@ -20,7 +20,11 @@ , prettySymmetricQSpray , prettySymmetricQSpray' , prettySymmetricParametricQSpray + , laplaceBeltrami + , calogeroSutherland ) where +import qualified Algebra.Additive as AlgAdd +import qualified Algebra.Field as AlgField import qualified Algebra.Ring as AlgRing import qualified Data.Foldable as DF import Data.List ( foldl1', nub ) @@ -28,15 +32,19 @@ import qualified Data.Map.Strict as DM import Data.Sequence ( Seq ) import Math.Algebra.Hspray ( - (^+^) - , (*^) + FunctionLike (..) + , (/^) , Spray , QSpray , QSpray' , ParametricQSpray + , lone + , lone' , fromList , getCoefficient - , numberOfVariables + , isConstant + , (%//%) + , RatioOfSprays (..) , prettyRatioOfQSpraysXYZ , showNumSpray , showQSpray @@ -140,3 +148,42 @@ showSymmetricMonomials mspray where mspray = makeMSpray spray + +-- Laplace-Beltrami operator on the space of homogeneous symmetric polynomials; +-- neither symmetry and homogeneity are checked +laplaceBeltrami :: (Eq a, AlgField.C a) => a -> Spray a -> Spray a +laplaceBeltrami alpha spray = + if isConstant spray + then zeroSpray + else alpha' *^ spray1 ^+^ spray2 + where + alpha' = alpha AlgField./ AlgRing.fromInteger 2 + n = numberOfVariables spray + range = [1 .. n] + dsprays = map (`derivative` spray) range + op1 i = lone' i 2 ^*^ derivative i (dsprays !! (i-1)) + spray1 = AlgAdd.sum (map op1 range) + spray2 = _numerator $ AlgAdd.sum + [(lone' i 2 ^*^ dsprays !! (i-1)) %//% (lone i ^-^ lone j) + | i <- range, j <- range, i /= j] + +-- Calogero-Sutherland operator on the space of homogeneous symmetric polynomials; +-- neither symmetry and homogeneity are checked +calogeroSutherland :: (Eq a, AlgField.C a) => a -> Spray a -> Spray a +calogeroSutherland alpha spray = + if isConstant spray + then zeroSpray + else halfSpray $ alpha *^ spray1 ^+^ spray2 + where + halfSpray p = p /^ AlgRing.fromInteger 2 + n = numberOfVariables spray + range = [1 .. n] + dsprays = map (`derivative` spray) range + op0 p i = lone i ^*^ derivative i p + op1 p i = op0 (op0 p i) i + spray1 = AlgAdd.sum (map (op1 spray) range) + spray2 = _numerator $ AlgAdd.sum + [let (xi, xj, dxi, dxj) = + (lone i, lone j, dsprays !! (i-1), dsprays !! (j-1)) in + (xi ^+^ xj) ^*^ (xi ^*^ dxi ^-^ xj ^*^ dxj) %//% (xi ^-^ xj) + | i <- range, j <- [i+1 .. n]]
src/Math/Algebra/JackPol.hs view
@@ -30,7 +30,7 @@ , jackCoeffP, jackCoeffQ , skewSchurLRCoefficients , isSkewPartition, _fromInt ) -import Math.Algebra.Hspray ( (*^), (^**^), (^*^), (^+^), (.^) +import Math.Algebra.Hspray ( FunctionLike (..), (.^) , lone, Spray , zeroSpray, unitSpray )
src/Math/Algebra/JackSymbolicPol.hs view
@@ -28,7 +28,7 @@ , jackSymbolicCoeffPinv , jackSymbolicCoeffQinv , _N, _isPartition, Partition ) -import Math.Algebra.Hspray ( (*^), (^*^), (^+^), (.^) +import Math.Algebra.Hspray ( FunctionLike (..), (.^) , lone, lone' , ParametricSpray, ParametricQSpray , Spray, asRatioOfSprays
tests/Main.hs view
@@ -1,21 +1,26 @@ module Main ( main ) where import Data.Ratio ( (%) ) -import Math.Algebra.Hspray ( (^+^), (*^), (^*^), (^**^) +import Math.Algebra.Hspray ( FunctionLike (..) , Spray, lone , evalSpray , evalParametricSpray' , substituteParameters , canCoerceToSimpleParametricSpray + , isHomogeneousSpray ) import qualified Math.Algebra.Hspray as Hspray import Math.Algebra.Jack ( schur, skewSchur , jack', zonal' ) import Math.Algebra.Jack.HypergeoPQ ( hypergeoPQ ) import Math.Algebra.Jack.SymmetricPolynomials ( isSymmetricSpray - , prettySymmetricParametricQSpray ) + , prettySymmetricParametricQSpray + , laplaceBeltrami + , calogeroSutherland ) import Math.Algebra.JackPol ( zonalPol, zonalPol', jackPol' , schurPol, schurPol', skewSchurPol' ) import Math.Algebra.JackSymbolicPol ( jackSymbolicPol' ) +import Math.Combinat.Classes ( HasDuality (..) ) +import Math.Combinat.Partitions.Integer ( toPartition, fromPartition ) import Math.HypergeoMatrix ( hypergeomat ) import Test.Tasty ( defaultMain , testGroup @@ -71,13 +76,54 @@ v = evalSpray jp [1, 1] assertEqual "" v 48 - , testCase "jackPol is symmetric (Gröbner)" $ do + , testCase "jackPol is homogeneous" $ do + let jp = jackPol' 4 [3, 1] (2 % 1) 'J' + assertEqual "" (isHomogeneousSpray jp) (True, Just 4) + + , testCase "jackPol is symmetric (Groebner)" $ do let jp = jackPol' 3 [3, 2, 1] (2 % 1) 'J' assertBool "" (Hspray.isSymmetricSpray jp) , testCase "jack" $ do assertEqual "" (jack' [1, 1] [3, 1] (2 % 1) 'J') 48 + , testCase "Jack polynomial is eigenpolynomial for Laplace-Beltrami" $ do + let + alpha = 3 % 1 + lambda = [2, 2] + b :: [Int] -> Rational + b mu = toRational $ sum $ zipWith (*) mu [0 .. ] + eigenvalue :: Int -> Rational -> [Int] -> Rational + eigenvalue n a mu = + let mu' = fromPartition $ dual (toPartition mu) in + a * b mu' - b mu + toRational ((n-1) * sum mu) + ev = eigenvalue 4 alpha lambda + jp = jackPol' 4 lambda alpha 'J' + jp' = laplaceBeltrami alpha jp + assertEqual "" jp' (ev *^ jp) + + , testCase "Jack polynomial is eigenpolynomial for Calogero-Sutherland" $ do + let + eigenval :: Int -> Rational -> [Int] -> Rational + eigenval n a mu = sum $ map + (\i -> let r = toRational (mu !! (i-1)) in + a/2 * r*r + ((toRational $ n + 1 - 2*i) / 2) * r) + [1 .. length mu] + alpha = 3 % 4 + lambda = [3, 1] + ev = eigenval 4 alpha lambda + jp = jackPol' 4 lambda alpha 'J' + jp' = calogeroSutherland alpha jp + assertEqual "" jp' (ev *^ jp) + + , testCase "Jack P-polynomial for alpha=1 is Schur polynomial" $ do + let + n = 5 + lambda = [5, 4, 3, 2, 1] + jp = jackPol' n lambda 1 'P' + sp = schurPol' n lambda + assertEqual "" jp sp + , testCase "schurPol" $ do let sp1 = schurPol 4 [4] sp2 = schurPol 4 [3, 1] @@ -87,7 +133,7 @@ v = evalSpray (sp1 ^+^ 3 *^ sp2 ^+^ 2 *^ sp3 ^+^ 3 *^ sp4 ^+^ sp5) [2, 2, 2, 2] assertEqual "" v 4096 - , testCase "schurPol is symmetric (Gröbner)" $ do + , testCase "schurPol is symmetric (Groebner)" $ do let sp = schurPol' 3 [3, 2, 1] assertBool "" (Hspray.isSymmetricSpray sp) @@ -112,7 +158,7 @@ ^+^ x ^*^ z^**^2 ^+^ y^**^2 ^*^ z ^+^ y ^*^ z^**^2 assertEqual "" skp p - , testCase "skewSchurPol is symmetric (Gröbner)" $ do + , testCase "skewSchurPol is symmetric (Groebner)" $ do let skp = skewSchurPol' 3 [3, 2, 1] [1, 1] assertBool "" (Hspray.isSymmetricSpray skp)