Class xlifepp::BasicSort#
-
template<class MagnitudeType>
class BasicSort : public xlifepp::SortManager<MagnitudeType>#
-
Inheritence diagram for xlifepp::BasicSort:
Collaboration diagram for xlifepp::BasicSort:
An implementation of the xlifepp::SortManager that performs a collection of common sorting techniques.
Public Functions
-
BasicSort(const std::string &which = "LM")#
-
String driven constructor.
Directly pass the string specifying sort strategy. See setSortType() for valid options.
-
BasicSort(Parameters &pl)#
-
Parameter list driven constructor.
This constructor accepts a paramter list with the following options:
"Sort Strategy"
- astring
specifying the desired sorting strategy. See setSortType() for valid options.
-
virtual ~BasicSort()#
-
Destructor.
-
void setSortType(const std::string &which)#
-
Set sort type.
- Parameters:
-
which – [in] The eigenvalues of interest for this eigenproblem.
"LM"
- Largest Magnitude [ default ]"SM"
- Smallest Magnitude"LR"
- Largest Real"SR"
- Smallest Real"LI"
- Largest Imaginary"SI"
- Smallest Imaginary
-
virtual void sort(std::vector<MagnitudeType> &evals, SmartPtr<std::vector<int>> perm = _smPtrNull, int n = -1) const#
-
Sort real eigenvalues, optionally returning the permutation vector.
- Parameters:
-
-
evals – [in/out] Vector of length at least
n
containing the eigenvalues to be sorted.
On output, the first
n
eigenvalues will be sorted. The rest will be unchanged. -
perm – [out] Vector of length at least
n
to store the permutation index (optional).
If specified, on output the first
n
eigenvalues will contain the permutation indices, in the range[0,n-1]
, such thatevals_out[i] = evals_in[perm[i]]
n – [in] Number of values in evals to be sorted. If
n == -1
, all values will be sorted.
-
Note
This method is not valid when the sort manager is configured for “LI” or “SI” sorting (i.e., sorting by the imaginary components). Calling this method in that scenario will result in a SortManagerError exception.
-
virtual void sort(std::vector<MagnitudeType> &rEvals, std::vector<MagnitudeType> &iEvals, SmartPtr<std::vector<int>> perm = _smPtrNull, int n = -1) const#
-
Sort complex eigenvalues, optionally returning the permutation vector.
This routine takes two vectors, one for each part of a complex eigenvalue. This is helpful for solving real, non-symmetric eigenvalue problems.
- Parameters:
-
-
rEvals – [in/out] Vector of length at least
n
containing the real part of the eigenvalues to be sorted.
On output, the first
n
eigenvalues will be sorted. The rest will be unchanged. -
iEvals – [in/out] Vector of length at least
n
containing the imaginary part of the eigenvalues to be sorted.
On output, the first
n
eigenvalues will be sorted. The rest will be unchanged. -
perm – [out] Vector of length at least
n
to store the permutation index (optional).
If specified, on output the first
n
eigenvalues will contain the permutation indices, in the range[0,n-1]
, such thatr_evals_out[i] = r_evals_in[perm[i]]
and similarly foriEvals
. n – [in] Number of values in
rEvals
,iEvals
to be sorted. Ifn == -1
, all values will be sorted, as decided by the minimum of the length ofrEvals
and the length ofiEvals
.
-
-
BasicSort(const std::string &which = "LM")#