#include <VecSort_Type.h>
Inheritance diagram for VecSort(Type)::

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) |
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)".
|
|
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. |
|
|
See documentation of one of the overloaded constructor. |
|
|
See documentation of one of the overloaded constructor. |
|
|
|
|
|
See documentation of one of the overloaded functions. |
|
|
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. |
|
|
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. |
|
|
See documentation of one of the overloaded functions. |
|
|
as "minValue", but the maximum value is found instead. |
|
|
See documentation of one of the overloaded functions. |
|
|
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. |
|
|
See documentation of one of the overloaded functions. |
|
|
sorts the vector using a mixture of three methods. Usually faster than "heapsort" for small vectors. |
|
|
equals !"operator==". |
|
|
"true" if the inequality holds for all components. |
|
|
"true" if the inequality holds for all components. |
|
|
|
|
|
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). |
|
|
returns "true" if all of the entries in this vector are equal to the corresponding entries in the argument to "operator==". |
|
|
"true" if the inequality holds for all components. |
|
|
"true" if the inequality holds for all components. |
|
|
See documentation of one of the overloaded functions. |
|
|
sorts the vector using the quicksort, in most cases the fastest sort algorithm for large vectors. |
|
|
See documentation of one of the overloaded functions. |
|
|
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). |
|
|
makes real changes of the entry order in the object acording to an index vector, usually computed in "makeIndex". |