Bug report – GTClebschGordanCoefficients fails for some instances of CGC


Dear community of GTPack,

First, I’d like to thank the authors of this amazing software.

We are a group of researcher that are using your library for some simulation in representation theory.

While using the library we noted that some instances of the Clebsh-Gordan coefficients computed from your library were actually absent. (i.e. the function returned an empty list)

We understood that this is because a numerical error in floating points operations. The patch is the following.

In the file “RepresentationTheory.m”, in the function “GTClebschGordanCoefficients”, after the line:

Es = Eigensystem[Simplify@A[1, 1]];

It suffices to add the function Round[] in the definition of npq.

npq = Round[Sum[Es[[1, i]], {i, 1, dp}]];

In certain instances, the biggest eigenvalue is slightly smaller than 1, and thus the Table construct

CGK = Table[Table[A[i, 1] . Es[[2, a]], {i, 1, d3}], {a, 1, npq}];

Is never executed, as npq is strictly smaller than 1.

Hope this helps.

Matthias Geilhufe Answered question 30. November 2021

This is fantastic, thanks for reporting the bug together with a suggestion how to solve it. Could you share an example, where the current implementation fails? Thanks!

Matthias Geilhufe Posted new comment 10. December 2021
Ale Luongo

Thank you Matthias,

This happens relatively rarely, but we started to obtain errors with the computation of CGC from the irreducible representations of Sn.

The example is quite convoluted as we are using your library with the function gtclebschgordancoefficients on irreps that we obtain from Sage framework. Then, we use python to export them as numpy files, and we import these files on Mathematica.

Then, we compute all the possible CGC for all the irreps of Sn for n=2,3,4,5,6.

For some CGC already up to n=3 and 4, the function gtclebschgordancoefficients returns an empty array, instead of the CGC matrix.

In the next day I can think of creating a minimum working example, but the code that we have now is quite convoluted. If you give me an email, I can send to you some files and the mathematica code that we are using.


Matthias Geilhufe

Thank you Ale. I assume the issue occurs due to the numerically obtained ireps. We were recently extending towards numerical calculations, but apparently not all functions are compatible (yet). If you could send me an example, it would be perfect. You can reach me under my email geilhufe@kth.se