55 std::ifstream infile(lpwstr);
56 bool bSuccess = (bool)infile;
65 std::vector<std::vector<UINT>> vMatching;
67 std::vector<UINT> vEmptyVec;
71 while(std::getline(infile, strLine)){
72 std::istringstream iss(strLine);
73 vMatching.push_back(vEmptyVec);
77 nInputs = max(max(nInputs, a), b);
78 vMatching[nDepth].push_back(a);
79 vMatching[nDepth].push_back(b);
96 for(UINT i=0; i<vMatching.size(); i++)
97 for(UINT j=0; j<vMatching[i].size(); j+=2){
98 const UINT j0 = vMatching[i][j];
100 if(j < vMatching[i].size() - 1){
101 const UINT j1 = vMatching[i][j + 1];
138 for(UINT j=0; j<n; j++)
162 for(UINT i=0; i<nDepth; i++)
227 if(
m_nMatch ==
nullptr)
return false;
228 if(
m_nMatch[0] ==
nullptr)
return false;
Interface for the comparator network CComparatorNetwork.
bool odd(const UINT n)
Parity test.
Header for useful helper functions.
UINT ** m_nMatch
Matchings at each level.
~CComparatorNetwork()
Destructor.
const UINT GetDepth() const
Get depth.
void Prune(const UINT)
Prune down number of inputs.
virtual bool Read(LPWSTR)
Read from file.
const bool FirstNormalForm() const
Test for first normal form.
void InsertComparator(UINT, UINT, UINT)
Insert comparator.
void ComputeSize()
Compute size.
const UINT GetSize() const
Get size.
const UINT GetNumInputs() const
Get number of inputs.
UINT m_nInputs
Number of inputs.
void CreateMatchArray(UINT, UINT)
Create match array.