{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Math.Algebra.JackPol
(schurPol, jackPol, zonalPol)
where
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 ( _betaratio', hookLengths, _N
, _isPartition, Partition )
import Math.Algebra.MultiPol ( (*^), (^**^), (^*^), (^+^)
, constant, lone, Polynomial )
import Numeric.SpecFunctions ( factorial )
jackPol :: forall a. (Fractional a, Ord a, AR.C a)
=> Int
-> Partition
-> a
-> Polynomial a
jackPol :: Int -> Partition -> a -> Polynomial a
jackPol Int
n Partition
lambda a
alpha =
case Partition -> Bool
_isPartition Partition
lambda Bool -> Bool -> Bool
&& a
alpha a -> a -> Bool
forall a. Ord a => a -> a -> Bool
> a
0 of
Bool
False -> if Partition -> Bool
_isPartition Partition
lambda
then [Char] -> Polynomial a
forall a. HasCallStack => [Char] -> a
error [Char]
"alpha must be strictly positive"
else [Char] -> Polynomial a
forall a. HasCallStack => [Char] -> a
error [Char]
"lambda is not a valid integer partition"
Bool
True -> Int
-> Int
-> Partition
-> Partition
-> Array (Int, Int) (Maybe (Polynomial a))
-> a
-> Polynomial a
jac ([Polynomial a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Polynomial a]
x) Int
0 Partition
lambda Partition
lambda Array (Int, Int) (Maybe (Polynomial a))
forall a. Array (Int, Int) (Maybe a)
arr0 a
1
where
nll :: Int
nll = Partition -> Partition -> Int
_N Partition
lambda Partition
lambda
x :: [Polynomial a]
x = (Int -> Polynomial a) -> Partition -> [Polynomial a]
forall a b. (a -> b) -> [a] -> [b]
map Int -> Polynomial a
forall a. (C a, Eq a) => Int -> Polynomial a
lone [Int
1 .. Int
n] :: [Polynomial a]
arr0 :: Array (Int, Int) (Maybe a)
arr0 = ((Int, Int), (Int, Int)) -> [Maybe a] -> Array (Int, Int) (Maybe a)
forall i e. Ix i => (i, i) -> [e] -> Array i e
listArray ((Int
1, Int
1), (Int
nll, Int
n)) (Int -> Maybe a -> [Maybe a]
forall a. Int -> a -> [a]
replicate (Int
nll Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
n) Maybe a
forall a. Maybe a
Nothing)
theproduct :: Int -> a
theproduct :: Int -> a
theproduct Int
nu0 = if Int
nu0 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
1
then a
forall a. C a => a
AR.one
else [a] -> a
forall a. C a => [a] -> a
AR.product ([a] -> a) -> [a] -> a
forall a b. (a -> b) -> a -> b
$ (Int -> a) -> Partition -> [a]
forall a b. (a -> b) -> [a] -> [b]
map (\Int
i -> a
alpha a -> a -> a
forall a. Num a => a -> a -> a
* Int -> a
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i a -> a -> a
forall a. Num a => a -> a -> a
+ a
1) [Int
1 .. Int
nu0Int -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1]
jac :: Int -> Int -> Partition -> Partition -> Array (Int,Int) (Maybe (Polynomial a)) -> a -> Polynomial a
jac :: Int
-> Int
-> Partition
-> Partition
-> Array (Int, Int) (Maybe (Polynomial a))
-> a
-> Polynomial a
jac Int
m Int
k Partition
mu Partition
nu Array (Int, Int) (Maybe (Polynomial a))
arr a
beta
| Partition -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null Partition
nu Bool -> Bool -> Bool
|| Partition -> Int
forall a. [a] -> a
head Partition
nu Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 Bool -> Bool -> Bool
|| Int
m Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 = a -> Polynomial a
forall a. (C a, Eq a) => a -> Polynomial a
constant a
1
| Partition -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length Partition
nu Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
m Bool -> Bool -> Bool
&& Partition
nuPartition -> Int -> Int
forall a. [a] -> Int -> a
!!Int
m Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
0 = a -> Polynomial a
forall a. (C a, Eq a) => a -> Polynomial a
constant a
0
| Int
m Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
1 = Int -> a
theproduct (Partition -> Int
forall a. [a] -> a
head Partition
nu) a -> Polynomial a -> Polynomial a
forall a. (C a, Eq a) => a -> Polynomial a -> Polynomial a
*^ ([Polynomial a] -> Polynomial a
forall a. [a] -> a
head [Polynomial a]
x Polynomial a -> Int -> Polynomial a
forall a. (C a, Eq a) => Polynomial a -> Int -> Polynomial a
^**^ Partition -> Int
forall a. [a] -> a
head Partition
nu)
| Int
k Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 Bool -> Bool -> Bool
&& Maybe (Polynomial a) -> Bool
forall a. Maybe a -> Bool
isJust (Array (Int, Int) (Maybe (Polynomial a))
arr Array (Int, Int) (Maybe (Polynomial a))
-> (Int, Int) -> Maybe (Polynomial a)
forall i e. Ix i => Array i e -> i -> e
! (Partition -> Partition -> Int
_N Partition
lambda Partition
nu, Int
m)) =
Maybe (Polynomial a) -> Polynomial a
forall a. HasCallStack => Maybe a -> a
fromJust (Maybe (Polynomial a) -> Polynomial a)
-> Maybe (Polynomial a) -> Polynomial a
forall a b. (a -> b) -> a -> b
$ Array (Int, Int) (Maybe (Polynomial a))
arr Array (Int, Int) (Maybe (Polynomial a))
-> (Int, Int) -> Maybe (Polynomial a)
forall i e. Ix i => Array i e -> i -> e
! (Partition -> Partition -> Int
_N Partition
lambda Partition
nu, Int
m)
| Bool
otherwise = Polynomial a
s
where
s :: Polynomial a
s = Polynomial a -> Int -> Polynomial a
go (a
beta a -> Polynomial a -> Polynomial a
forall a. (C a, Eq a) => a -> Polynomial a -> Polynomial a
*^ (Int
-> Int
-> Partition
-> Partition
-> Array (Int, Int) (Maybe (Polynomial a))
-> a
-> Polynomial a
jac (Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int
0 Partition
nu Partition
nu Array (Int, Int) (Maybe (Polynomial a))
arr a
1 Polynomial a -> Polynomial a -> Polynomial a
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^*^ (([Polynomial a]
x[Polynomial a] -> Int -> Polynomial a
forall a. [a] -> Int -> a
!!(Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)) Polynomial a -> Int -> Polynomial a
forall a. (C a, Eq a) => Polynomial a -> Int -> Polynomial a
^**^ (Partition -> Int
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum Partition
mu Int -> Int -> Int
forall a. Num a => a -> a -> a
- Partition -> Int
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum Partition
nu))))
(Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
1 Int
k)
go :: Polynomial a -> Int -> Polynomial a
go :: Polynomial a -> Int -> Polynomial a
go !Polynomial a
ss Int
ii
| Partition -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length Partition
nu Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
ii Bool -> Bool -> Bool
|| Partition
nuPartition -> Int -> Int
forall a. [a] -> Int -> a
!!(Int
iiInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 = Polynomial a
ss
| Bool
otherwise =
let u :: Int
u = Partition
nuPartition -> Int -> Int
forall a. [a] -> Int -> a
!!(Int
iiInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) in
if Partition -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length Partition
nu Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
ii Bool -> Bool -> Bool
&& Int
u Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
0 Bool -> Bool -> Bool
|| Int
u Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Partition
nuPartition -> Int -> Int
forall a. [a] -> Int -> a
!!Int
ii
then
let nu' :: Partition
nu' = (Int -> IndexedTraversal' Int Partition Int
forall (t :: * -> *) a.
Traversable t =>
Int -> IndexedTraversal' Int (t a) a
element (Int
iiInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) ((Int -> Identity Int) -> Partition -> Identity Partition)
-> Int -> Partition -> Partition
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Int
uInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Partition
nu in
let gamma :: a
gamma = a
beta a -> a -> a
forall a. Num a => a -> a -> a
* Partition -> Partition -> Int -> a -> a
forall a.
(Fractional a, C a) =>
Partition -> Partition -> Int -> a -> a
_betaratio' Partition
mu Partition
nu Int
ii a
alpha in
if Int
u Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
1
then
Polynomial a -> Int -> Polynomial a
go (Polynomial a
ss Polynomial a -> Polynomial a -> Polynomial a
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^+^ Int
-> Int
-> Partition
-> Partition
-> Array (Int, Int) (Maybe (Polynomial a))
-> a
-> Polynomial a
jac Int
m Int
ii Partition
mu Partition
nu' Array (Int, Int) (Maybe (Polynomial a))
arr a
gamma) (Int
ii Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
else
if Partition -> Int
forall a. [a] -> a
head Partition
nu' Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0
then
Polynomial a -> Int -> Polynomial a
go (Polynomial a
ss Polynomial a -> Polynomial a -> Polynomial a
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^+^ (a
gamma a -> Polynomial a -> Polynomial a
forall a. (C a, Eq a) => a -> Polynomial a -> Polynomial a
*^ ([Polynomial a]
x[Polynomial a] -> Int -> Polynomial a
forall a. [a] -> Int -> a
!!(Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Polynomial a -> Int -> Polynomial a
forall a. (C a, Eq a) => Polynomial a -> Int -> Polynomial a
^**^ Partition -> Int
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum Partition
mu))) (Int
ii Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
else
let arr' :: Array (Int, Int) (Maybe (Polynomial a))
arr' = Array (Int, Int) (Maybe (Polynomial a))
arr Array (Int, Int) (Maybe (Polynomial a))
-> [((Int, Int), Maybe (Polynomial a))]
-> Array (Int, Int) (Maybe (Polynomial a))
forall i e. Ix i => Array i e -> [(i, e)] -> Array i e
// [((Partition -> Partition -> Int
_N Partition
lambda Partition
nu, Int
m), Polynomial a -> Maybe (Polynomial a)
forall a. a -> Maybe a
Just Polynomial a
ss)] in
let jck :: Polynomial a
jck = Int
-> Int
-> Partition
-> Partition
-> Array (Int, Int) (Maybe (Polynomial a))
-> a
-> Polynomial a
jac (Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int
0 Partition
nu' Partition
nu' Array (Int, Int) (Maybe (Polynomial a))
arr' a
1 in
let jck' :: Polynomial a
jck' = a
gamma a -> Polynomial a -> Polynomial a
forall a. (C a, Eq a) => a -> Polynomial a -> Polynomial a
*^ (Polynomial a
jck Polynomial a -> Polynomial a -> Polynomial a
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^*^
([Polynomial a]
x[Polynomial a] -> Int -> Polynomial a
forall a. [a] -> Int -> a
!!(Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Polynomial a -> Int -> Polynomial a
forall a. (C a, Eq a) => Polynomial a -> Int -> Polynomial a
^**^ (Partition -> Int
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum Partition
mu Int -> Int -> Int
forall a. Num a => a -> a -> a
- Partition -> Int
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum Partition
nu'))) in
Polynomial a -> Int -> Polynomial a
go (Polynomial a
ss Polynomial a -> Polynomial a -> Polynomial a
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^+^ Polynomial a
jck') (Int
iiInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)
else
Polynomial a -> Int -> Polynomial a
go Polynomial a
ss (Int
iiInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)
zonalPol :: (Fractional a, Ord a, AR.C a)
=> Int
-> Partition
-> Polynomial a
zonalPol :: Int -> Partition -> Polynomial a
zonalPol Int
n Partition
lambda = a
c a -> Polynomial a -> Polynomial a
forall a. (C a, Eq a) => a -> Polynomial a -> Polynomial a
*^ Polynomial a
jck
where
k :: Int
k = Partition -> Int
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum Partition
lambda
jlambda :: a
jlambda = [a] -> a
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
product (Partition -> a -> [a]
forall a. Fractional a => Partition -> a -> [a]
hookLengths Partition
lambda a
2)
c :: a
c = a
2a -> Int -> a
forall a b. (Num a, Integral b) => a -> b -> a
^Int
k a -> a -> a
forall a. Num a => a -> a -> a
* Double -> a
forall a b. (Real a, Fractional b) => a -> b
realToFrac (Int -> Double
factorial Int
k) a -> a -> a
forall a. Fractional a => a -> a -> a
/ a
jlambda
jck :: Polynomial a
jck = Int -> Partition -> a -> Polynomial a
forall a.
(Fractional a, Ord a, C a) =>
Int -> Partition -> a -> Polynomial a
jackPol Int
n Partition
lambda a
2
schurPol ::
Int
-> Partition
-> Polynomial Int
schurPol :: Int -> Partition -> Polynomial Int
schurPol Int
n Partition
lambda =
case Partition -> Bool
_isPartition Partition
lambda of
Bool
False -> [Char] -> Polynomial Int
forall a. HasCallStack => [Char] -> a
error [Char]
"lambda is not a valid integer partition"
Bool
True -> Int
-> Int
-> Partition
-> Array (Int, Int) (Maybe (Polynomial Int))
-> Polynomial Int
sch Int
n Int
1 Partition
lambda Array (Int, Int) (Maybe (Polynomial Int))
forall a. Array (Int, Int) (Maybe a)
arr0
where
x :: [Polynomial Int]
x = (Int -> Polynomial Int) -> Partition -> [Polynomial Int]
forall a b. (a -> b) -> [a] -> [b]
map Int -> Polynomial Int
forall a. (C a, Eq a) => Int -> Polynomial a
lone [Int
1 .. Int
n] :: [Polynomial Int]
nll :: Int
nll = Partition -> Partition -> Int
_N Partition
lambda Partition
lambda
arr0 :: Array (Int, Int) (Maybe a)
arr0 = ((Int, Int), (Int, Int)) -> [Maybe a] -> Array (Int, Int) (Maybe a)
forall i e. Ix i => (i, i) -> [e] -> Array i e
listArray ((Int
1, Int
1), (Int
nll, Int
n)) (Int -> Maybe a -> [Maybe a]
forall a. Int -> a -> [a]
replicate (Int
nll Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
n) Maybe a
forall a. Maybe a
Nothing)
sch :: Int -> Int -> [Int] -> Array (Int,Int) (Maybe (Polynomial Int)) -> Polynomial Int
sch :: Int
-> Int
-> Partition
-> Array (Int, Int) (Maybe (Polynomial Int))
-> Polynomial Int
sch Int
m Int
k Partition
nu Array (Int, Int) (Maybe (Polynomial Int))
arr
| Partition -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null Partition
nu Bool -> Bool -> Bool
|| Partition -> Int
forall a. [a] -> a
head Partition
nu Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 Bool -> Bool -> Bool
|| Int
m Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 = Int -> Polynomial Int
forall a. (C a, Eq a) => a -> Polynomial a
constant Int
1
| Partition -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length Partition
nu Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
m Bool -> Bool -> Bool
&& Partition
nuPartition -> Int -> Int
forall a. [a] -> Int -> a
!!Int
m Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
0 = Int -> Polynomial Int
forall a. (C a, Eq a) => a -> Polynomial a
constant Int
0
| Int
m Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
1 = [Polynomial Int] -> Polynomial Int
forall a. [a] -> a
head [Polynomial Int]
x Polynomial Int -> Int -> Polynomial Int
forall a. (C a, Eq a) => Polynomial a -> Int -> Polynomial a
^**^ Partition -> Int
forall a. [a] -> a
head Partition
nu
| Maybe (Polynomial Int) -> Bool
forall a. Maybe a -> Bool
isJust (Array (Int, Int) (Maybe (Polynomial Int))
arr Array (Int, Int) (Maybe (Polynomial Int))
-> (Int, Int) -> Maybe (Polynomial Int)
forall i e. Ix i => Array i e -> i -> e
! (Partition -> Partition -> Int
_N Partition
lambda Partition
nu, Int
m)) = Maybe (Polynomial Int) -> Polynomial Int
forall a. HasCallStack => Maybe a -> a
fromJust (Maybe (Polynomial Int) -> Polynomial Int)
-> Maybe (Polynomial Int) -> Polynomial Int
forall a b. (a -> b) -> a -> b
$ Array (Int, Int) (Maybe (Polynomial Int))
arr Array (Int, Int) (Maybe (Polynomial Int))
-> (Int, Int) -> Maybe (Polynomial Int)
forall i e. Ix i => Array i e -> i -> e
! (Partition -> Partition -> Int
_N Partition
lambda Partition
nu, Int
m)
| Bool
otherwise = Polynomial Int
s
where
s :: Polynomial Int
s = Polynomial Int -> Int -> Polynomial Int
go (Int
-> Int
-> Partition
-> Array (Int, Int) (Maybe (Polynomial Int))
-> Polynomial Int
sch (Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int
1 Partition
nu Array (Int, Int) (Maybe (Polynomial Int))
arr) Int
k
go :: Polynomial Int -> Int -> Polynomial Int
go :: Polynomial Int -> Int -> Polynomial Int
go !Polynomial Int
ss Int
ii
| Partition -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length Partition
nu Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
ii Bool -> Bool -> Bool
|| Partition
nuPartition -> Int -> Int
forall a. [a] -> Int -> a
!!(Int
iiInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0 = Polynomial Int
ss
| Bool
otherwise =
let u :: Int
u = Partition
nuPartition -> Int -> Int
forall a. [a] -> Int -> a
!!(Int
iiInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) in
if Partition -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length Partition
nu Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
ii Bool -> Bool -> Bool
&& Int
u Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
0 Bool -> Bool -> Bool
|| Int
u Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Partition
nu Partition -> Int -> Int
forall a. [a] -> Int -> a
!! Int
ii
then
let nu' :: Partition
nu' = (Int -> IndexedTraversal' Int Partition Int
forall (t :: * -> *) a.
Traversable t =>
Int -> IndexedTraversal' Int (t a) a
element (Int
iiInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) ((Int -> Identity Int) -> Partition -> Identity Partition)
-> Int -> Partition -> Partition
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Int
uInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Partition
nu in
if Int
u Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
1
then
Polynomial Int -> Int -> Polynomial Int
go (Polynomial Int
ss Polynomial Int -> Polynomial Int -> Polynomial Int
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^+^ (([Polynomial Int]
x[Polynomial Int] -> Int -> Polynomial Int
forall a. [a] -> Int -> a
!!(Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)) Polynomial Int -> Polynomial Int -> Polynomial Int
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^*^ Int
-> Int
-> Partition
-> Array (Int, Int) (Maybe (Polynomial Int))
-> Polynomial Int
sch Int
m Int
ii Partition
nu' Array (Int, Int) (Maybe (Polynomial Int))
arr)) (Int
ii Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
else
if Partition -> Int
forall a. [a] -> a
head Partition
nu' Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
0
then
Polynomial Int -> Int -> Polynomial Int
go (Polynomial Int
ss Polynomial Int -> Polynomial Int -> Polynomial Int
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^+^ ([Polynomial Int]
x[Polynomial Int] -> Int -> Polynomial Int
forall a. [a] -> Int -> a
!!(Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1))) (Int
ii Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
else
let arr' :: Array (Int, Int) (Maybe (Polynomial Int))
arr' = Array (Int, Int) (Maybe (Polynomial Int))
arr Array (Int, Int) (Maybe (Polynomial Int))
-> [((Int, Int), Maybe (Polynomial Int))]
-> Array (Int, Int) (Maybe (Polynomial Int))
forall i e. Ix i => Array i e -> [(i, e)] -> Array i e
// [((Partition -> Partition -> Int
_N Partition
lambda Partition
nu, Int
m), Polynomial Int -> Maybe (Polynomial Int)
forall a. a -> Maybe a
Just Polynomial Int
ss)] in
Polynomial Int -> Int -> Polynomial Int
go (Polynomial Int
ss Polynomial Int -> Polynomial Int -> Polynomial Int
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^+^ (([Polynomial Int]
x[Polynomial Int] -> Int -> Polynomial Int
forall a. [a] -> Int -> a
!!(Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)) Polynomial Int -> Polynomial Int -> Polynomial Int
forall a.
(C a, Eq a) =>
Polynomial a -> Polynomial a -> Polynomial a
^*^ Int
-> Int
-> Partition
-> Array (Int, Int) (Maybe (Polynomial Int))
-> Polynomial Int
sch (Int
mInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int
1 Partition
nu' Array (Int, Int) (Maybe (Polynomial Int))
arr')) (Int
ii Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
else
Polynomial Int -> Int -> Polynomial Int
go Polynomial Int
ss (Int
iiInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)