15 #ifndef MAT_SU_N_INCLUDED
16 #define MAT_SU_N_INCLUDED
38 std::valarray<double>
va;
53 }
else if (m_Nc == 2) {
114 double r(
int c)
const {
return va[2 * c]; }
115 double i(
int c)
const {
return va[2 * c + 1]; }
117 double r(
int c1,
int c2)
const {
return r(
m_Nc * c1 + c2); }
118 double i(
int c1,
int c2)
const {
return i(
m_Nc * c1 + c2); }
120 void set_r(
int c,
const double& re) {
va[2 * c] = re; }
121 void set_i(
int c,
const double& im) {
va[2 * c + 1] = im; }
123 void set_r(
int c1,
int c2,
const double& re)
128 void set_i(
int c1,
int c2,
const double& im)
133 void set(
int c,
double re,
const double& im)
139 void set(
int c1,
int c2,
const double& re,
const double& im)
144 void add(
int c,
const double& re,
const double& im)
150 void add(
int c1,
int c2,
const double& re,
const double& im)
165 for (
int a = 0; a <
m_Nc; ++a) {
166 for (
int b = 0; b <
m_Nc; ++b) {
167 va[2 * (b + m_Nc * a)] = 0.0;
168 va[2 * (b + m_Nc * a) + 1] = 0.0;
169 for (
int c = 0; c <
m_Nc; ++c) {
170 va[2 * (b + m_Nc * a)] +=
171 u1.
va[2 * (c + m_Nc * a)] * u2.
va[2 * (b + m_Nc * c)]
172 - u1.
va[2 * (c + m_Nc * a) + 1] * u2.
va[2 * (b + m_Nc * c) + 1];
173 va[2 * (b + m_Nc * a) + 1] +=
174 u1.
va[2 * (c + m_Nc * a) + 1] * u2.
va[2 * (b + m_Nc * c)]
175 + u1.
va[2 * (c + m_Nc * a)] * u2.
va[2 * (b + m_Nc * c) + 1];
183 for (
int a = 0; a <
m_Nc; ++a) {
184 for (
int b = 0; b <
m_Nc; ++b) {
185 for (
int c = 0; c <
m_Nc; ++c) {
186 va[2 * (b + m_Nc * a)] +=
187 u1.
va[2 * (c + m_Nc * a)] * u2.
va[2 * (b + m_Nc * c)]
188 - u1.
va[2 * (c + m_Nc * a) + 1] * u2.
va[2 * (b + m_Nc * c) + 1];
189 va[2 * (b + m_Nc * a) + 1] +=
190 u1.
va[2 * (c + m_Nc * a) + 1] * u2.
va[2 * (b + m_Nc * c)]
191 + u1.
va[2 * (c + m_Nc * a)] * u2.
va[2 * (b + m_Nc * c) + 1];
199 for (
int a = 0; a <
m_Nc; ++a) {
200 for (
int b = 0; b <
m_Nc; ++b) {
201 va[2 * (b + m_Nc * a)] = 0.0;
202 va[2 * (b + m_Nc * a) + 1] = 0.0;
203 for (
int c = 0; c <
m_Nc; ++c) {
204 va[2 * (b + m_Nc * a)] +=
205 u1.
va[2 * (c + m_Nc * a)] * u2.
va[2 * (c + m_Nc * b)]
206 + u1.
va[2 * (c + m_Nc * a) + 1] * u2.
va[2 * (c + m_Nc * b) + 1];
207 va[2 * (b + m_Nc * a) + 1] +=
208 u1.
va[2 * (c + m_Nc * a) + 1] * u2.
va[2 * (c + m_Nc * b)]
209 - u1.
va[2 * (c + m_Nc * a)] * u2.
va[2 * (c + m_Nc * b) + 1];
217 for (
int a = 0; a <
m_Nc; ++a) {
218 for (
int b = 0; b <
m_Nc; ++b) {
219 for (
int c = 0; c <
m_Nc; ++c) {
220 va[2 * (b + m_Nc * a)] +=
221 u1.
va[2 * (c + m_Nc * a)] * u2.
va[2 * (c + m_Nc * b)]
222 + u1.
va[2 * (c + m_Nc * a) + 1] * u2.
va[2 * (c + m_Nc * b) + 1];
223 va[2 * (b + m_Nc * a) + 1] +=
224 u1.
va[2 * (c + m_Nc * a) + 1] * u2.
va[2 * (c + m_Nc * b)]
225 - u1.
va[2 * (c + m_Nc * a)] * u2.
va[2 * (c + m_Nc * b) + 1];
233 for (
int a = 0; a <
m_Nc; ++a) {
234 for (
int b = 0; b <
m_Nc; ++b) {
235 va[2 * (b + m_Nc * a)] = 0.0;
236 va[2 * (b + m_Nc * a) + 1] = 0.0;
237 for (
int c = 0; c <
m_Nc; ++c) {
238 va[2 * (b + m_Nc * a)] +=
239 u1.
va[2 * (a + m_Nc * c)] * u2.
va[2 * (b + m_Nc * c)]
240 + u1.
va[2 * (a + m_Nc * c) + 1] * u2.
va[2 * (b + m_Nc * c) + 1];
241 va[2 * (b + m_Nc * a) + 1] -=
242 u1.
va[2 * (a + m_Nc * c) + 1] * u2.
va[2 * (b + m_Nc * c)]
243 - u1.
va[2 * (a + m_Nc * c)] * u2.
va[2 * (b + m_Nc * c) + 1];
251 for (
int a = 0; a <
m_Nc; ++a) {
252 for (
int b = 0; b <
m_Nc; ++b) {
253 for (
int c = 0; c <
m_Nc; ++c) {
254 va[2 * (b + m_Nc * a)] +=
255 u1.
va[2 * (a + m_Nc * c)] * u2.
va[2 * (b + m_Nc * c)]
256 + u1.
va[2 * (a + m_Nc * c) + 1] * u2.
va[2 * (b + m_Nc * c) + 1];
257 va[2 * (b + m_Nc * a) + 1] -=
258 u1.
va[2 * (a + m_Nc * c) + 1] * u2.
va[2 * (b + m_Nc * c)]
259 - u1.
va[2 * (a + m_Nc * c)] * u2.
va[2 * (b + m_Nc * c) + 1];
267 for (
int cc = 0; cc <
m_Nc *
m_Nc; ++cc) {
268 va[2 * cc] = re * v.
va[2 * cc] - im * v.
va[2 * cc + 1];
269 va[2 * cc + 1] = re * v.
va[2 * cc + 1] + im * v.
va[2 * cc];
275 for (
int cc = 0; cc <
m_Nc *
m_Nc; ++cc) {
276 va[2 * cc] += re * v.
va[2 * cc] - im * v.
va[2 * cc + 1];
277 va[2 * cc + 1] += re * v.
va[2 * cc + 1] + im * v.
va[2 * cc];
285 for (
int a = 0; a <
m_Nc; ++a) {
286 for (
int b = a; b <
m_Nc; ++b) {
287 double re =
va[2 * (m_Nc * a + b)];
288 double im =
va[2 * (m_Nc * a + b) + 1];
290 va[2 * (m_Nc * a + b)] =
va[2 * (m_Nc * b + a)];
291 va[2 * (m_Nc * a + b) + 1] = -va[2 * (m_Nc * b + a) + 1];
293 va[2 * (m_Nc * b + a)] = re;
294 va[2 * (m_Nc * b + a) + 1] = -im;
303 for (
int a = 0; a <
m_Nc; ++a) {
304 for (
int b = a + 1; b <
m_Nc; ++b) {
305 double re =
va[2 * (m_Nc * a + b)] +
va[2 * (m_Nc * b + a)];
306 double im =
va[2 * (m_Nc * a + b) + 1] -
va[2 * (m_Nc * b + a) + 1];
308 va[2 * (m_Nc * a + b)] = 0.5 * re;
309 va[2 * (m_Nc * a + b) + 1] = 0.5 * im;
311 va[2 * (m_Nc * b + a)] = 0.5 * re;
312 va[2 * (m_Nc * b + a) + 1] = -0.5 * im;
316 for (
int cc = 0; cc <
m_Nc; ++cc) {
317 tr +=
va[2 * (m_Nc * cc + cc)];
320 for (
int cc = 0; cc <
m_Nc; ++cc) {
321 va[2 * (m_Nc * cc + cc)] -= tr;
322 va[2 * (m_Nc * cc + cc) + 1] = 0.0;
331 for (
int a = 0; a <
m_Nc; ++a) {
332 for (
int b = a + 1; b <
m_Nc; ++b) {
333 double re =
va[2 * (m_Nc * a + b)] -
va[2 * (m_Nc * b + a)];
334 double im =
va[2 * (m_Nc * a + b) + 1] +
va[2 * (m_Nc * b + a) + 1];
336 va[2 * (m_Nc * a + b)] = 0.5 * re;
337 va[2 * (m_Nc * a + b) + 1] = 0.5 * im;
339 va[2 * (m_Nc * b + a)] = -0.5 * re;
340 va[2 * (m_Nc * b + a) + 1] = 0.5 * im;
344 for (
int cc = 0; cc <
m_Nc; ++cc) {
345 tr +=
va[2 * (m_Nc * cc + cc) + 1];
348 for (
int cc = 0; cc <
m_Nc; ++cc) {
349 va[2 * (m_Nc * cc + cc)] = 0.0;
350 va[2 * (m_Nc * cc + cc) + 1] -= tr;
359 for (
int a = 0; a <
m_Nc; ++a) {
360 for (
int b = a; b <
m_Nc; ++b) {
361 double re =
va[2 * (m_Nc * a + b)] -
va[2 * (m_Nc * b + a)];
362 double im =
va[2 * (m_Nc * a + b) + 1] +
va[2 * (m_Nc * b + a) + 1];
363 va[2 * (m_Nc * a + b)] = 0.5 * re;
364 va[2 * (m_Nc * a + b) + 1] = 0.5 * im;
365 va[2 * (m_Nc * b + a)] = -0.5 * re;
366 va[2 * (m_Nc * b + a) + 1] = 0.5 * im;
376 for (
int c = 0; c <
m_Nc; ++c) {
377 va[2 * (m_Nc + 1) * c] = 1.0;
392 for (
int c = 0; c <
va.size() / 2; ++c) {
393 double tmp =
va[2 * c];
394 va[2 * c] = -
va[2 * c + 1];
445 std::valarray<double> tmp(2 *
m_Nc *
m_Nc);
447 for (
int a = 0; a <
m_Nc; ++a) {
448 for (
int b = 0; b <
m_Nc; ++b) {
449 tmp[2 * (m_Nc * a + b)] = 0.0;
450 tmp[2 * (m_Nc * a + b) + 1] = 0.0;
451 for (
int c = 0; c <
m_Nc; ++c) {
452 tmp[2 * (m_Nc * a + b)] +=
va[2 * (m_Nc * a + c)] * rhs.
va[2 * (m_Nc * c + b)]
453 -
va[2 * (m_Nc * a + c) + 1] * rhs.
va[2 * (m_Nc * c + b) + 1];
454 tmp[2 * (m_Nc * a + b) + 1] +=
va[2 * (m_Nc * a + c) + 1] * rhs.
va[2 * (m_Nc * c + b)]
455 +
va[2 * (m_Nc * a + c)] * rhs.
va[2 * (m_Nc * c + b) + 1];
493 for (
int c = 0; c < Nc; ++c) {
505 for (
int c = 0; c < Nc; ++c) {
517 for (
int a = 0; a < Nc; a++) {
518 for (
int b = 0; b < Nc; b++) {
519 tmp.
set(a, b, u.
r(b, a), -u.
i(b, a));
531 for (
int c = 0; c < u.
size() / 2; ++c) {
532 tmp.
set(c, -u.
i(c), u.
r(c));
586 for (
int iprec = 0; iprec < Nprec; ++iprec) {
587 double exp_factor = alpha / (Nprec - iprec);
Mat_SU_N & set_random(RandomNumbers *rand)
void mult_dn(const Mat_SU_N &u1, const Mat_SU_N &u2)
Mat_SU_N operator+(const Mat_SU_N &m1, const Mat_SU_N &m2)
void add(int c1, int c2, const double &re, const double &im)
Mat_SU_N & operator=(const double &)
Mat_SU_N & set_random_SU3(RandomNumbers *)
Mat_SU_N & operator/=(const double &)
double r(int c1, int c2) const
Mat_SU_N & operator+=(const Mat_SU_N &)
Mat_SU_N & at()
antihermitian traceless
Mat_SU_N(int Nc, double r=0.0)
void set(int c1, int c2, const double &re, const double &im)
void zcopy(double re, double im, const Mat_SU_N &v)
void multadd_dn(const Mat_SU_N &u1, const Mat_SU_N &u2)
Mat_SU_N & operator-=(const Mat_SU_N &)
void set_i(int c, const double &im)
void add(int c, const double &re, const double &im)
Mat_SU_N dag(const Mat_SU_N &u)
void set_r(int c, const double &re)
void multadd_nn(const Mat_SU_N &u1, const Mat_SU_N &u2)
Mat_SU_N & set_random_general(RandomNumbers *)
Mat_SU_N reunit(const Mat_SU_N &m)
Mat_SU_N xI(const Mat_SU_N &u)
void set_i(int c1, int c2, const double &im)
void set_r(int c1, int c2, const double &re)
Mat_SU_N & ah()
antihermitian
double ImTr(const Mat_SU_N &m)
void mult_nd(const Mat_SU_N &u1, const Mat_SU_N &u2)
Mat_SU_N operator-(const Mat_SU_N &m1, const Mat_SU_N &m2)
std::valarray< double > va
double i(int c1, int c2) const
void multadd_nd(const Mat_SU_N &u1, const Mat_SU_N &u2)
Mat_SU_N operator*(const Mat_SU_N &m1, const Mat_SU_N &m2)
Mat_SU_N & operator*=(const Mat_SU_N &)
Base class of random number generators.
Mat_SU_N & reunit_general()
Mat_SU_N mat_exp(const double alpha, const Mat_SU_N &iv, const Mat_SU_N &u, const int Nprec)
Mat_SU_N &(Mat_SU_N::* m_reunit)()
void set(int c, double re, const double &im)
void zaxpy(double re, double im, const Mat_SU_N &v)
Mat_SU_N &(SU_N::Mat_SU_N::* m_set_random)(RandomNumbers *)
pointer to reunitalization.
void mult_nn(const Mat_SU_N &u1, const Mat_SU_N &u2)
Mat_SU_N & set_random_SU2(RandomNumbers *)
double ReTr(const Mat_SU_N &m)