arma_qsort_helper< std::complex< T > > Class Template Reference
[Op_sort]

#include <op_sort_meat.hpp>

List of all members.

Public Types

typedef std::complex< T > eT

Static Public Member Functions

static int ascend_compare (const void *A_orig, const void *B_orig)
static int descend_compare (const void *A_orig, const void *B_orig)

Detailed Description

template<typename T>
class arma_qsort_helper< std::complex< T > >

Definition at line 83 of file op_sort_meat.hpp.


Member Typedef Documentation

template<typename T >
typedef std::complex<T> arma_qsort_helper< std::complex< T > >::eT

Definition at line 87 of file op_sort_meat.hpp.


Member Function Documentation

template<typename T >
static int arma_qsort_helper< std::complex< T > >::ascend_compare ( const void *  A_orig,
const void *  B_orig 
) [inline, static]

Definition at line 92 of file op_sort_meat.hpp.

References abs().

00093     {
00094     const eT& A = *(static_cast<const eT*>(A_orig));
00095     const eT& B = *(static_cast<const eT*>(B_orig));
00096     
00097     const T abs_A = std::abs(A);
00098     const T abs_B = std::abs(B);
00099     
00100     if(abs_A < abs_B)
00101       {
00102       return -1;
00103       }
00104     else
00105     if(abs_A > abs_B)
00106       {
00107       return +1;
00108       }
00109     else
00110       {
00111       return 0;
00112       }
00113     }

template<typename T >
static int arma_qsort_helper< std::complex< T > >::descend_compare ( const void *  A_orig,
const void *  B_orig 
) [inline, static]

Definition at line 119 of file op_sort_meat.hpp.

References abs().

00120     {
00121     const eT& A = *(static_cast<const eT*>(A_orig));
00122     const eT& B = *(static_cast<const eT*>(B_orig));
00123     
00124     const T abs_A = std::abs(A);
00125     const T abs_B = std::abs(B);
00126     
00127     if(abs_A < abs_B)
00128       {
00129       return +1;
00130       }
00131     else
00132     if(abs_A > abs_B)
00133       {
00134       return -1;
00135       }
00136     else
00137       {
00138       return 0;
00139       }
00140     }