32 FPFlushDenormals flush_denormals;
33 (void)flush_denormals;
36 const int cMaxSweeps = 50;
54 for (
uint ip = 0; ip < n; ++ip)
60 outEigVal[ip] = a(ip, ip);
66 for (
int sweep = 0; sweep < cMaxSweeps; ++sweep)
70 for (
uint ip = 0; ip < n - 1; ++ip)
71 for (
uint iq = ip + 1; iq < n; ++iq)
78 #ifdef JPH_ENABLE_ASSERTS
79 for (
uint c = 0; c < n; ++c)
96 float tresh = sweep < 4? 0.2f * sm /
Square(n) : 0.0f;
98 for (
uint ip = 0; ip < n - 1; ++ip)
99 for (
uint iq = ip + 1; iq < n; ++iq)
101 float g = 100.0f * abs(a(ip, iq));
105 && abs(outEigVal[ip]) + g == abs(outEigVal[ip])
106 && abs(outEigVal[iq]) + g == abs(outEigVal[iq]))
110 else if (abs(a(ip, iq)) > tresh)
112 float h = outEigVal[iq] - outEigVal[ip];
115 if (abs(h) + g == abs(h))
121 float theta = 0.5f * h / a(ip, iq);
122 t = 1.0f / (abs(theta) + sqrt(1.0f + theta * theta));
123 if (theta < 0.0f) t = -t;
126 float c = 1.0f / sqrt(1.0f + t * t);
128 float tau = s / (1.0f + c);
144 #define JPH_EVS_ROTATE(a, i, j, k, l) \
147 a(i, j) = g - s * (h + g * tau), \
148 a(k, l) = h + s * (g - h * tau)
156 #undef JPH_EVS_ROTATE
162 for (
uint ip = 0; ip < n; ++ip)
165 outEigVal[ip] = b[ip];
JPH_NAMESPACE_BEGIN bool EigenValueSymmetric(const Matrix &inMatrix, Matrix &outEigVec, Vector &outEigVal)
Definition EigenValueSymmetric.h:29