36 #include "operators.hpp" 54 : tao::operators::commutative_addable< SU3 >,
55 tao::operators::subtractable< SU3 >,
56 tao::operators::multipliable< SU3 >,
57 tao::operators::addable_left< SU3, double >,
58 tao::operators::subtractable_left< SU3, double >,
59 tao::operators::addable< SU3, double >,
60 tao::operators::subtractable< SU3, double >,
61 tao::operators::multipliable< SU3, double >
63 std::array<double, 18> mat;
67 SU3 (
double value) noexcept;
68 SU3 (
const SU3 &source) noexcept;
69 SU3 (
SU3 && source) noexcept;
72 inline SU3& operator=(
const SU3& other) noexcept;
73 inline SU3& operator=(
SU3&& other) noexcept;
75 inline SU3& operator+=(
const SU3& other ) noexcept;
76 inline SU3& operator+=(
SU3&& other ) noexcept;
78 inline SU3& operator-=(
const SU3& other ) noexcept;
79 inline SU3& operator-=(
SU3&& other ) noexcept;
81 inline SU3& operator*=(
const SU3& other ) noexcept;
82 inline SU3& operator*=(
SU3&& other ) noexcept;
85 inline SU3& operator+=(
const double scalar ) noexcept;
86 inline SU3& operator-=(
const double scalar ) noexcept;
87 inline SU3& operator*=(
const double scalar ) noexcept;
90 void setSU3Identity();
106 SU3& SU3::operator=(
SU3&& other) noexcept{
107 mat = std::move(other.mat);
111 SU3& SU3::operator=(
const SU3& other) noexcept{
117 SU3& SU3::operator+=(
SU3&& other) noexcept{
118 for(
int i = 0; i < 18; i++)
119 mat[i] += other.mat[i];
123 SU3& SU3::operator+=(
const SU3& other) noexcept{
124 for(
int i = 0; i < 18; i++)
125 mat[i] += other.mat[i];
130 SU3& SU3::operator-=(
SU3&& other) noexcept{
131 for(
int i = 0; i < 18; i++)
132 mat[i] -= other.mat[i];
136 SU3& SU3::operator-=(
const SU3& other) noexcept{
137 for(
int i = 0; i < 18; i++)
138 mat[i] -= other.mat[i];
143 SU3& SU3::operator*=(
const SU3& other) noexcept{
146 result.mat[0] = mat[0] * other.mat[0] - mat[1]*other.mat[1] + mat[2] * other.mat[6] - mat[3]*other.mat[7] + mat[4] * other.mat[12] - mat[5]*other.mat[13];
147 result.mat[2] = mat[0] * other.mat[2] - mat[1]*other.mat[3] + mat[2] * other.mat[8] - mat[3]*other.mat[9] + mat[4] * other.mat[14] - mat[5]*other.mat[15];
148 result.mat[4] = mat[0] * other.mat[4] - mat[1]*other.mat[5] + mat[2] * other.mat[10] - mat[3]*other.mat[11] + mat[4] * other.mat[16] - mat[5]*other.mat[17];
149 result.mat[6] = mat[6] * other.mat[0] - mat[7]*other.mat[1] + mat[8] * other.mat[6] - mat[9]*other.mat[7] + mat[10] * other.mat[12] - mat[11]*other.mat[13];
150 result.mat[8] = mat[6] * other.mat[2] - mat[7]*other.mat[3] + mat[8] * other.mat[8] - mat[9]*other.mat[9] + mat[10] * other.mat[14] - mat[11]*other.mat[15];
151 result.mat[10] = mat[6] * other.mat[4] - mat[7]*other.mat[5] + mat[8] * other.mat[10] - mat[9]*other.mat[11] + mat[10] * other.mat[16] - mat[11]*other.mat[17];
152 result.mat[12] = mat[12] * other.mat[0] - mat[13]*other.mat[1] + mat[14] * other.mat[6] - mat[15]*other.mat[7] + mat[16] * other.mat[12] - mat[17]*other.mat[13];
153 result.mat[14] = mat[12] * other.mat[2] - mat[13]*other.mat[3] + mat[14] * other.mat[8] - mat[15]*other.mat[9] + mat[16] * other.mat[14] - mat[17]*other.mat[15];
154 result.mat[16] = mat[12] * other.mat[4] - mat[13]*other.mat[5] + mat[14] * other.mat[10] - mat[15]*other.mat[11] + mat[16] * other.mat[16] - mat[17]*other.mat[17];
158 result.mat[1] = mat[0] * other.mat[1] + mat[1]*other.mat[0] + mat[2] * other.mat[7] + mat[3]*other.mat[6] + mat[4] * other.mat[13] + mat[5]*other.mat[12];
159 result.mat[3] = mat[0] * other.mat[3] + mat[1]*other.mat[2] + mat[2] * other.mat[9] + mat[3]*other.mat[8] + mat[4] * other.mat[15] + mat[5]*other.mat[14];
160 result.mat[5] = mat[0] * other.mat[5] + mat[1]*other.mat[4] + mat[2] * other.mat[11] + mat[3]*other.mat[10] + mat[4] * other.mat[17] + mat[5]*other.mat[16];
161 result.mat[7] = mat[6] * other.mat[1] + mat[7]*other.mat[0] + mat[8] * other.mat[7] + mat[9]*other.mat[6] + mat[10] * other.mat[13] + mat[11]*other.mat[12];
162 result.mat[9] = mat[6] * other.mat[3] + mat[7]*other.mat[2] + mat[8] * other.mat[9] + mat[9]*other.mat[8] + mat[10] * other.mat[15] + mat[11]*other.mat[14];
163 result.mat[11] = mat[6] * other.mat[5] + mat[7]*other.mat[4] + mat[8] * other.mat[11] + mat[9]*other.mat[10] + mat[10] * other.mat[17] + mat[11]*other.mat[16];
164 result.mat[13] = mat[12] * other.mat[1] + mat[13]*other.mat[0] + mat[14] * other.mat[7] + mat[15]*other.mat[6] + mat[16] * other.mat[13] + mat[17]*other.mat[12];
165 result.mat[15] = mat[12] * other.mat[3] + mat[13]*other.mat[2] + mat[14] * other.mat[9] + mat[15]*other.mat[8] + mat[16] * other.mat[15] + mat[17]*other.mat[14];
166 result.mat[17] = mat[12] * other.mat[5] + mat[13]*other.mat[4] + mat[14] * other.mat[11] + mat[15]*other.mat[10] + mat[16] * other.mat[17] + mat[17]*other.mat[16];
182 return *
this = result;
185 SU3& SU3::operator*=(
SU3&& other) noexcept{
188 result.mat[0] = mat[0] * other.mat[0] - mat[1]*other.mat[1] + mat[2] * other.mat[6] - mat[3]*other.mat[7] + mat[4] * other.mat[12] - mat[5]*other.mat[13];
189 result.mat[2] = mat[0] * other.mat[2] - mat[1]*other.mat[3] + mat[2] * other.mat[8] - mat[3]*other.mat[9] + mat[4] * other.mat[14] - mat[5]*other.mat[15];
190 result.mat[4] = mat[0] * other.mat[4] - mat[1]*other.mat[5] + mat[2] * other.mat[10] - mat[3]*other.mat[11] + mat[4] * other.mat[16] - mat[5]*other.mat[17];
191 result.mat[6] = mat[6] * other.mat[0] - mat[7]*other.mat[1] + mat[8] * other.mat[6] - mat[9]*other.mat[7] + mat[10] * other.mat[12] - mat[11]*other.mat[13];
192 result.mat[8] = mat[6] * other.mat[2] - mat[7]*other.mat[3] + mat[8] * other.mat[8] - mat[9]*other.mat[9] + mat[10] * other.mat[14] - mat[11]*other.mat[15];
193 result.mat[10] = mat[6] * other.mat[4] - mat[7]*other.mat[5] + mat[8] * other.mat[10] - mat[9]*other.mat[11] + mat[10] * other.mat[16] - mat[11]*other.mat[17];
194 result.mat[12] = mat[12] * other.mat[0] - mat[13]*other.mat[1] + mat[14] * other.mat[6] - mat[15]*other.mat[7] + mat[16] * other.mat[12] - mat[17]*other.mat[13];
195 result.mat[14] = mat[12] * other.mat[2] - mat[13]*other.mat[3] + mat[14] * other.mat[8] - mat[15]*other.mat[9] + mat[16] * other.mat[14] - mat[17]*other.mat[15];
196 result.mat[16] = mat[12] * other.mat[4] - mat[13]*other.mat[5] + mat[14] * other.mat[10] - mat[15]*other.mat[11] + mat[16] * other.mat[16] - mat[17]*other.mat[17];
200 result.mat[1] = mat[0] * other.mat[1] + mat[1]*other.mat[0] + mat[2] * other.mat[7] + mat[3]*other.mat[6] + mat[4] * other.mat[13] + mat[5]*other.mat[12];
201 result.mat[3] = mat[0] * other.mat[3] + mat[1]*other.mat[2] + mat[2] * other.mat[9] + mat[3]*other.mat[8] + mat[4] * other.mat[15] + mat[5]*other.mat[14];
202 result.mat[5] = mat[0] * other.mat[5] + mat[1]*other.mat[4] + mat[2] * other.mat[11] + mat[3]*other.mat[10] + mat[4] * other.mat[17] + mat[5]*other.mat[16];
203 result.mat[7] = mat[6] * other.mat[1] + mat[7]*other.mat[0] + mat[8] * other.mat[7] + mat[9]*other.mat[6] + mat[10] * other.mat[13] + mat[11]*other.mat[12];
204 result.mat[9] = mat[6] * other.mat[3] + mat[7]*other.mat[2] + mat[8] * other.mat[9] + mat[9]*other.mat[8] + mat[10] * other.mat[15] + mat[11]*other.mat[14];
205 result.mat[11] = mat[6] * other.mat[5] + mat[7]*other.mat[4] + mat[8] * other.mat[11] + mat[9]*other.mat[10] + mat[10] * other.mat[17] + mat[11]*other.mat[16];
206 result.mat[13] = mat[12] * other.mat[1] + mat[13]*other.mat[0] + mat[14] * other.mat[7] + mat[15]*other.mat[6] + mat[16] * other.mat[13] + mat[17]*other.mat[12];
207 result.mat[15] = mat[12] * other.mat[3] + mat[13]*other.mat[2] + mat[14] * other.mat[9] + mat[15]*other.mat[8] + mat[16] * other.mat[15] + mat[17]*other.mat[14];
208 result.mat[17] = mat[12] * other.mat[5] + mat[13]*other.mat[4] + mat[14] * other.mat[11] + mat[15]*other.mat[10] + mat[16] * other.mat[17] + mat[17]*other.mat[16];
224 return *
this = result;
229 SU3& SU3::operator+=(
const double scalar ) noexcept{
236 SU3& SU3::operator-=(
const double scalar ) noexcept{
243 SU3& SU3::operator*=(
const double scalar ) noexcept{
249 SU3 operator~(
const SU3& a);
255 SU3 getRandomTransformation(
double epsilon);
Implementation of a class to perform arithmetics between links.
double getMultSumTrace(SU3 &a, SU3 &b)
returns the real trace of the product of two SU3 matrices a and b