Haarpy is a Python library for the symbolic calculation of Weingarten functions and related averages of unitary matrices
The original Mathematica version of this code, for the calculation of Weingarten functions of the unitary group, can be found here.
The main functions of Haarpy are weingarten_class and weingarten_element allowing for the calculation of Weingarten functions. These functions vary in their parameters. We recommend importing the following when working with Haarpy.
from sympy import Symbol
from sympy.combinatorics import Permutation
d = Symbol("d")
Takes a partition, labeling a conjugacy class of
from haarpy import weingarten_class
weingarten_class((3,1),d)
(2*d**2 - 3)/(d**2*(d - 3)*(d - 2)*(d - 1)*(d + 1)*(d + 2)*(d + 3))
The previous can also be called with integer values as such
weingarten_class((3,1),4)
29/20160
Takes an element and the degree
from haarpy import weingarten_element
weingarten_element(Permutation(0,1,2), 4, d)
(2*d**2 - 3)/(d**2*(d - 3)*(d - 2)*(d - 1)*(d + 1)*(d + 2)*(d + 3))
Which yields the same result as before since
Auxiliary functions include, but are not limited to, the following. For a comprehensive list of functionalities, please refer to the documentation.
Implementation of the Murnaghan-Nakayama rule for the characters irreducible representations of the symmetric group
from haarpy import murn_naka
murn_naka((3,1), (1,1,1,1))
3
Returns the class of a given element of
from haarpy import get_class
get_class(Permutation(0,1,2), 4)
(3,1)
Takes a partition labeling an irrep of
from haarpy import sn_dimension
sn_dimension((5,4,2,1,1,1))
63063
Takes a partition labeling an irrep of the unitary group
from haarpy import ud_dimension
ud_dimension((5, 4, 2, 1, 1, 1),d)
d**2*(d - 5)*(d - 4)*(d - 3)*(d - 2)*(d - 1)**2*(d + 1)**2*(d + 2)**2*(d + 3)*(d + 4)/1382400
Which can also be done numerically.
ud_dimension((5, 4, 2, 1, 1, 1),8)
873180
The following have been retrieved using the weingarten_class function. Weingarten functions of symmetric groups of higher degrees can just as easily be obtained.
Class | Weingarten |
---|---|
Class | Weingarten |
---|---|
Class | Weingarten |
---|---|
Class | Weingarten |
---|---|
Haarpy requires Python version 3.9 or later. Installation can be done through the pip command
pip install haarpy
Haarpy has the following dependencies:
Haarpy documentation is available online on Read the Docs.
Please cite as:
@misc{cardin2024haarpy,
author={Cardin, Yanic and de Guise, Hubert and Quesada, Nicol{\'a}s},
title={Haarpy, a Python library for the symbolic calculation of Weingarten functions},
year={2024},
publisher={GitHub},
journal={GitHub repository},
howpublished = {\url{https://github.com/polyquantique/haarpy}},
version = {0.0.4}
}
- Yanic Cardin, Hubert de Guise, Nicolás Quesada.
Haarpy is free and open source, released under the Apache License, Version 2.0.