Public Types | Static Public Member Functions

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().

    {
    const eT& A = *(static_cast<const eT*>(A_orig));
    const eT& B = *(static_cast<const eT*>(B_orig));
    
    const T abs_A = std::abs(A);
    const T abs_B = std::abs(B);
    
    if(abs_A < abs_B)
      {
      return -1;
      }
    else
    if(abs_A > abs_B)
      {
      return +1;
      }
    else
      {
      return 0;
      }
    }

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().

    {
    const eT& A = *(static_cast<const eT*>(A_orig));
    const eT& B = *(static_cast<const eT*>(B_orig));
    
    const T abs_A = std::abs(A);
    const T abs_B = std::abs(B);
    
    if(abs_A < abs_B)
      {
      return +1;
      }
    else
    if(abs_A > abs_B)
      {
      return -1;
      }
    else
      {
      return 0;
      }
    }