36 #include "Math/complex.h" 38 #include <boost/random.hpp> 40 std::random_device Random::rd;
41 boost::random::mt19937 Random::randomGen(Random::rd());
42 boost::random::uniform_real_distribution<double> Random::randomUniformInterval(0.0, 1.0);
48 return randomUniformInterval(randomGen);
57 complex u1[3], u2[3], u3[3];
60 for(
int i = 0; i < 3; i++){
69 for(
int i = 0; i < 3; i++)
70 w1 += v1[i].real*v1[i].real + v1[i].imag*v1[i].imag;
72 for(
int i = 0; i < 3; i++)
77 for(
int i = 0; i < 3; i++){
78 v2u1 += v2[i]*(~u1[i]);
80 for(
int i = 0; i < 3; i++){
81 v2[i] = v2[i] - v2u1*u1[i];
86 for(
int i = 0; i < 3; i++)
87 w2 += v2[i].real*v2[i].real + v2[i].imag*v2[i].imag;
89 for(
int i = 0; i < 3; i++)
93 u3[0] = ~(u1[1]*u2[2] - u1[2]*u2[1]);
94 u3[1] = ~(u1[2]*u2[0] - u1[0]*u2[2]);
95 u3[2] = ~(u1[0]*u2[1] - u1[1]*u2[0]);
97 for(
int i = 0; i < 3; i++){
98 result.mat[2*i] = u1[i].real;
99 result.mat[2*i+1] = u1[i].imag;
100 result.mat[6+2*i] = u2[i].real;
101 result.mat[6+2*i+1] = u2[i].imag;
102 result.mat[12+2*i] = u3[i].real;
103 result.mat[12+2*i+1] = u3[i].imag;
105 return std::move(result);
129 for(
int i = 1; i < 4; i++){
136 x[0] = -sqrt(1-epsilon*epsilon);
138 x[0] = sqrt(1-epsilon*epsilon);
139 for(
int i = 1; i < 4; i++)
140 x[i] = x[i] * epsilon / norm;
154 for(
int i = 1; i < 4; i++){
161 x[0] = -sqrt(1-epsilon*epsilon);
163 x[0] = sqrt(1-epsilon*epsilon);
164 for(
int i = 1; i < 4; i++)
165 x[i] = x[i] * epsilon / norm;
180 for(
int i = 1; i < 4; i++){
187 x[0] = -sqrt(1-epsilon*epsilon);
189 x[0] = sqrt(1-epsilon*epsilon);
190 for(
int i = 1; i < 4; i++)
191 x[i] = x[i] * epsilon / norm;
202 return std::move(R*S*T);
static SU3 randSU3()
returns random SU3 matrix, by choosing 2 random complex vectors as the first two columns, orthogonalizing them and taking the outer product as a third column
Implementation of a class to perform arithmetics between links.
static double randUniform()
returns a number from a uniform distribution between 0 and 1
static SU3 randSU3Transf(double epsilon)
returns a random SU3 element with controlled spread around the unity matrix.
Basic library to implement SU3 matrix arithmetics and functions.
Contains the definition of the Random class.