Sorting Network Search
Backtracking for Small Sorting Networks
Nearsort2.h
1
4
5// MIT License
6//
7// Copyright (c) 2023 Ian Parberry
8//
9// Permission is hereby granted, free of charge, to any person obtaining a copy
10// of this software and associated documentation files (the "Software"), to
11// deal in the Software without restriction, including without limitation the
12// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
13// sell copies of the Software, and to permit persons to whom the Software is
14// furnished to do so, subject to the following conditions:
15//
16// The above copyright notice and this permission notice shall be included in
17// all copies or substantial portions of the Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25// IN THE SOFTWARE.
26
27#ifndef __Nearsort2_h__
28#define __Nearsort2_h__
29
30#include "Nearsort.h"
31
36
37class CNearsort2: public CNearsort{
38 protected:
39 bool StillNearsorts2(const size_t delta);
40 bool EvenNearsorts2();
41 bool Nearsorts2();
42
43 void Process();
44 void SetToS();
45
46public:
47 CNearsort2(CMatching&, const size_t);
48}; //CNearsort2
49
50#endif //__Nearsort2_h__
Interface for the searchable sorting network with the nearsort heuristic CNearsort.
Perfect matching.
Definition: Matching.h:39
Searchable sorting network with nearsort2.
Definition: Nearsort2.h:37
bool StillNearsorts2(const size_t delta)
Does it still nearsort with this input change?
Definition: Nearsort2.cpp:94
void SetToS()
Set top of stack.
Definition: Nearsort2.cpp:149
void Process()
Process a candidate comparator network.
Definition: Nearsort2.cpp:133
CNearsort2(CMatching &, const size_t)
Constructor.
Definition: Nearsort2.cpp:33
bool EvenNearsorts2()
Does it nearly sort, even number of inputs?
Definition: Nearsort2.cpp:41
bool Nearsorts2()
Does it nearly sort?
Definition: Nearsort2.cpp:59
Searchable sorting network with nearsort.
Definition: Nearsort.h:38