From 74a1181a8c52410f5b62fc230bfbc5a863f3838c Mon Sep 17 00:00:00 2001 From: stla Date: Mon, 5 Aug 2024 12:31:30 +0200 Subject: [PATCH] unit test GreenXpolynomial expansion --- .../essai-GreenPolynomial-chiLambdaRho2.R | 5 ++- tests/testthat/helper-15.R | 8 +++++ tests/testthat/test-GreenPolynomials.R | 32 +++++++++++++++++++ 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/helper-15.R diff --git a/inst/essais/essai-GreenPolynomial-chiLambdaRho2.R b/inst/essais/essai-GreenPolynomial-chiLambdaRho2.R index b0b00d8..2f4175c 100644 --- a/inst/essais/essai-GreenPolynomial-chiLambdaRho2.R +++ b/inst/essais/essai-GreenPolynomial-chiLambdaRho2.R @@ -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) diff --git a/tests/testthat/helper-15.R b/tests/testthat/helper-15.R new file mode 100644 index 0000000..e6937b3 --- /dev/null +++ b/tests/testthat/helper-15.R @@ -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) +} diff --git a/tests/testthat/test-GreenPolynomials.R b/tests/testthat/test-GreenPolynomials.R index 5213891..285cb65 100644 --- a/tests/testthat/test-GreenPolynomials.R +++ b/tests/testthat/test-GreenPolynomials.R @@ -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))