43 bool bNearSorts =
true;
98 if(j == k)
return true;
136 bool unfinished =
true;
virtual size_t Next()
Get next code word.
virtual void Initialize()
Get first code word.
bool Next()
Advance to next matching.
bool StillNearsorts2(const size_t delta)
Does it still nearsort with this input change?
void SetToS()
Set top of stack.
void Process()
Process a candidate comparator network.
CNearsort2(CMatching &, const size_t)
Constructor.
bool EvenNearsorts2()
Does it nearly sort, even number of inputs?
bool Nearsorts2()
Does it nearly sort?
Searchable sorting network with nearsort.
bool m_bReachableTo[MAXINPUTS][MAXINPUTS]
Reachable to.
bool m_bReachable[MAXINPUTS][MAXINPUTS]
Reachable from or to.
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.
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.
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.