7 #ifndef SELECTION_RULE_H 8 #define SELECTION_RULE_H 88 class ElemType<std::
complex<T> >
100 template <
typename Scalar,
int SelectionRule>
107 throw std::invalid_argument(
"incompatible selection rule");
114 template <
typename Scalar>
115 class SortingTarget<Scalar, LARGEST_MAGN>
127 template <
typename RealType>
131 static RealType
get(
const std::complex<RealType>& val)
139 template <
typename RealType>
143 static RealType
get(
const std::complex<RealType>& val)
146 return -
abs(val.imag());
152 template <
typename Scalar>
153 class SortingTarget<Scalar, LARGEST_ALGE>
156 static Scalar
get(
const Scalar& val)
166 template <
typename Scalar>
167 class SortingTarget<Scalar, BOTH_ENDS>
170 static Scalar
get(
const Scalar& val)
178 template <
typename Scalar>
179 class SortingTarget<Scalar, SMALLEST_MAGN>
191 template <
typename RealType>
195 static RealType
get(
const std::complex<RealType>& val)
203 template <
typename RealType>
207 static RealType
get(
const std::complex<RealType>& val)
210 return abs(val.imag());
216 template <
typename Scalar>
217 class SortingTarget<Scalar, SMALLEST_ALGE>
220 static Scalar
get(
const Scalar& val)
227 template <
typename PairType>
231 bool operator()(
const PairType&
v1,
const PairType&
v2)
233 return v1.first < v2.first;
237 template <
typename T,
int SelectionRule>
243 typedef std::pair<TargetType, int> PairType;
246 std::vector<PairType> pair_sort;
249 SortEigenvalue(
const T* start,
int size) :
255 pair_sort[
i].second =
i;
257 PairComparator<PairType> comp;
258 std::sort(pair_sort.begin(), pair_sort.end(), comp);
261 std::vector<int> index()
263 std::vector<int> ind(pair_sort.size());
264 for (
unsigned int i = 0;
i < ind.size();
i++)
265 ind[
i] = pair_sort[
i].second;
275 #endif // SELECTION_RULE_H
Select eigenvalues with smallest imaginary part (in magnitude). Only for general eigen solvers...
Select eigenvalues with smallest algebraic value. Only for symmetric eigen solvers.
Select eigenvalues with largest real part. Only for general eigen solvers.
Select eigenvalues with smallest real part. Only for general eigen solvers.
Select eigenvalues with largest imaginary part (in magnitude). Only for general eigen solvers...
Container::iterator get(Container &c, Position position)