GLAC  1.0
testsuite.h
Go to the documentation of this file.
1 
16 #ifndef TESTSUITE_H
17 #define TESTSUITE_H
18 
20 #include "math/latticemath.h"
21 #include "math/lattice.h"
22 
23 class TestSuite
24 {
25 private:
26  // SU3 Test variables
27  SU3 U1, U2, U3, UAdd, USub, UMul, UC, UT, UCT, UTrace, U_RST, U1Hermitian, U1AntiHermitian;
28 
29  // SU2 Test variables
30  SU2 s1, s2, s3, sAdd, sSub, sMul, sC, sT, sCT, s_r, s_s, s_t;
31 
32  // Complex test variables
33  complex z1, z2, zAdd, zSub, zMul, zDiv, zConj, zSetToMinus;
34  double zNorm, zNormSquared;
35 
36  // Lattice test variables. Since only the matrix changes, we can reuse previous variables
37  std::vector<unsigned int> m_dim;
38  Lattice<SU3> latticeSU3_U1, latticeSU3_U2;
39  Lattice<complex> latticeComplex_z1, latticeComplex_z2;
40  double latticeDoubleValue1, latticeDoubleValue2;
41  Lattice<double> latticeDouble1, latticeDouble2;
42 
43  // Limit we demand matrix properties to be retained at
44  double m_eps = 2*1e-14;
45  double m_tracedMatrix;
46 
47  // Variables used for full lattice testing
48  int m_processRank;
49  int m_numprocs;
50  unsigned int m_N, m_NT;
51  unsigned long int m_subLatticeSize;
52 
53  // Verbose storage
54  bool m_verbose = false;
55 
56  // SU3 generator
57  SU3MatrixGenerator *m_SU3Generator = nullptr;
58 
59  // RNGs
60  std::mt19937_64 m_generator;
61  std::uniform_real_distribution<double> m_uniform_distribution;
62 
63  // Basic matrix property testers
64  bool operationSU2Test(SU2 results, SU2 solution, std::string operation);
65  bool operationSU3Test(SU3 results, SU3 solution, std::string operation);
66 
67  // Inline matrix comparing functions
68  inline bool compareSU3(const SU3 A, const SU3 B);
69  inline bool compareSU2(const SU2 A, const SU2 B);
70  inline bool compareComplex(const complex a, const complex b);
71 
72  // Inline complex dot product function
73  inline complex dot(complex * a, complex * b);
74  inline complex dot2(complex * a, complex * b);
75 
76  // Basic SU3 matrix operation tests
77  bool testSU3Addition();
78  bool testSU3Subtraction();
79  bool testSU3Multiplication();
80  bool testSU3Conjugation();
81  bool testSU3Transpose();
82  bool testSU3ComplexConjugation();
83 
84  // Basic SU2 matrix operation tests
85  bool testSU2Addition();
86  bool testSU2Subtraction();
87  bool testSU2Multiplication();
88  bool testSU2Conjugation();
89  bool testSU2Transpose();
90  bool testSU2ComplexConjugation();
91 
92  // SU2 matrix tests
93  bool testSU2Hermicity();
94  bool checkSU2Hermicity(SU2 H);
95  bool testSU2Orthogonality();
96  bool checkSU2Orthogonality(SU2 H);
97  bool testSU2Norm();
98  bool checkSU2Norm(SU2 H);
99  bool testSU2Determinant();
100  bool checkSU2Determinant(SU2 H);
101 
102  // SU3 matrix tests and their sub-functions
103  bool testSU3Hermicity();
104  bool checkSU3Hermicity(SU3 H);
105  bool testSU3Orthogonality();
106  bool checkSU3Orthogonality(SU3 H);
107  bool testSU3Norm();
108  bool checkSU3Norm(SU3 H);
109  bool testSU3Determinant();
110  bool checkSU3Determinant(SU3 H);
111  bool testSU3Trace();
112  bool testHermitian();
113  bool testAntiHermitian();
114 
115  // Complex class tests
116  bool testComplexAddition();
117  bool testComplexSubtraction();
118  bool testComplexMultiplication();
119  bool testComplexDivision();
120  bool testComplexConjugation();
121  bool testComplexNorm();
122  bool testComplexNormSquared();
123  bool testComplexSetToMinus();
124 
125  // Lattice class tests
126  bool testLatticeAddition();
127  bool testLatticeSubtraction();
128  bool testLatticeMultiplication();
129  bool testLatticeDivision();
130  bool testLatticeTrace();
131  bool testLatticeRealTrace();
132  bool testLatticeImagTrace();
133  bool testLatticeSubtractReal();
134  bool testLatticeSubtractImag();
135  bool testLatticeSum();
136  bool testLatticeSumRealTrace();
137  bool testLatticeSumRealTraceMultiplication();
138  bool testLatticeInverse();
139 
140  // Other tests
141  bool testSU3TraceMultiplication();
142  bool testRSTMultiplication();
143  bool testRSTInverseMultiplication();
144 
145  // Paralell tests
146  bool fullLatticeTests();
147  bool testLatticeShift();
148  bool testFieldGaugeInvariance();
149 public:
150  TestSuite();
151  ~TestSuite();
152 
153  void runFullTestSuite();
154  bool runComplexTests();
155  bool runLatticeTests();
156  bool runSU2Tests();
157  bool runSU3Tests();
158  bool run2x2MatrixTests();
159  bool run3x3MatrixTests();
160  bool runFunctionsTest();
161  void testMatrix(SU3 X);
162 };
163 
164 #endif // TESTSUITE_H
bool runFunctionsTest()
Definition: testsuite.cpp:378
A complex number class, consisting of t.
Definition: complex.h:16
bool runSU2Tests()
Definition: testsuite.cpp:293
bool runSU3Tests()
Definition: testsuite.cpp:314
void testMatrix(SU3 X)
Perform tests on SU3 matrix X.
Definition: testsuite.cpp:1128
class for holding matrices.
Definition: su3.h:18
Class for generating random SU3 matrices.
Definition: su3matrixgenerator.h:20
void runFullTestSuite()
Definition: testsuite.cpp:267
bool run3x3MatrixTests()
Definition: testsuite.cpp:357
~TestSuite()
Definition: testsuite.cpp:263
bool run2x2MatrixTests()
Definition: testsuite.cpp:336
bool runLatticeTests()
Definition: testsuite.cpp:424
Runs unit tests on the methods of GLAC.
Definition: testsuite.h:23
bool runComplexTests()
Definition: testsuite.cpp:399
Class for holding matrices.
Definition: su2.h:21
TestSuite()
Definition: testsuite.cpp:14