41 bool bNearSorts =
true;
99 if(j == k)
return true;
137 bool unfinished =
true;
#define odd(n)
Oddness test.
Interface for the searchable sorting network with the nearsort heuristic CNearsort.
Searchable second normal form sorting network with autocomplete.
virtual size_t Next()
Get next code word.
virtual void Initialize()
Get first code word.
bool Next()
Advance to next matching.
bool Nearsorts()
Does it nearly sort?
bool m_bReachableTo[MAXINPUTS][MAXINPUTS]
Reachable to.
void SetToS()
Set top of stack.
bool m_bReachable[MAXINPUTS][MAXINPUTS]
Reachable from or to.
bool EvenNearsorts()
Does it nearly sort, even number of inputs?
CNearsort(CMatching &, const size_t)
Constructor.
int m_nReachCountTo[MAXINPUTS]
Count of channels reachable to.
int m_nReachCount[MAXINPUTS]
Count of channels reachable from or to.
void Process()
Process a candidate comparator network.
bool StillNearsorts(const size_t)
Does it still nearsort with this input change?
int m_nReachCountFrom[MAXINPUTS]
Count of channels reachable from.
bool m_bReachableFrom[MAXINPUTS][MAXINPUTS]
Reachable from.
void InitMatchingRepresentations(size_t)
Initialize the two different matching representations.
CMatching m_cMatching[MAXDEPTH]
Matchings that make up comparator network in a form that makes searching faster.
virtual void Process()
Process a candidate comparator network.
void SynchMatchingRepresentations(size_t)
Synchronize the two different matching representations.
static size_t m_nWidth
Comparator network width.
static size_t m_nDepth
Comparator network depth.
size_t FlipInput(size_t, const size_t, const size_t)
Recompute network values when a bit is changed.
size_t m_nZeros
Number of zeros in the input.
void InitValues(const size_t, const size_t)
Initialize the network values to the all zero input.
size_t m_nValue[MAXDEPTH][MAXINPUTS]
Values at each level when sorting.
CBinaryGrayCode * m_pGrayCode
Gray code generator.