Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

VecSort(Type) Class Reference

vectors with sorting functions. More...

#include <VecSort_Type.h>

Inheritance diagram for VecSort(Type)::

VecSimple_Type VecSimplest_Type Vec_Type ArrayGen_Type ArrayGenSel_Type List of all members.

Public Methods

 VecSort(Type) ()
 VecSort(Type) (int length)
 VecSort(Type) (const VecSort(Type) &X)
 ~VecSort(Type) ()
VecSort(Type)& operator= (const Type &value)
VecSort(Type)& operator= (const VecSort(Type) &X)
bool operator== (const VecSort(Type) &X)
bool operator!= (const VecSort(Type) &X)
bool operator< (const VecSort(Type) &X)
bool operator> (const VecSort(Type) &X)
bool operator<= (const VecSort(Type) &X)
bool operator>= (const VecSort(Type) &X)
Type maxValue () const
Type minValue () const
Type maxValue (int &i) const
Type minValue (int &i) const
Type select (int k)
Type select (int k, int n)
void heapsort ()
void heapsort (int n)
void mixedheapsort ()
void mixedheapsort (int n)
void quicksort ()
void quicksort (int n)
void makeIndex (VecSimple(int) &index) const
void sortAccording2index (const VecSimple(int) &index)

Detailed Description

vectors with sorting functions.

NAME: VecSort - vectors with sorting functions

DESCRIPTION:

The class is derived from "VecSimple" and defines sorting functionality. Hence, "Type" must be of a class type for which "operator<" or "operator>" is meaningful. See class "VecSimple(Type)" and and class "VecSimplest(Type)" for the various functionality that is inherited in class "VecSort(Type)".


Constructor & Destructor Documentation

VecSort(Type)::VecSort_Type ( )
 

The class has an empty constructor which requires a call to for instance a redim function for initialization, a constructor that takes the length of the vector as argument and a copy-constructor.

VecSort(Type)::VecSort_Type ( int length )
 

See documentation of one of the overloaded constructor.

VecSort(Type)::VecSort_Type ( const VecSort(Type) & X )
 

See documentation of one of the overloaded constructor.

VecSort(Type)::~VecSort(Type) ( ) [inline]
 


Member Function Documentation

void VecSort(Type)::heapsort ( int n )
 

See documentation of one of the overloaded functions.

void VecSort(Type)::heapsort ( )
 

sorts the vector using the heapsort algorithm. Note that the original ordering of the vector is lost by this operation! In an overloaded version only the items in positions (1:n) are sorted.

void VecSort(Type)::makeIndex ( VecSimple(int) & index ) const
 

instead of changing the order of the array entries, an index vector is made. The index vector maps the original array entries onto a sorted array. The vector can be used as input to "sortAccording2index" for example when sorting several arrays simultaneously.

Type VecSort(Type)::maxValue ( int & i ) const
 

See documentation of one of the overloaded functions.

Type VecSort(Type)::maxValue ( ) const
 

as "minValue", but the maximum value is found instead.

Type VecSort(Type)::minValue ( int & i ) const
 

See documentation of one of the overloaded functions.

Type VecSort(Type)::minValue ( ) const
 

computes the minimum value of the entries in the vector. An overloaded form of the function has an integer argument which on return equals the position in the vector where the minimum value was found.

void VecSort(Type)::mixedheapsort ( int n )
 

See documentation of one of the overloaded functions.

void VecSort(Type)::mixedheapsort ( )
 

sorts the vector using a mixture of three methods. Usually faster than "heapsort" for small vectors.

bool VecSort(Type)::operator!= ( const VecSort(Type) & X )
 

equals !"operator==".

bool VecSort(Type)::operator< ( const VecSort(Type) & X )
 

"true" if the inequality holds for all components.

bool VecSort(Type)::operator<= ( const VecSort(Type) & X )
 

"true" if the inequality holds for all components.

VecSort(Type) & VecSort(Type)::operator= ( const VecSort(Type) & X )
 

VecSort(Type) & VecSort(Type)::operator= ( const Type & a ) [inline]
 

the version that takes another "VecSimple(Type)" as argument makes the object a copy of the vector argument, that is, the object is redimensioned according to the dimensions of "X" and thereafter each entry is set equal to the corresponding entry in "X". The version that takes a "Type" value as argument sets all the entries in the vector to have this value.

Reimplemented from VecSimple(Type).

Reimplemented in ArrayGen(Type), ArrayGenSel(Type), and Vec(Type).

bool VecSort(Type)::operator== ( const VecSort(Type) & X )
 

returns "true" if all of the entries in this vector are equal to the corresponding entries in the argument to "operator==".

bool VecSort(Type)::operator> ( const VecSort(Type) & X )
 

"true" if the inequality holds for all components.

bool VecSort(Type)::operator>= ( const VecSort(Type) & X )
 

"true" if the inequality holds for all components.

void VecSort(Type)::quicksort ( int n )
 

See documentation of one of the overloaded functions.

void VecSort(Type)::quicksort ( )
 

sorts the vector using the quicksort, in most cases the fastest sort algorithm for large vectors.

Type VecSort(Type)::select ( int k,
int n )
 

See documentation of one of the overloaded functions.

Type VecSort(Type)::select ( int k )
 

computes the k''th smallest value of the entries in the vector. An overloaded form of the function has an integer argument which sets the length (n) of the vector on which the computation is performed. The input array will be rearranged to have the computed value in location (k), with all smaller elements moved to (1:k-1) (in arbitrary order, and all larger elements in (k+1:n) (also in arbitrary order).

void VecSort(Type)::sortAccording2index ( const VecSimple(int) & index )
 

makes real changes of the entry order in the object acording to an index vector, usually computed in "makeIndex".


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.