1 #ifndef SELECTION_RULE_H
2 #define SELECTION_RULE_H
66 template <
typename Scalar,
int SelectionRule>
67 class EigenvalueComparator
70 typedef std::pair<Scalar, int> SortPair;
75 template <
typename Scalar>
79 typedef std::pair<Scalar, int> SortPair;
81 bool operator() (SortPair v1, SortPair v2)
83 return std::abs(v1.first) > std::abs(v2.first);
89 template <
typename RealType>
90 class EigenvalueComparator<std::complex<RealType>,
LARGEST_REAL>
93 typedef std::pair<std::complex<RealType>,
int> SortPair;
95 bool operator() (SortPair v1, SortPair v2)
97 return v1.first.real() > v2.first.real();
103 template <
typename RealType>
104 class EigenvalueComparator<std::complex<RealType>,
LARGEST_IMAG>
107 typedef std::pair<std::complex<RealType>,
int> SortPair;
109 bool operator() (SortPair v1, SortPair v2)
111 return std::abs(v1.first.imag()) > std::abs(v2.first.imag());
117 template <
typename Scalar>
121 typedef std::pair<Scalar, int> SortPair;
123 bool operator() (SortPair v1, SortPair v2)
125 return v1.first > v2.first;
133 template <
typename Scalar>
134 class EigenvalueComparator<Scalar,
BOTH_ENDS>
137 typedef std::pair<Scalar, int> SortPair;
139 bool operator() (SortPair v1, SortPair v2)
141 return v1.first > v2.first;
147 template <
typename Scalar>
151 typedef std::pair<Scalar, int> SortPair;
153 bool operator() (SortPair v1, SortPair v2)
155 return std::abs(v1.first) <= std::abs(v2.first);
161 template <
typename RealType>
162 class EigenvalueComparator<std::complex<RealType>,
SMALLEST_REAL>
165 typedef std::pair<std::complex<RealType>,
int> SortPair;
167 bool operator() (SortPair v1, SortPair v2)
169 return v1.first.real() <= v2.first.real();
175 template <
typename RealType>
176 class EigenvalueComparator<std::complex<RealType>,
SMALLEST_IMAG>
179 typedef std::pair<std::complex<RealType>,
int> SortPair;
181 bool operator() (SortPair v1, SortPair v2)
183 return std::abs(v1.first.imag()) <= std::abs(v2.first.imag());
189 template <
typename Scalar>
193 typedef std::pair<Scalar, int> SortPair;
195 bool operator() (SortPair v1, SortPair v2)
197 return v1.first <= v2.first;
203 #endif // SELECTION_RULE_H
Select eigenvalues with smallest imaginary part (in magnitude). Only for general eigen solvers...
Select eigenvalues with largest imaginary part (in magnitude). Only for general eigen solvers...
Select eigenvalues with largest real part. Only for general eigen solvers.
Select eigenvalues with smallest algebraic value. Only for symmetric eigen solvers.
Select eigenvalues with smallest real part. Only for general eigen solvers.