![]() |
Sorting Network Search
Backtracking for Small Sorting Networks
|
Perfect matching. More...
#include <Matching.h>
Public Member Functions | |
CMatching () | |
Void constructor. More... | |
CMatching (const CMatching &) | |
Copy constructor. More... | |
void | Initialize () |
Initialize. More... | |
bool | Next () |
Advance to next matching. More... | |
void | Swap (const size_t, const size_t) |
Swap. More... | |
void | Normalize () |
Normalize. More... | |
size_t & | operator[] (const size_t) |
Overloaded index operator. More... | |
const size_t | operator[] (const size_t) const |
Overloaded index operator. More... | |
operator std::string () const | |
Cast to a string. More... | |
Private Member Functions | |
void | SwapPair (int[], size_t, size_t) |
Swap pair. More... | |
Private Attributes | |
size_t | m_nMatching [MAXINPUTS+1] = {0} |
Matching. More... | |
size_t | m_nMap [MAXINPUTS+1] = {0} |
Matching index map. More... | |
int | m_nStack [MAXINPUTS+1] = {0} |
Stack to remove recursion from permutation. 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... | |
CMatching
represents a perfect matching... well, as perfect as it can be if its size is odd.
Definition at line 39 of file Matching.h.
CMatching::CMatching | ( | ) |
Initialize the matching to the identity matching.
Definition at line 32 of file Matching.cpp.
CMatching::CMatching | ( | const CMatching & | m | ) |
void CMatching::Initialize | ( | ) |
Initialize to the identity matching.
Definition at line 50 of file Matching.cpp.
bool CMatching::Next | ( | ) |
Get the next matching. Uses the stack to avoid recursing.
Definition at line 62 of file Matching.cpp.
void CMatching::Normalize | ( | ) |
CMatching::operator std::string | ( | ) | const |
Type cast to a string consisting of space-separated values from m_nMatching
.
Definition at line 172 of file Matching.cpp.
size_t & CMatching::operator[] | ( | const size_t | i | ) |
Index operator, used to access members of m_nMatching
as an L-value.
i | Index. |
Definition at line 185 of file Matching.cpp.
const size_t CMatching::operator[] | ( | const size_t | i | ) | const |
Index operator, used to access members of m_nMatching
as an R-value.
i | Index. |
Definition at line 193 of file Matching.cpp.
void CMatching::Swap | ( | const size_t | i, |
const size_t | j | ||
) |
Swap two pairs of entries in the m_nMatching
and m_nMap
arrays.
i | Index of first pair. |
j | Index of second pair. |
Definition at line 148 of file Matching.cpp.
|
private |
Swap a pair of entries in an array.
m | An array. |
i | The first index. |
j | The second index. |
Definition at line 99 of file Matching.cpp.
|
private |
Definition at line 42 of file Matching.h.
|
private |
Definition at line 41 of file Matching.h.
|
private |
Definition at line 43 of file Matching.h.