Skip to content

Commit

Permalink
unit test GreenXpolynomial expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
stla committed Aug 5, 2024
1 parent e6dbb83 commit 74a1181
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
5 changes: 2 additions & 3 deletions inst/essais/essai-GreenPolynomial-chiLambdaRho2.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
library(jack)

mu <- c(2, 1, 1)
rho <- c(2, 2)
mu <- c(2, 1, 1, 1)
rho <- c(2, 2, 1)

chi_lambda_rho <- function(lambda, rho) {
jack:::chi_lambda_mu_rho(lambda, integer(0), rho)
}


listOfDominatingPartitions <- function(mu) {
kappas <- jack:::listOfDominatedPartitions(partitions::conjugate(mu))
lapply(kappas, partitions::conjugate)
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/helper-15.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
chi_lambda_rho <- function(lambda, rho) {
chi_lambda_mu_rho(lambda, integer(0), rho)
}

listOfDominatingPartitions <- function(mu) {
kappas <- listOfDominatedPartitions(partitions::conjugate(mu))
lapply(kappas, partitions::conjugate)
}
32 changes: 32 additions & 0 deletions tests/testthat/test-GreenPolynomials.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,38 @@ test_that("Some Green X-polynomials (comparison with Sage)", {
})


test_that("Green X-polynomial expansion", {

mu <- c(2, 1, 1, 1)
rho <- c(2, 2, 1)

lambdas <- listOfDominatingPartitions(mu)

KFpolys <- lapply(lambdas, function(lambda) {
KostkaFoulkesPolynomial(lambda, mu)
})

chis <- lapply(lambdas, function(lambda) {
chi_lambda_rho(lambda, rho)
})

toAdd <- mapply(
function(chi, KFpoly) {
chi * KFpoly
},
chis, KFpolys,
USE.NAMES = FALSE, SIMPLIFY = FALSE
)

obtained <- Reduce(`+`, toAdd)

muAsString <- partitionAsString(mu)
expected <- GreenXpolynomials(rho = rho)[[muAsString]][["polynomial"]]

expect_true(obtained == expected)
})


test_that("A Green Q-polynomial (rho = lambda = [2,2])", {
# comparison with https://elad.zelingher.com/mathapps/gln/GreenPolynomials.html
GreenQpolys <- GreenQpolynomials(c(2, 2))
Expand Down

0 comments on commit 74a1181

Please sign in to comment.