GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
octave_sort< T > Class Template Reference

#include "oct-sort.h"

Public Types

typedef std::function< bool(typename ref_param< T >::type, typename ref_param< T >::type)> compare_fcn_type
 

Public Member Functions

 octave_sort ()
 
 octave_sort (const compare_fcn_type &)
 
 ~octave_sort ()
 
bool is_sorted_rows (const T *data, octave_idx_type rows, octave_idx_type cols)
 
bool issorted (const T *data, octave_idx_type nel)
 
octave_idx_type lookup (const T *data, octave_idx_type nel, const T &value)
 
void lookup (const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx)
 
void lookup_sorted (const T *data, octave_idx_type nel, const T *values, octave_idx_type nvalues, octave_idx_type *idx, bool rev=false)
 
void nth_element (T *data, octave_idx_type nel, octave_idx_type lo, octave_idx_type up=-1)
 
void set_compare (const compare_fcn_type &comp)
 
void set_compare (sortmode mode)
 
void sort (bool *data, octave_idx_type *idx, octave_idx_type nel, std::greater< bool >)
 
void sort (bool *data, octave_idx_type *idx, octave_idx_type nel, std::less< bool >)
 
void sort (bool *data, octave_idx_type nel, std::greater< bool >)
 
void sort (bool *data, octave_idx_type nel, std::less< bool >)
 
void sort (T *data, octave_idx_type *idx, octave_idx_type nel)
 
void sort (T *data, octave_idx_type nel)
 
void sort_rows (const T *data, octave_idx_type *idx, octave_idx_type rows, octave_idx_type cols)
 

Static Public Member Functions

static bool ascending_compare (typename ref_param< T >::type, typename ref_param< T >::type)
 
static bool descending_compare (typename ref_param< T >::type, typename ref_param< T >::type)
 

Detailed Description

template<typename T>
class octave_sort< T >

Definition at line 100 of file oct-sort.h.

Member Typedef Documentation

◆ compare_fcn_type

template<typename T >
typedef std::function<bool (typename ref_param<T>::type, typename ref_param<T>::type)> octave_sort< T >::compare_fcn_type

Definition at line 107 of file oct-sort.h.

Constructor & Destructor Documentation

◆ octave_sort() [1/2]

template<typename T >
octave_sort< T >::octave_sort

Definition at line 122 of file oct-sort.cc.

◆ octave_sort() [2/2]

template<typename T >
octave_sort< T >::octave_sort ( const compare_fcn_type comp)

Definition at line 127 of file oct-sort.cc.

◆ ~octave_sort()

template<typename T >
octave_sort< T >::~octave_sort

Definition at line 132 of file oct-sort.cc.

Member Function Documentation

◆ ascending_compare()

template<typename T >
bool octave_sort< T >::ascending_compare ( typename ref_param< T >::type  x,
typename ref_param< T >::type  y 
)
static

Definition at line 1969 of file oct-sort.cc.

References x.

◆ descending_compare()

template<typename T >
bool octave_sort< T >::descending_compare ( typename ref_param< T >::type  x,
typename ref_param< T >::type  y 
)
static

Definition at line 1977 of file oct-sort.cc.

References x.

Referenced by Array< T, Alloc >::lookup().

◆ is_sorted_rows()

template<typename T >
bool octave_sort< T >::is_sorted_rows ( const T *  data,
octave_idx_type  rows,
octave_idx_type  cols 
)

Definition at line 1744 of file oct-sort.cc.

◆ issorted()

template<typename T >
bool octave_sort< T >::issorted ( const T *  data,
octave_idx_type  nel 
)

Definition at line 1579 of file oct-sort.cc.

◆ lookup() [1/2]

template<typename T >
octave_idx_type octave_sort< T >::lookup ( const T *  data,
octave_idx_type  nel,
const T &  value 
)

Definition at line 1789 of file oct-sort.cc.

References lookup().

◆ lookup() [2/2]

template<typename T >
void octave_sort< T >::lookup ( const T *  data,
octave_idx_type  nel,
const T *  values,
octave_idx_type  nvalues,
octave_idx_type idx 
)

Definition at line 1825 of file oct-sort.cc.

References lookup().

◆ lookup_sorted()

template<typename T >
void octave_sort< T >::lookup_sorted ( const T *  data,
octave_idx_type  nel,
const T *  values,
octave_idx_type  nvalues,
octave_idx_type idx,
bool  rev = false 
)

Definition at line 1900 of file oct-sort.cc.

◆ nth_element()

template<typename T >
void octave_sort< T >::nth_element ( T *  data,
octave_idx_type  nel,
octave_idx_type  lo,
octave_idx_type  up = -1 
)

Definition at line 1947 of file oct-sort.cc.

◆ set_compare() [1/2]

template<typename T >
void octave_sort< T >::set_compare ( const compare_fcn_type comp)
inline

Definition at line 117 of file oct-sort.h.

Referenced by Array< T, Alloc >::sort(), and Sparse< T, Alloc >::sort().

◆ set_compare() [2/2]

template<typename T >
void octave_sort< T >::set_compare ( sortmode  mode)

Definition at line 139 of file oct-sort.cc.

References ASCENDING, and DESCENDING.

◆ sort() [1/6]

void octave_sort< bool >::sort ( bool *  data,
octave_idx_type idx,
octave_idx_type  nel,
std::greater< bool >   
)

Definition at line 118 of file Array-b.cc.

◆ sort() [2/6]

void octave_sort< bool >::sort ( bool *  data,
octave_idx_type idx,
octave_idx_type  nel,
std::less< bool >   
)

Definition at line 109 of file Array-b.cc.

◆ sort() [3/6]

void octave_sort< bool >::sort ( bool *  data,
octave_idx_type  nel,
std::greater< bool >   
)

Definition at line 100 of file Array-b.cc.

◆ sort() [4/6]

void octave_sort< bool >::sort ( bool *  data,
octave_idx_type  nel,
std::less< bool >   
)

Definition at line 91 of file Array-b.cc.

◆ sort() [5/6]

template<typename T >
void octave_sort< T >::sort ( T *  data,
octave_idx_type idx,
octave_idx_type  nel 
)

Definition at line 1540 of file oct-sort.cc.

◆ sort() [6/6]

template<typename T >
void octave_sort< T >::sort ( T *  data,
octave_idx_type  nel 
)

◆ sort_rows()

template<typename T >
void octave_sort< T >::sort_rows ( const T *  data,
octave_idx_type idx,
octave_idx_type  rows,
octave_idx_type  cols 
)

Definition at line 1667 of file oct-sort.cc.

Referenced by Array< T, Alloc >::sort_rows_idx().


The documentation for this class was generated from the following files: