30 double sn1 = 1.0 / (rhs.
va[0] * rhs.
va[0] + rhs.
va[1] * rhs.
va[1]
31 + rhs.
va[2] * rhs.
va[2] + rhs.
va[3] * rhs.
va[3]
32 + rhs.
va[4] * rhs.
va[4] + rhs.
va[5] * rhs.
va[5]);
35 va[0] = rhs.
va[0] * sn1;
36 va[1] = rhs.
va[1] * sn1;
37 va[2] = rhs.
va[2] * sn1;
38 va[3] = rhs.
va[3] * sn1;
39 va[4] = rhs.
va[4] * sn1;
40 va[5] = rhs.
va[5] * sn1;
42 double sp1r =
va[0] * rhs.
va[6] +
va[1] * rhs.
va[7]
43 +
va[2] * rhs.
va[8] +
va[3] * rhs.
va[9]
44 +
va[4] * rhs.
va[10] +
va[5] * rhs.
va[11];
45 double sp1i =
va[0] * rhs.
va[7] -
va[1] * rhs.
va[6]
46 +
va[2] * rhs.
va[9] -
va[3] * rhs.
va[8]
47 +
va[4] * rhs.
va[11] -
va[5] * rhs.
va[10];
49 va[6] = rhs.
va[6] - sp1r *
va[0] + sp1i *
va[1];
50 va[7] = rhs.
va[7] - sp1r *
va[1] - sp1i *
va[0];
51 va[8] = rhs.
va[8] - sp1r *
va[2] + sp1i *
va[3];
52 va[9] = rhs.
va[9] - sp1r *
va[3] - sp1i *
va[2];
53 va[10] = rhs.
va[10] - sp1r *
va[4] + sp1i *
va[5];
54 va[11] = rhs.
va[11] - sp1r *
va[5] - sp1i *
va[4];
56 double sn2 = 1.0 / (
va[6] *
va[6] +
va[7] *
va[7]
58 +
va[10] *
va[10] +
va[11] *
va[11]);
65 va[10] =
va[10] * sn2;
66 va[11] =
va[11] * sn2;
98 double sn1 = 1.0 / (
va[0] *
va[0] +
va[1] *
va[1]
126 std::valarray<double> v = eigen_qr.
solve(&
va[0]);
128 for (
int i = 0;
i <
m_Nc; ++
i) {
129 det_arg += std::atan2(v[2 *
i + 1], v[2 *
i]);
132 double inv_re = std::cos(det_arg);
133 double inv_im = -std::sin(det_arg);
136 double re =
va[2 *
i];
137 double im =
va[2 *
i + 1];
139 va[2 *
i] = re * inv_re - im * inv_im;
140 va[2 *
i + 1] = re * inv_im + im * inv_re;
155 static const double PI = 4.0 * atan(1.0);
156 double PI2 = 2.0 * PI;
158 for (
int j = 0; j <
m_Nc; ++j) {
159 int j2 = j * 2 *
m_Nc;
160 double rand1 = rand->
get();
161 double rand2 = rand->
get();
162 double rand3 = rand->
get();
163 double rand4 = rand->
get();
164 double rand5 = rand->
get();
166 double c1 = 1.0 - 2.0 * rand1;
167 double s1 = sqrt(1.0 - c1 * c1);
168 double v1_2 = s1 * cos(PI2 * rand2);
169 double v1_3 = s1 * sin(PI2 * rand2);
171 va[j2 + 0] = c1 * cos(PI2 * rand3);
172 va[j2 + 1] = c1 * sin(PI2 * rand3);
173 va[j2 + 2] = v1_2 * cos(PI2 * rand4);
174 va[j2 + 3] = v1_2 * sin(PI2 * rand4);
175 va[j2 + 4] = v1_3 * cos(PI2 * rand5);
176 va[j2 + 5] = v1_3 * sin(PI2 * rand5);
190 printf(
"Error at Mat_SU_N: set_random for SU(2) is not supported.\n");
202 for (
int j = 0; j <
m_Nc *
m_Nc; ++j) {