Largest pole magnitude of a denominator polynomial.
Roots of a[0] + a[1]z^-1 + ... are found via the companion matrix eigenvalues. A return value below 1.0 indicates a stable recurrence; at or above 1.0 the recurrence diverges.
Orders 1 and 2 are closed-form. Higher orders carry an Eigen dependency.
- Parameters
-
| a | Denominator coefficients, a[0] must be non-zero |
- Returns
- Largest |root|, or 0.0 for a constant polynomial
Definition at line 444 of file Coefficients.cpp.
445{
446 size_t order =
a.size();
447 while (order > 1 &&
a[order - 1] == 0.0)
448 --order;
449
450 if (order <= 1)
451 return 0.0;
452
453 const double a0 =
a[0];
454
455 if (order == 2)
456 return std::abs(
a[1] / a0);
457
458 if (order == 3) {
459 const double p =
a[1] / a0;
460 const double q =
a[2] / a0;
461 const double disc = p * p - 4.0 *
q;
462 if (disc >= 0.0) {
463 const double r = std::sqrt(disc);
464 return std::max(std::abs((-p + r) * 0.5), std::abs((-p - r) * 0.5));
465 }
467 }
468
469 const Eigen::Index n = static_cast<Eigen::Index>(order) - 1;
470 Eigen::MatrixXd companion = Eigen::MatrixXd::Zero(n, n);
471 for (Eigen::Index i = 0; i < n; ++i)
472 companion(0, i) = -
a[
static_cast<size_t>(i) + 1] / a0;
473 for (Eigen::Index i = 1; i < n; ++i)
474 companion(i, i - 1) = 1.0;
475
476 Eigen::EigenSolver<Eigen::MatrixXd> solver(companion, false);
478 for (Eigen::Index i = 0; i < solver.eigenvalues().
size(); ++i)
481}
References a, largest, q, and size.
Referenced by MayaFlux::Nodes::Filters::Filter::max_pole_magnitude().