27 template <
typename Real>
45 uint32_t
Solve(Real
const*
input, int32_t sortType);
49 void GetEigenvalues(uint32_t& numEigenvalues, Real* eigenvalues)
const;
53 inline Real
const&
A(
int r,
int c)
const;
54 inline Real&
A(
int r,
int c);
61 void House(
int rmin,
int rmax);
65 void RowHouse(
int rmin,
int rmax,
int cmin,
int cmax);
66 void ColHouse(
int rmin,
int rmax,
int cmin,
int cmax);
70 bool GetBlock(std::array<int, 2>& block);
98 template <
typename Real>
106 if (size >= 3 && maxIterations > 0)
123 template <
typename Real>
131 std::array<int, 2> block;
133 uint32_t numIterations;
134 for (numIterations = 0; numIterations <
mMaxIterations; ++numIterations)
155 for (
int i = 0; i <
mSizeM1; ++i)
171 Real a01 =
A(i, i + 1);
172 Real a10 =
A(i + 1, i);
173 Real a11 =
A(i + 1, i + 1);
175 Real det = a00 * a11 - a01 * a10;
176 Real halfTr = tr * (Real)0.5;
177 Real discr = halfTr * halfTr - det;
178 if (discr >= (Real)0)
180 Real rootDiscr = sqrt(discr);
205 std::greater<Real>());
209 return numIterations;
214 template <
typename Real>
228 template <
typename Real>
234 template <
typename Real>
240 template <
typename Real>
244 for (
int r = rmin;
r <= rmax; ++
r)
248 length = sqrt(length);
249 if (length != (Real)0)
251 Real sign = (
mX[rmin] >= (Real)0 ? (Real)1 : (Real)-1);
252 Real invDenom = ((Real)1) / (
mX[rmin] + sign *
length);
253 for (
int r = rmin + 1;
r <= rmax; ++
r)
261 for (
int r = rmin + 1;
r <= rmax; ++
r)
265 Real
scale = ((Real)-2) / dot;
266 for (
int r = rmin;
r <= rmax; ++
r)
272 template <
typename Real>
275 for (
int c = cmin;
c <= cmax; ++
c)
278 for (
int r = rmin;
r <= rmax; ++
r)
284 for (
int r = rmin;
r <= rmax; ++
r)
286 for (
int c = cmin;
c <= cmax; ++
c)
293 template <
typename Real>
296 for (
int r = rmin;
r <= rmax; ++
r)
299 for (
int c = cmin;
c <= cmax; ++
c)
305 for (
int r = rmin;
r <= rmax; ++
r)
307 for (
int c = cmin;
c <= cmax; ++
c)
314 template <
typename Real>
317 for (
int c = 0, cp1 = 1;
c <=
mSize - 3; ++
c, ++cp1)
330 template <
typename Real>
334 int const i0 = rmax - 1, i1 = rmax;
335 Real a00 =
A(i0, i0);
336 Real a01 =
A(i0, i1);
337 Real a10 =
A(i1, i0);
338 Real a11 =
A(i1, i1);
340 Real det = a00 * a11 - a01 * a10;
342 int const j0 = rmin, j1 = j0 + 1, j2 = j1 + 1;
343 Real b00 =
A(j0, j0);
344 Real b01 =
A(j0, j1);
345 Real b10 =
A(j1, j0);
346 Real b11 =
A(j1, j1);
347 Real b21 =
A(j2, j1);
348 mX[rmin] = b00 * (b00 - tr) + b01 * b10 + det;
349 mX[rmin + 1] = b10 * (b00 + b11 - tr);
350 mX[rmin + 2] = b10 * b21;
352 House(rmin, rmin + 2);
353 RowHouse(rmin, rmin + 2, rmin, rmax);
354 ColHouse(rmin, std::min(rmax, rmin + 3), rmin, rmin + 2);
358 for (
int c = 0, cp1 = 1;
c <=
mSize - 3; ++
c, ++cp1)
360 int kmax = std::min(cp1 + 2,
mSizeM1);
361 for (
int r = cp1;
r <= kmax; ++
r)
372 template <
typename Real>
375 for (
int i = 0; i <
mSizeM1; ++i)
378 Real a11 =
A(i + 1, i + 1);
379 Real a21 =
A(i + 1, i);
380 Real sum0 = a00 + a11;
381 Real sum1 = sum0 + a21;
385 for (
int i = 0; i <
mSizeM1; ++i)
394 if (block[1] != block[0])
std::vector< Real > mEigenvalues
std::vector< int > mFlagStorage
GLenum GLenum GLenum GLenum GLenum scale
void ReduceToUpperHessenberg()
Real const & A(int r, int c) const
UnsymmetricEigenvalues(int32_t size, uint32_t maxIterations)
std::vector< Real > mMatrix
bool GetBlock(std::array< int, 2 > &block)
void FrancisQRStep(int rmin, int rmax)
void House(int rmin, int rmax)
void GetEigenvalues(uint32_t &numEigenvalues, Real *eigenvalues) const
void RowHouse(int rmin, int rmax, int cmin, int cmax)
void ColHouse(int rmin, int rmax, int cmin, int cmax)
GLuint GLsizei GLsizei * length
GLenum GLenum GLenum input
std::vector< Real > mScaledV
uint32_t Solve(Real const *input, int32_t sortType)
void Memcpy(void *target, void const *source, size_t count)