![]() |
Sorting Network Search
Backtracking for Small Sorting Networks
|
Comparator network. More...
#include <ComparatorNetwork.h>
Public Member Functions | |
CComparatorNetwork () | |
Constructor. More... | |
virtual | ~CComparatorNetwork () |
Destructor. More... | |
void | Save (const std::string &) |
Save to file. More... | |
Protected Attributes | |
size_t | m_nComparator [MAXDEPTH][MAXINPUTS] = {0} |
Comparator array. More... | |
Additional Inherited Members | |
![]() | |
static void | SetWidth (const size_t) |
Set width. More... | |
static void | SetDepth (const size_t) |
Set depth. More... | |
![]() | |
static size_t | m_nWidth = 9 |
Comparator network width. More... | |
static size_t | m_nDepth = 6 |
Comparator network depth. More... | |
A comparator network, each level of which is represented by a matching stored in an array m_nComparator
. There is a comparator between channels j
and k
at level i-1
iff m_nComparator[i][j] == k
and m_nComparator[i][k] == j
. Intuitively, m_nComparator[i][j]
is the channel that channel j
is matched to via a comparator in level i-1
.
For example, in the above diagram at left there is a comparator between channels 0 and 1 at level 1, and in the table at right m_nComparator[0][0] == 1
and m_nComparator[0][1] == 0
.
Definition at line 47 of file ComparatorNetwork.h.
CComparatorNetwork::CComparatorNetwork | ( | ) |
Initialize the matching array to represent a comparator network with no comparators.
Definition at line 34 of file ComparatorNetwork.cpp.
|
virtual |
Virtual destructor.
Definition at line 42 of file ComparatorNetwork.cpp.
void CComparatorNetwork::Save | ( | const std::string & | fname | ) |
Save comparator network to a text file.
fname | File name string. |
Definition at line 48 of file ComparatorNetwork.cpp.
Definition at line 49 of file ComparatorNetwork.h.