Skip to content

Commit

Permalink
sorting_network_sorter specializations [33, 64]
Browse files Browse the repository at this point in the history
Once again thanks to the SorterHunter project by @bertdobbelaere
  • Loading branch information
Morwenn committed Dec 28, 2023
1 parent f845d05 commit 86d9e43
Show file tree
Hide file tree
Showing 34 changed files with 13,319 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/Fixed-size-sorters.md
Expand Up @@ -136,7 +136,7 @@ template<typename DifferenceType=std::ptrdiff_t>
#include <cpp-sort/fixed/sorting_network_sorter.h>
```

This sorter provides size-optimal [sorting networks][sorting-network] for 0 thru 32 inputs. Those networks are manually unrolled *sequential* series of *compare-exchange* operations (CEs) which can be fast enough for certain operations, and do tend to be faster than everything else when it comes to sorting small arrays of integers without requiring additional memory.
This sorter provides size-optimal [sorting networks][sorting-network] for 0 thru 64 inputs. Those networks are manually unrolled *sequential* series of *compare-exchange* operations (CEs) which can be fast enough for certain operations, and do tend to be faster than everything else when it comes to sorting small arrays of integers without requiring additional memory.

```cpp
template<std::size_t N>
Expand All @@ -150,6 +150,10 @@ Size | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16
**CEs** | 0 | 1 | 3 | 5 | 9 | 12 | 16 | 19 | 25 | 29 | 35 | 39 | 45 | 51 | 56 | 60
**Size** | **17** | **18** | **19** | **20** | **21** | **22** | **23** | **24** | **25** | **26** | **27** | **28** | **29** | **30** | **31** | **32**
**CEs** | 71 | 77 | 85 | 91 | 99 | 106 | 114 | 120 | 130 | 139 | 147 | 155 | 164 | 172 | 180 | 185
**Size** | **33** | **34** | **35** | **36** | **37** | **38** | **39** | **40** | **41** | **42** | **43** | **44** | **45** | **46** | **47** | **48**
**CEs** | 199 | 209 | 220 | 227 | 241 | 250 | 259 | 265 | 282 | 292 | 303 | 309 | 324 | 332 | 340 | 346
**Size** | **49** | **50** | **51** | **52** | **53** | **54** | **55** | **56** | **57** | **58** | **59** | **60** | **61** | **62** | **63** | **64**
**CEs** | 365 | 376 | 387 | 395 | 411 | 421 | 432 | 438 | 454 | 465 | 476 | 483 | 497 | 506 | 515 | 521

Networks 0, 1, 2 and 3 are stable. All other networks are unstable.

Expand Down
250 changes: 250 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort33.h

Large diffs are not rendered by default.

261 changes: 261 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort34.h

Large diffs are not rendered by default.

272 changes: 272 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort35.h

Large diffs are not rendered by default.

280 changes: 280 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort36.h

Large diffs are not rendered by default.

293 changes: 293 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort37.h

Large diffs are not rendered by default.

302 changes: 302 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort38.h

Large diffs are not rendered by default.

311 changes: 311 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort39.h

Large diffs are not rendered by default.

317 changes: 317 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort40.h

Large diffs are not rendered by default.

336 changes: 336 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort41.h

Large diffs are not rendered by default.

345 changes: 345 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort42.h

Large diffs are not rendered by default.

357 changes: 357 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort43.h

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort44.h

Large diffs are not rendered by default.

378 changes: 378 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort45.h

Large diffs are not rendered by default.

386 changes: 386 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort46.h

Large diffs are not rendered by default.

394 changes: 394 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort47.h

Large diffs are not rendered by default.

400 changes: 400 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort48.h

Large diffs are not rendered by default.

421 changes: 421 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort49.h

Large diffs are not rendered by default.

432 changes: 432 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort50.h

Large diffs are not rendered by default.

444 changes: 444 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort51.h

Large diffs are not rendered by default.

450 changes: 450 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort52.h

Large diffs are not rendered by default.

468 changes: 468 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort53.h

Large diffs are not rendered by default.

476 changes: 476 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort54.h

Large diffs are not rendered by default.

487 changes: 487 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort55.h

Large diffs are not rendered by default.

493 changes: 493 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort56.h

Large diffs are not rendered by default.

510 changes: 510 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort57.h

Large diffs are not rendered by default.

521 changes: 521 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort58.h

Large diffs are not rendered by default.

532 changes: 532 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort59.h

Large diffs are not rendered by default.

539 changes: 539 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort60.h

Large diffs are not rendered by default.

554 changes: 554 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort61.h

Large diffs are not rendered by default.

562 changes: 562 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort62.h

Large diffs are not rendered by default.

571 changes: 571 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort63.h

Large diffs are not rendered by default.

577 changes: 577 additions & 0 deletions include/cpp-sort/detail/sorting_network/sort64.h

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions include/cpp-sort/fixed/sorting_network_sorter.h
Expand Up @@ -123,5 +123,37 @@ namespace cppsort
#include "../detail/sorting_network/sort30.h"
#include "../detail/sorting_network/sort31.h"
#include "../detail/sorting_network/sort32.h"
#include "../detail/sorting_network/sort33.h"
#include "../detail/sorting_network/sort34.h"
#include "../detail/sorting_network/sort35.h"
#include "../detail/sorting_network/sort36.h"
#include "../detail/sorting_network/sort37.h"
#include "../detail/sorting_network/sort38.h"
#include "../detail/sorting_network/sort39.h"
#include "../detail/sorting_network/sort40.h"
#include "../detail/sorting_network/sort41.h"
#include "../detail/sorting_network/sort42.h"
#include "../detail/sorting_network/sort43.h"
#include "../detail/sorting_network/sort44.h"
#include "../detail/sorting_network/sort45.h"
#include "../detail/sorting_network/sort46.h"
#include "../detail/sorting_network/sort47.h"
#include "../detail/sorting_network/sort48.h"
#include "../detail/sorting_network/sort49.h"
#include "../detail/sorting_network/sort50.h"
#include "../detail/sorting_network/sort51.h"
#include "../detail/sorting_network/sort52.h"
#include "../detail/sorting_network/sort53.h"
#include "../detail/sorting_network/sort54.h"
#include "../detail/sorting_network/sort55.h"
#include "../detail/sorting_network/sort56.h"
#include "../detail/sorting_network/sort57.h"
#include "../detail/sorting_network/sort58.h"
#include "../detail/sorting_network/sort59.h"
#include "../detail/sorting_network/sort60.h"
#include "../detail/sorting_network/sort61.h"
#include "../detail/sorting_network/sort62.h"
#include "../detail/sorting_network/sort63.h"
#include "../detail/sorting_network/sort64.h"

#endif // CPPSORT_FIXED_SORTING_NETWORK_SORTER_H_

0 comments on commit 86d9e43

Please sign in to comment.