mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
@@ -82,8 +82,8 @@ class PolynomialSolverBase {
|
||||
}
|
||||
|
||||
protected:
|
||||
template <typename squaredNormBinaryPredicate>
|
||||
inline const RootType& selectComplexRoot_withRespectToNorm(squaredNormBinaryPredicate& pred) const {
|
||||
template <typename Predicate>
|
||||
inline const RootType& selectComplexRoot_withRespectToNorm(Predicate& pred) const {
|
||||
Index res = 0;
|
||||
RealScalar norm2 = numext::abs2(m_roots[0]);
|
||||
for (Index i = 1; i < m_roots.size(); ++i) {
|
||||
@@ -114,25 +114,25 @@ class PolynomialSolverBase {
|
||||
}
|
||||
|
||||
protected:
|
||||
template <typename squaredRealPartBinaryPredicate>
|
||||
template <typename Predicate>
|
||||
inline const RealScalar& selectRealRoot_withRespectToAbsRealPart(
|
||||
squaredRealPartBinaryPredicate& pred, bool& hasArealRoot,
|
||||
Predicate& pred, bool& hasArealRoot,
|
||||
const RealScalar& absImaginaryThreshold = NumTraits<Scalar>::dummy_precision()) const {
|
||||
using std::abs;
|
||||
hasArealRoot = false;
|
||||
Index res = 0;
|
||||
RealScalar abs2(0);
|
||||
RealScalar val(0);
|
||||
|
||||
for (Index i = 0; i < m_roots.size(); ++i) {
|
||||
if (abs(m_roots[i].imag()) <= absImaginaryThreshold) {
|
||||
if (!hasArealRoot) {
|
||||
hasArealRoot = true;
|
||||
res = i;
|
||||
abs2 = m_roots[i].real() * m_roots[i].real();
|
||||
val = abs(m_roots[i].real());
|
||||
} else {
|
||||
const RealScalar currAbs2 = m_roots[i].real() * m_roots[i].real();
|
||||
if (pred(currAbs2, abs2)) {
|
||||
abs2 = currAbs2;
|
||||
const RealScalar curr = abs(m_roots[i].real());
|
||||
if (pred(curr, val)) {
|
||||
val = curr;
|
||||
res = i;
|
||||
}
|
||||
}
|
||||
@@ -145,9 +145,9 @@ class PolynomialSolverBase {
|
||||
return numext::real_ref(m_roots[res]);
|
||||
}
|
||||
|
||||
template <typename RealPartBinaryPredicate>
|
||||
template <typename Predicate>
|
||||
inline const RealScalar& selectRealRoot_withRespectToRealPart(
|
||||
RealPartBinaryPredicate& pred, bool& hasArealRoot,
|
||||
Predicate& pred, bool& hasArealRoot,
|
||||
const RealScalar& absImaginaryThreshold = NumTraits<Scalar>::dummy_precision()) const {
|
||||
using std::abs;
|
||||
hasArealRoot = false;
|
||||
|
||||
Reference in New Issue
Block a user