25#define SQR(x) ((x)*(x))
26#define SQR_ABS(x) (SQR(real(x)) + SQR(imag(x)))
30void zhetrd3(std::complex<double> A[3][3], std::complex<double> Q[3][3],
31 double d[3],
double e[2])
43 std::complex<double> u[n], q[n];
44 std::complex<double> omega, f;
49 for (
int i=0; i < n; i++)
52 for (
int j=0; j < i; j++)
53 Q[i][j] = Q[j][i] = 0.0;
59 if (real(A[0][1]) > 0)
65 u[1] = conj(A[0][1]) - g;
69 if (real(omega) > 0.0)
71 omega = 0.5 * (1.0 + conj(omega)/omega) / real(omega);
73 for (
int i=1; i < n; i++)
75 f = conj(A[1][i]) * u[1] + A[i][2] * u[2];
77 K += real(conj(u[i]) * f);
81 for (
int i=1; i < n; i++)
82 q[i] = q[i] - K * u[i];
85 d[1] = real(A[1][1]) - 2.0*real(q[1]*conj(u[1]));
86 d[2] = real(A[2][2]) - 2.0*real(q[2]*conj(u[2]));
90 for (
int j=1; j < n; j++)
92 f = omega * conj(u[j]);
93 for (
int i=1; i < n; i++)
94 Q[i][j] = Q[i][j] - f*u[i];
99 f = A[1][2] - q[1]*conj(u[2]) - u[1]*conj(q[2]);
103 for (
int i=0; i < n; i++)
104 d[i] = real(A[i][i]);
114 for (
int i=1; i < n; i++)
115 Q[i][n-1] = Q[i][n-1] * f;
void zhetrd3(std::complex< double > A[3][3], std::complex< double > Q[3][3], double d[3], double e[2])