packages feed

jackpolynomials 1.1.0.0 → 1.1.0.1

raw patch · 6 files changed

+147/−140 lines, 6 filesdep +hypergeomatrixPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: hypergeomatrix

API changes (from Hackage documentation)

- Math.Algebra.Jack.GPochhammer: _allPartitions :: Int -> [[Int]]
- Math.Algebra.Jack.GPochhammer: gpochhammer :: Fractional a => a -> [Int] -> a -> a
- Math.Algebra.Jack.GPochhammer: hcoeff :: Fractional a => [a] -> [a] -> [Int] -> a -> a
- Math.Algebra.Jack.GPochhammer: hypergeoPQ :: (Fractional a, Ord a) => Int -> [a] -> [a] -> [a] -> a
- Math.Algebra.Jack.GPochhammer: testHypergeo :: Double
+ Math.Algebra.Jack.HypergeoPQ: _allPartitions :: Int -> [[Int]]
+ Math.Algebra.Jack.HypergeoPQ: hypergeoPQ :: (Fractional a, Ord a) => Int -> [a] -> [a] -> [a] -> a

Files

CHANGELOG.md view
@@ -10,3 +10,8 @@ ------- * replaced the 'mpolynomials' dependency with 'hspray' * unit tests++1.1.0.1+-------+* unexported some useless functions+* one more unit test
README.md view
@@ -5,6 +5,8 @@ [Jack polynomials](https://en.wikipedia.org/wiki/Jack_function). This package allows to evaluate these polynomials. It can also compute their symbolic form. +___+ ```haskell import Math.Algebra.Jack import Data.Ratio@@ -22,3 +24,12 @@ evalSpray jp [1, 1] -- 48 % 1 ```+++## References++* I.G. Macdonald. *Symmetric Functions and Hall Polynomials*. Oxford Mathematical Monographs. The Clarendon Press Oxford University Press, New York, second edition, 1995.++* J. Demmel and P. Koev. *Accurate and efficient evaluation of Schur and Jack functions*. Mathematics of computations, vol. 75, n. 253, 223-229, 2005.++* Jack polynomials. <https://www.symmetricfunctions.com/jack.htm>.
jackpolynomials.cabal view
@@ -1,53 +1,47 @@-cabal-version:      >=1.10-name:               jackpolynomials-version:            1.1.0.0-license:            GPL-3-license-file:       LICENSE-copyright:          2022 Stéphane Laurent-maintainer:         laurent_step@outlook.fr-author:             Stéphane Laurent-homepage:           https://github.com/stla/jackpolynomials#readme-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.--category:           Math, Algebra-build-type:         Simple-extra-source-files:-    README.md-    CHANGELOG.md--source-repository head-    type:     git-    location: https://github.com/stla/jackpolynomials+name:                jackpolynomials+version:             1.1.0.1+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.+homepage:            https://github.com/stla/jackpolynomials#readme+license:             GPL-3+license-file:        LICENSE+author:              Stéphane Laurent+maintainer:          laurent_step@outlook.fr+copyright:           2022 Stéphane Laurent+category:            Math, Algebra+build-type:          Simple+extra-source-files:  README.md+                     CHANGELOG.md+cabal-version:       >=1.10  library-    exposed-modules:-        Math.Algebra.Jack.GPochhammer-        Math.Algebra.Jack-        Math.Algebra.JackPol--    hs-source-dirs:   src-    other-modules:    Math.Algebra.Jack.Internal-    default-language: Haskell2010-    ghc-options:      -Wall-    build-depends:-        base >=4.7 && <5,-        ilist >=0.4.0.1,-        array >=0.5.4.0,-        lens >=5.0.1,-        math-functions >=0.3.4.2,-        hspray >=0.1.0.0,-        numeric-prelude >=0.4.4+  hs-source-dirs:      src+  exposed-modules:     Math.Algebra.Jack.HypergeoPQ+                     , Math.Algebra.Jack+                     , Math.Algebra.JackPol+  other-modules:       Math.Algebra.Jack.Internal+  build-depends:       base >= 4.7 && < 5+                     , ilist >= 0.4.0.1+                     , array >= 0.5.4.0+                     , lens >= 5.0.1+                     , math-functions >= 0.3.4.2+                     , hspray >= 0.1.0.0+                     , numeric-prelude >= 0.4.4+  default-language:    Haskell2010+  ghc-options:         -Wall  test-suite unit-tests-    type:             exitcode-stdio-1.0-    main-is:          Main.hs-    hs-source-dirs:   tests/-    default-language: Haskell2010-    build-depends:-        base >=4.7 && <5,-        tasty,-        tasty-hunit,-        jackpolynomials,-        hspray+  type:                 exitcode-stdio-1.0+  main-is:              Main.hs+  hs-source-dirs:       tests/+  Build-Depends:        base >= 4.7 && < 5+                      , tasty+                      , tasty-hunit+                      , jackpolynomials+                      , hspray+                      , hypergeomatrix+  Default-Language:     Haskell2010++source-repository head+  type:     git+  location: https://github.com/stla/jackpolynomials
− src/Math/Algebra/Jack/GPochhammer.hs
@@ -1,40 +0,0 @@-module Math.Algebra.Jack.GPochhammer where-import Math.Algebra.Jack (zonal)--gpochhammer :: Fractional a => a -> [Int] -> a -> a-gpochhammer a kappa alpha =-  product $-    map (\i -> product $-                 map (\j -> a - (fromIntegral i - 1)/alpha + fromIntegral j -1)-                     [1 .. kappa !! (i-1)])-        [1 .. length kappa]--hcoeff :: Fractional a => [a] -> [a] -> [Int] -> a -> a-hcoeff a b kappa alpha =-  numerator / denominator / fromIntegral (factorial (sum kappa))-  where-    factorial n = product [1 .. n]-    numerator = product $ map (\x -> gpochhammer x kappa alpha) a-    denominator = product $ map (\x -> gpochhammer x kappa alpha) b--testHypergeo :: Double-testHypergeo =-  let a = [2,3] in-  let b = [4] in-  let coeff kappa = hcoeff a b kappa 2 in-  let kappas = [[], [1], [1,1], [2]] in-  let x = [5,6] in-  sum $ map (\kappa -> coeff kappa * zonal x kappa) kappas--_allPartitions :: Int -> [[Int]]-_allPartitions m = last ps -  where-    ps = [] : map parts [1..m]-    parts n = [n] : [x : p | x <- [1..n], p <- ps !! (n - x), x <= head p]--hypergeoPQ :: (Fractional a, Ord a) => Int -> [a] -> [a] -> [a] -> a-hypergeoPQ m a b x =-  sum $ map (\kappa -> coeff kappa * zonal x kappa) kappas-  where-  kappas = filter (\kap -> length kap <= length x) (_allPartitions m)-  coeff kappa = hcoeff a b kappa 2
+ src/Math/Algebra/Jack/HypergeoPQ.hs view
@@ -0,0 +1,33 @@+module Math.Algebra.Jack.HypergeoPQ+  ( hypergeoPQ, _allPartitions+  ) where+import           Math.Algebra.Jack              ( zonal )++gpochhammer :: Fractional a => a -> [Int] -> a -> a+gpochhammer a kappa alpha = product $ map+  (\i -> product $ map+    (\j -> a - (fromIntegral i - 1) / alpha + fromIntegral j - 1)+    [1 .. kappa !! (i - 1)]+  )+  [1 .. length kappa]++hcoeff :: Fractional a => [a] -> [a] -> [Int] -> a -> a+hcoeff a b kappa alpha = numerator / denominator / +  fromIntegral (factorial (sum kappa))+ where+  factorial n = product [1 .. n]+  numerator   = product $ map (\x -> gpochhammer x kappa alpha) a+  denominator = product $ map (\x -> gpochhammer x kappa alpha) b++_allPartitions :: Int -> [[Int]]+_allPartitions m = [[]] ++ (map reverse (concat ps))+ where+  ps      = [] : map parts [1 .. m]+  parts n = [n] : [ x : p | x <- [1 .. n], p <- ps !! (n - x), x <= head p ]++-- | Inefficient hypergeometric function of a matrix argument+hypergeoPQ :: (Fractional a, Ord a) => Int -> [a] -> [a] -> [a] -> a+hypergeoPQ m a b x = sum $ map (\kappa -> coeff kappa * zonal x kappa) kappas+ where+  kappas      = filter (\kap -> length kap <= length x) (_allPartitions m)+  coeff kappa = hcoeff a b kappa 2
tests/Main.hs view
@@ -1,61 +1,65 @@ module Main where-import Math.Algebra.JackPol-import Math.Algebra.Jack-import Data.Ratio-import Math.Algebra.Hspray-import Test.Tasty       (defaultMain, testGroup)-import Test.Tasty.HUnit (assertEqual, testCase)+import           Data.Ratio+import           Math.Algebra.Hspray+import           Math.Algebra.Jack+import           Math.Algebra.Jack.HypergeoPQ+import           Math.Algebra.JackPol+import           Math.HypergeoMatrix+import           Test.Tasty                     ( defaultMain+                                                , testGroup+                                                )+import           Test.Tasty.HUnit               ( assertEqual+                                                , testCase+                                                )  main :: IO ()-main = defaultMain $-  testGroup "Tests"+main = defaultMain $ testGroup++  "Tests"+   [ testCase "jackPol" $ do-      let jp = jackPol 2 [3, 1] (2%1)-      let v = evalSpray jp [1, 1]-      assertEqual ""-        v-        (48%1),+    let jp = jackPol 2 [3, 1] (2 % 1)+        v  = evalSpray jp [1, 1]+    assertEqual "" v (48 % 1) -    testCase "jack" $ do-      assertEqual ""-        (jack [1, 1] [3, 1] (2%1))-        (48%1),+  , testCase "jack" $ do+    assertEqual "" (jack [1, 1] [3, 1] (2 % 1)) (48 % 1) -    testCase "schurPol" $ do-      let sp1 = schurPol 4 [4]-      let sp2 = schurPol 4 [3, 1]-      let sp3 = schurPol 4 [2, 2]-      let sp4 = schurPol 4 [2, 1, 1]-      let sp5 = schurPol 4 [1, 1, 1, 1]-      let v = evalSpray (sp1 ^+^ 3 *^ sp2 ^+^ 2*^ sp3 ^+^ 3*^ sp4 ^+^ sp5) [2, 2, 2, 2]-      assertEqual ""-        v-        4096,+  , testCase "schurPol" $ do+    let sp1 = schurPol 4 [4]+        sp2 = schurPol 4 [3, 1]+        sp3 = schurPol 4 [2, 2]+        sp4 = schurPol 4 [2, 1, 1]+        sp5 = schurPol 4 [1, 1, 1, 1]+        v = evalSpray (sp1 ^+^ 3 *^ sp2 ^+^ 2 *^ sp3 ^+^ 3 *^ sp4 ^+^ sp5) [2, 2, 2, 2]+    assertEqual "" v 4096 -    testCase "schur" $ do-      let sp1 = schur [1, 1, 1, 1] [4]-      let sp2 = schur [1, 1, 1, 1] [3, 1]-      let sp3 = schur [1, 1, 1, 1] [2, 2]-      let sp4 = schur [1, 1, 1, 1] [2, 1, 1]-      let sp5 = schur [1, 1, 1, 1] [1, 1, 1, 1]-      assertEqual ""-        (sp1 + 3*sp2 + 2*sp3 + 3*sp4 + sp5)-        256,+  , testCase "schur" $ do+    let sp1 = schur [1, 1, 1, 1] [4]+        sp2 = schur [1, 1, 1, 1] [3, 1]+        sp3 = schur [1, 1, 1, 1] [2, 2]+        sp4 = schur [1, 1, 1, 1] [2, 1, 1]+        sp5 = schur [1, 1, 1, 1] [1, 1, 1, 1]+    assertEqual "" (sp1 + 3 * sp2 + 2 * sp3 + 3 * sp4 + sp5) 256 -    testCase "zonalPol" $ do-      let zp1 = zonalPol 4 [3] :: Spray Rational-      let zp2 = zonalPol 4 [2, 1] :: Spray Rational-      let zp3 = zonalPol 4 [1, 1, 1] :: Spray Rational-      let v = evalSpray (zp1 ^+^ zp2 ^+^ zp3) [2, 2, 2, 2]-      assertEqual ""-        v-        512,+  , testCase "zonalPol" $ do+    let zp1 = zonalPol 4 [3]       :: Spray Rational+        zp2 = zonalPol 4 [2, 1]    :: Spray Rational+        zp3 = zonalPol 4 [1, 1, 1] :: Spray Rational+        v   = evalSpray (zp1 ^+^ zp2 ^+^ zp3) [2, 2, 2, 2]+    assertEqual "" v 512 -    testCase "zonal" $ do-      let zp1 = zonal [2%1, 2%1, 2%1, 2%1] [3]-      let zp2 = zonal [2%1, 2%1, 2%1, 2%1] [2, 1]-      let zp3 = zonal [2%1, 2%1, 2%1, 2%1] [1, 1, 1]-      assertEqual ""-        (zp1 + zp2 + zp3)-        512+  , testCase "zonal" $ do+    let zp1 = zonal [2 % 1, 2 % 1, 2 % 1, 2 % 1] [3]+        zp2 = zonal [2 % 1, 2 % 1, 2 % 1, 2 % 1] [2, 1]+        zp3 = zonal [2 % 1, 2 % 1, 2 % 1, 2 % 1] [1, 1, 1]+    assertEqual "" (zp1 + zp2 + zp3) 512++  , testCase "hypergeometric function" $ do+    let a  = [1 % 1, 2 % 1]+        b  = [3 % 1]+        x  = [1 % 5, 1 % 2]+        h1 = hypergeoPQ 10 a b x+    h2 <- hypergeomat 10 2 a b x+    assertEqual "" h1 h2   ]