COPASI API  4.40.278
CSort.h File Reference
#include <cmath>
#include <algorithm>
#include <functional>
#include "copasi/core/CVector.h"

Classes

class  CompareDefault< RandomAccessIterator >
 
class  CompareDoubleWithNaN
 
class  FSwapBase< IndexType, ReturnType >
 
class  FSwapClass< ClassType, IndexType, ReturnType >
 

Functions

template<typename SwapMethod >
bool applyPartialPivot (const CVector< size_t > &pivot, const size_t &ordered, SwapMethod swap)
 
template<typename SwapMethod >
bool applyPivot (const CVector< size_t > &pivot, SwapMethod swap)
 
template<typename RandomAccessIterator >
void partialSortWithPivot (RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, CVector< size_t > &pivot)
 
template<typename RandomAccessIterator , typename LessThanCompare >
void partialSortWithPivot (RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, LessThanCompare compare, CVector< size_t > &pivot)
 
template<typename RandomAccessIterator >
void sortWithPivot (RandomAccessIterator first, RandomAccessIterator last, CVector< size_t > &pivot)
 
template<typename RandomAccessIterator , typename LessThanCompare >
void sortWithPivot (RandomAccessIterator first, RandomAccessIterator last, LessThanCompare compare, CVector< size_t > &pivot)
 

Function Documentation

◆ applyPartialPivot()

template<typename SwapMethod >
bool applyPartialPivot ( const CVector< size_t > &  pivot,
const size_t &  ordered,
SwapMethod  swap 
)

Partial reordering of the first 'ordered' elements according to the provided pivots. The swap method must be of the form: ReturnType operator() (size_t to, size_t from) where the ReturnType is not used and therefore arbitrary. Objects of type FSwapBase are suitable candidates.

Parameters
constCVector<size_t> & pivot
constsize_t & ordered
SwapMethodswap
Returns
bool success

References CVectorCore< CType >::size().

Referenced by COptMethodEP::select(), and COptMethodGA::select().

◆ applyPivot()

template<typename SwapMethod >
bool applyPivot ( const CVector< size_t > &  pivot,
SwapMethod  swap 
)

Reorder the elements according to the provided pivots The swap method must be of the form: ReturnType operator() (size_t to, size_t from) where the ReturnType is not used and therefore arbitrary. Objects of type FSwapBase are suitable candidates.

Parameters
constCVector<size_t> & pivot
SwapMethodswap
Returns
bool success

References CVectorCore< CType >::size().

◆ partialSortWithPivot() [1/2]

template<typename RandomAccessIterator >
void partialSortWithPivot ( RandomAccessIterator  first,
RandomAccessIterator  middle,
RandomAccessIterator  last,
CVector< size_t > &  pivot 
)

Partial sorting method returning a pivot vector instead of performing the sort. The underlying sorting method is std::partial sort with the operator < used for * comparison .

Parameters
RandomAccessIteratorfirst
RandomAccessIteratormiddle
RandomAccessIteratorlast
CVector<size_t>& pivot

Referenced by COptMethodEP::select(), and COptMethodGA::select().

◆ partialSortWithPivot() [2/2]

template<typename RandomAccessIterator , typename LessThanCompare >
void partialSortWithPivot ( RandomAccessIterator  first,
RandomAccessIterator  middle,
RandomAccessIterator  last,
LessThanCompare  compare,
CVector< size_t > &  pivot 
)

Partial sorting method returning a pivot vector instead of performing the sort. The underlying sorting method is std::partial_sort with the specified compare method used for comparison .

Parameters
RandomAccessIteratorfirst
RandomAccessIteratormiddle
RandomAccessIteratorlast
LessThanComparemethod
CVector<size_t>& pivot

References CVectorCore< CType >::array(), and CVector< CType >::resize().

◆ sortWithPivot() [1/2]

template<typename RandomAccessIterator >
void sortWithPivot ( RandomAccessIterator  first,
RandomAccessIterator  last,
CVector< size_t > &  pivot 
)

Sorting method returning a pivot vector instead of performing the sort. The underlying sorting method is std::sort with the operator < used for comparison .

Parameters
RandomAccessIteratorfirst
RandomAccessIteratorlast
CVector<size_t>& pivot

Referenced by CExperiment::read(), and CEigen::stabilityAnalysis().

◆ sortWithPivot() [2/2]

template<typename RandomAccessIterator , typename LessThanCompare >
void sortWithPivot ( RandomAccessIterator  first,
RandomAccessIterator  last,
LessThanCompare  compare,
CVector< size_t > &  pivot 
)

Sorting method returning a pivot vector instead of performing the sort. The underlying sorting method is std::sort with the specified compare method used for comparison .

Parameters
RandomAccessIteratorfirst
RandomAccessIteratorlast
LessThanComparemethod
CVector<size_t>& pivot

References CVectorCore< CType >::array(), and CVector< CType >::resize().