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 82 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 86 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 91 of file op_sort_meat.hpp.

References abs().

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

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 118 of file op_sort_meat.hpp.

References abs().

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