From fe766cb44e185f65a4c762477ae7e04fb07c38c4 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Wed, 20 Oct 2021 13:48:02 +0100 Subject: [PATCH] Euclidean gamma matrix tests added --- pyerrors/npr.py | 5 +---- tests/test_npr.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tests/test_npr.py diff --git a/pyerrors/npr.py b/pyerrors/npr.py index 402308db..a5e79f28 100644 --- a/pyerrors/npr.py +++ b/pyerrors/npr.py @@ -134,10 +134,7 @@ def Zq(prop, fermion='Wilson'): sin_mom = np.sin(2 * np.pi / L * mom) if fermion == 'Wilson': - p_slash = -1j * (sin_mom[0] * gamma[0] - + sin_mom[1] * gamma[1] - + sin_mom[2] * gamma[2] - + sin_mom[3] * gamma[3]) / np.sum(sin_mom ** 2) + p_slash = -1j * (sin_mom[0] * gamma[0] + sin_mom[1] * gamma[1] + sin_mom[2] * gamma[2] + sin_mom[3] * gamma[3]) / np.sum(sin_mom ** 2) else: raise Exception("Fermion type '" + fermion + "' not implemented") diff --git a/tests/test_npr.py b/tests/test_npr.py new file mode 100644 index 00000000..fa5cec63 --- /dev/null +++ b/tests/test_npr.py @@ -0,0 +1,12 @@ +import numpy as np +import pyerrors as pe +import pytest + +np.random.seed(0) + + +def test_gamma_matrices(): + for matrix in pe.npr.gamma: + assert np.allclose(matrix @ matrix, np.identity(4)) + assert np.allclose(matrix, matrix.T.conj()) + assert np.allclose(pe.npr.gamma5, pe.npr.gamma[0] @ pe.npr.gamma[1] @ pe.npr.gamma[2] @ pe.npr.gamma[3])