Calculate shifted and scaled eigenvalues of the matrix, in ascending value.
375 {
376 using namespace std;
377
378 const float ab =
a *
b;
379 const float corr_ab = fmaf(
a,
b, -ab);
380 const float dd =
d *
d;
381 const float corr_dd = fmaf(
d,
d, -dd);
382 const float ac =
a *
c;
383 const float corr_ac = fmaf(
a,
c, -ac);
384 const float ff =
f *
f;
385 const float corr_ff = fmaf(
f,
f, -ff);
386 const float bc =
b *
c;
387 const float corr_bc = fmaf(
b,
c, -bc);
388 const float ee =
e *
e;
389 const float corr_ee = fmaf(
e,
e, -ee);
390
391 const float c_0 = fmaf(2 *
d,
f *
e,
394
395
396
397 const float c_1 =
CaloRecGPU::Helpers::sum_kahan_babushka_neumaier(ab, -dd, ac, -ff, bc, -ee, corr_ab, -corr_dd, corr_ac, -corr_ff, corr_bc, corr_ee);
398
400
401 constexpr float inv_3 = 1.f / 3.f;
402
403 const float c_2_over_3 = c_2 * inv_3;
404
405 const float a_over_3 =
max(fma(c_2, c_2_over_3, -c_1) * inv_3, 0.f);
406
407 const float half_b = 0.5f * (fma(c_2_over_3, fma(2.f * c_2_over_3, c_2_over_3, -c_1), c_0));
408
410
411
412
413
414
415 const float rho = sqrtf(a_over_3);
416
417#ifdef __CUDA_ARCH__
418 const float theta = atan2f(1.0f, rsqrtf(q) * half_b) * inv_3;
419#else
420 const float theta = atan2f(sqrtf(q), half_b) * inv_3;
421#endif
422
423#ifdef __CUDA_ARCH__
424 float sin_theta, cos_theta;
425 sincosf(
theta, &sin_theta, &cos_theta);
426#else
427 const float sin_theta = sinf(
theta);
428 const float cos_theta = cosf(
theta);
429#endif
430
431 const float sqrt_3 = sqrtf(3.f);
432
433 e_1 = fma(-rho, fma( sqrt_3, sin_theta, cos_theta), c_2_over_3);
434 e_2 = fma(-rho, fma(-sqrt_3, sin_theta, cos_theta), c_2_over_3);
435 e_3 = fma( rho, 2.0f * cos_theta, c_2_over_3);
436 }
Scalar theta() const
theta method
static CUDA_HOS_DEV float product_sum_cornea_harrison_tang(const float a, const float b, const float c, const float d)