Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SIMDe #22

Merged
merged 116 commits into from
Dec 20, 2023
Merged
Changes from 1 commit
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
d4a5791
Replaced intrinsic by builtin for popcount
hivert Oct 23, 2023
282ec03
Imported simde
hivert Oct 23, 2023
eb84cee
Switch to simde
hivert Oct 23, 2023
c95624b
Finish switching to SIMDe
james-d-mitchell Oct 24, 2023
4835ca9
Switch to C++14
james-d-mitchell Oct 24, 2023
06736d9
Stop using deprecated std::random_shuffle
james-d-mitchell Oct 24, 2023
8abef2b
Move testtools.hpp into benchmark/
james-d-mitchell Oct 24, 2023
d5beea9
tests: remove pointless test files
james-d-mitchell Oct 24, 2023
3a1843f
tests: stop using boost tests
james-d-mitchell Oct 24, 2023
4ab972a
Update ci to use catch2
james-d-mitchell Oct 24, 2023
a0a1c8a
Remove -mavx flag + bump cmake to 3.8
james-d-mitchell Oct 26, 2023
cfa7d03
Add some static cast for compilation on arm with gcc
james-d-mitchell Oct 26, 2023
9b86198
ci: remove apt install of catch2
james-d-mitchell Oct 26, 2023
cd485f7
Test for and cond. use -march/tune=native
james-d-mitchell Oct 26, 2023
fe873bd
Arch checking
hivert Oct 27, 2023
e760ee8
benchmarks: convert to catch2
james-d-mitchell Oct 27, 2023
4949985
Fixup bench -> catch2
james-d-mitchell Oct 27, 2023
5b48274
Rollback some changes
reiniscirpons Oct 27, 2023
82a9d25
ci: use multiple versions of gcc
james-d-mitchell Oct 27, 2023
e9b5eb3
Implemented is_permutation and permutation_of for non x86 arch
hivert Oct 27, 2023
3c9d041
Changed char -> int8_t
hivert Oct 27, 2023
71f704b
Inverse find form PPerm16 and Perm16
hivert Oct 27, 2023
f69a3af
Formatting
james-d-mitchell Oct 27, 2023
b3d55aa
Linting
james-d-mitchell Oct 27, 2023
5ce40c2
Start using C++17
james-d-mitchell Oct 27, 2023
b4f1dda
Wrote a catch matcher for equality of epu8
hivert Oct 27, 2023
a9151f3
Change printing of vectors from [] to {}
hivert Oct 27, 2023
a60d5e1
Update circleci job
reiniscirpons Oct 27, 2023
9fa9d74
Ref implem of image_mask
hivert Oct 27, 2023
d050675
Merge
hivert Oct 27, 2023
d59bf8f
REQUIRE_THAT(..., Equals(...)) everywhere
hivert Oct 27, 2023
62a38dd
Reinstated commented out test in bmat8
hivert Oct 27, 2023
95b1b63
All test reinstated & pass on x86_64
hivert Oct 28, 2023
ad6ac85
Reformating
hivert Oct 28, 2023
137224a
constexpr backward compat cleanup
hivert Oct 28, 2023
a9db482
constexpr backward compat cleanup in build files
hivert Oct 28, 2023
63a54cc
Removed HPCombi-Config system
hivert Oct 28, 2023
3dd3ad4
Fixup
hivert Oct 28, 2023
c38cc9b
Updated Doxygen config file
hivert Oct 29, 2023
80eedee
Fix spelling
hivert Oct 29, 2023
27ab45e
Doc improvements
hivert Oct 29, 2023
c904286
Tests improvements (TEST_AGREES_EPU8_FUN)
hivert Oct 29, 2023
5a07f2f
Formatting
james-d-mitchell Oct 29, 2023
0f76708
Add missing include for sstream
james-d-mitchell Oct 29, 2023
967de58
Remove redundant cmake stuff
james-d-mitchell Oct 29, 2023
fa8088e
REQUIRE -> CHECK
hivert Oct 29, 2023
9a488f7
Removed unused type argument to TEST_AGREES macros
hivert Oct 29, 2023
97777b8
Change Size -> size mem fn
james-d-mitchell Oct 29, 2023
b9375fd
Remove names starting with underscore
james-d-mitchell Oct 29, 2023
50abc5f
Fix spelling
james-d-mitchell Oct 29, 2023
69ec3d6
Reorganise header directories
james-d-mitchell Oct 29, 2023
5c06113
Remove extraneous files
james-d-mitchell Oct 29, 2023
d2f6ef7
implicit constructor
hivert Oct 29, 2023
2e2903d
Updated benchmark with directory reorg
hivert Oct 29, 2023
4d14b5c
Use HPCOMBI_ASSERT everywhere
james-d-mitchell Oct 29, 2023
2383a0b
Remove * + iwyu
james-d-mitchell Oct 29, 2023
a44eeda
BMat8 benchmark done
hivert Oct 29, 2023
cb7f270
Added missing include to simde/x86/sse4.2.h
hivert Oct 29, 2023
f4f8dc2
Updated README.md
hivert Oct 29, 2023
758a862
Update Doxyfile.in
james-d-mitchell Oct 29, 2023
81d6cd9
Remove some libsemigroups remnants
james-d-mitchell Oct 29, 2023
4ba3cf6
Remove travis badge from README.md
james-d-mitchell Oct 29, 2023
232796b
Fix typo in the doc
james-d-mitchell Oct 29, 2023
8f085ec
noexcept in epu
hivert Oct 29, 2023
74bf69a
Noexcept bmat8
james-d-mitchell Oct 29, 2023
4ab6377
Formatting
james-d-mitchell Oct 29, 2023
aead6d4
Remove random_shuffle
james-d-mitchell Oct 29, 2023
02dbb8c
Epu8 benchmark started
james-d-mitchell Oct 29, 2023
fca0c0b
Fixed examples/* wrt new directories
hivert Oct 29, 2023
1551913
Add missing file
james-d-mitchell Oct 30, 2023
4d4c72c
Updated benchmark for Perm16
hivert Oct 30, 2023
8d401cd
Fixed .codespellrc wrt simde
hivert Oct 31, 2023
31d797d
Rearrange bench_epu8 a little
james-d-mitchell Oct 31, 2023
4309f36
Use different rank default on arm
james-d-mitchell Oct 31, 2023
e9c12e8
Add missing copy constructors + improved benchmark
hivert Nov 1, 2023
32ce1be
Add benchmark plot script
james-d-mitchell Nov 1, 2023
949e41c
Finalize bench_epu8
james-d-mitchell Nov 1, 2023
2d04dc4
Handling combinatorial explosion in BENCHMARK_...
hivert Nov 1, 2023
d8359e7
Merge branch 'simde' of github.com:libsemigroups/HPCombi into simde
hivert Nov 1, 2023
f14a337
Finalize bench_epu8
james-d-mitchell Nov 1, 2023
825841a
Move old benchmark stuff into experiments
james-d-mitchell Nov 1, 2023
7644826
Remove unescessary copy constr. and op=
hivert Nov 1, 2023
5a28290
Suppressed g++ wrong warnings -Wstringop-overflow
hivert Nov 1, 2023
9f14f46
Basic rewrite of benchmark plot generator
reiniscirpons Nov 2, 2023
eeb2b41
Improve plot generation
reiniscirpons Nov 2, 2023
1871e43
Merge pull request #33 from reiniscirpons/improve-plots
reiniscirpons Nov 2, 2023
a58d628
New implem is_permutation_eval
hivert Nov 2, 2023
2a6e3dc
Add features for displaying speedup and naming plots to benchmark plo…
reiniscirpons Nov 2, 2023
ad56ebb
Merge + IsSorted matcher
hivert Nov 5, 2023
1d7920a
Remumbered the tests
hivert Nov 5, 2023
d338ad0
Renamed epu.hpp -> epu8.hpp
hivert Nov 5, 2023
be2f558
Silenced clang complaining about gcc -Wstringop-overflow
hivert Nov 5, 2023
c298c95
Preparing for xpu/perm32:
hivert Nov 5, 2023
1336a65
Fix inclusion guard for epu8.hpp
hivert Nov 5, 2023
cbe29f3
epu8 conversion is now fully generic
hivert Nov 5, 2023
815acef
Check for required compiler flags and builtins in topmost CMakLists.txt
james-d-mitchell Nov 8, 2023
1dd240b
Fix spelling
james-d-mitchell Nov 8, 2023
7cf15be
Fixed installation
hivert Nov 8, 2023
f40d0b7
Merge
hivert Nov 8, 2023
3f0342b
Fixed converage CMakeLists
hivert Nov 6, 2023
a3d06f7
Using test_all for coverage
hivert Nov 6, 2023
706556e
Remove clang-format executable accident. committed
james-d-mitchell Nov 9, 2023
05ce0fa
Rename VERSION.in -> HPCOMBI_VERSION.in again
james-d-mitchell Nov 9, 2023
3508231
Make code-coverage optional
james-d-mitchell Nov 9, 2023
a7b3bd2
Fix install again
james-d-mitchell Nov 9, 2023
0c5ea50
Try fix CI
james-d-mitchell Nov 9, 2023
84c7f29
Quick Matcher for Epu8
hivert Nov 9, 2023
e85f7cc
Add -march=native unless disabled or not available
james-d-mitchell Nov 10, 2023
229f845
Fix install dir
hivert Nov 10, 2023
c97f740
Fixup Fix install dir
hivert Nov 10, 2023
25e2142
Update README + BUILDING
james-d-mitchell Nov 15, 2023
3d31e5c
Remove return type for void function
james-d-mitchell Nov 15, 2023
2e76ebc
Add script to deploy the doc
james-d-mitchell Nov 15, 2023
cd71b47
Optimize links in README + spelling
james-d-mitchell Nov 20, 2023
4baa2f6
Add -fopenmp-simd flags if available
james-d-mitchell Nov 20, 2023
b3f3973
Pointed README to the autogened doc
hivert Dec 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
All test reinstated & pass on x86_64
hivert committed Oct 28, 2023
commit 95b1b63e70a30235f2d4b8c6096bc27102a9efb0
11 changes: 4 additions & 7 deletions include/perm16_impl.hpp
Original file line number Diff line number Diff line change
@@ -93,24 +93,21 @@ inline uint32_t PTransf16::fix_points_bitset(bool complement) const {
}

inline uint8_t PTransf16::smallest_fix_point() const {
uint32_t res = fix_points_bitset(false);
return res == 0 ? 0xFF : __builtin_ffsl(res) - 1;
return __builtin_ffs(fix_points_bitset(false)) - 1;
}
/** Returns the smallest non fix point of \c *this */
inline uint8_t PTransf16::smallest_moved_point() const {
uint32_t res = fix_points_bitset(true);
return res == 0 ? 0xFF : __builtin_ffsl(res) - 1;
return __builtin_ffs(fix_points_bitset(true)) - 1;
}
/** Returns the largest fix point of \c *this */
inline uint8_t PTransf16::largest_fix_point() const {
uint32_t res = fix_points_bitset(false);

return res == 0 ? 0xFF : 15 - __builtin_ctzl(res);
return res == 0 ? 0xFF : 31 - __builtin_clz(res);
}
/** Returns the largest non fix point of \c *this */
inline uint8_t PTransf16::largest_moved_point() const {
uint32_t res = fix_points_bitset(true);
return res == 0 ? 0xFF : 15 - __builtin_ctzl(res);
return res == 0 ? 0xFF : 31 - __builtin_clz(res);
}
/** Returns the number of fix points of \c *this */
inline uint8_t PTransf16::nb_fix_points() const {
48 changes: 19 additions & 29 deletions tests/test_epu.cpp
Original file line number Diff line number Diff line change
@@ -21,13 +21,6 @@
#include "test_main.hpp"
#include <catch2/catch_test_macros.hpp>

// TODO uncomment
// #define TEST_AGREES(ref, fun) \
// BOOST_FIXTURE_TEST_CASE(Epu8::agrees_##fun, Fix) { \
// for (auto x : v) \
// REQUIRE(fun(x) == ref(x)); \
// }

namespace HPCombi {

struct Fix {
@@ -409,12 +402,10 @@ TEST_CASE_METHOD(Fix, "Epu8::horiz_sum_ref", "[Epu8][024]") {
REQUIRE(horiz_sum_ref(Pc) == 203);
}

// TODO uncomment, compiler complains that Epu8 is an unknown type!?
// TEST_AGREES(Fix, Epu8, horiz_sum_ref, horiz_sum_gen, v, "[Epu8][025]")
// TEST_AGREES(Fix, Epu8, horiz_sum_ref, horiz_sum4, v, "[Epu8][026]")
//
// TEST_AGREES(Fix, Epu8, horiz_sum_ref, horiz_sum3, v, "[Epu8][027]")
// TEST_AGREES(Fix, Epu8, horiz_sum_ref, horiz_sum, v, "[Epu8][028]")
TEST_AGREES_FUN(Fix, Epu8, horiz_sum_ref, horiz_sum_gen, v, "[Epu8][025]")
TEST_AGREES_FUN(Fix, Epu8, horiz_sum_ref, horiz_sum4, v, "[Epu8][026]")
TEST_AGREES_FUN(Fix, Epu8, horiz_sum_ref, horiz_sum3, v, "[Epu8][027]")
TEST_AGREES_FUN(Fix, Epu8, horiz_sum_ref, horiz_sum, v, "[Epu8][028]")

TEST_CASE_METHOD(Fix, "Epu8::partial_sums_ref", "[Epu8][029]") {
REQUIRE_THAT(partial_sums_ref(zero), Equals(zero));
@@ -484,11 +475,10 @@ TEST_CASE_METHOD(Fix, "Epu8::horiz_max_ref", "[Epu8][033]") {
REQUIRE(horiz_max_ref(Pc) == 43);
}

// TODO uncomment, compiler complains that Epu8 is an unknown type!?
// TEST_AGREES(Fix, Epu8, horiz_max_ref, horiz_max_gen, v, "[Epu8][034]")
// TEST_AGREES(Fix, Epu8, horiz_max_ref, horiz_max4, v, "[Epu8][035]")
// TEST_AGREES(Fix, Epu8, horiz_max_ref, horiz_max3, v, "[Epu8][036]")
// TEST_AGREES(Fix, Epu8, horiz_max_ref, horiz_max, v, "[Epu8][037]")
TEST_AGREES_FUN(Fix, Epu8, horiz_max_ref, horiz_max_gen, v, "[Epu8][034]")
TEST_AGREES_FUN(Fix, Epu8, horiz_max_ref, horiz_max4, v, "[Epu8][035]")
TEST_AGREES_FUN(Fix, Epu8, horiz_max_ref, horiz_max3, v, "[Epu8][036]")
TEST_AGREES_FUN(Fix, Epu8, horiz_max_ref, horiz_max, v, "[Epu8][037]")

TEST_CASE_METHOD(Fix, "Epu8::partial_max_ref", "[Epu8][038]") {
REQUIRE_THAT(partial_max_ref(zero), Equals(zero));
@@ -543,11 +533,11 @@ TEST_CASE_METHOD(Fix, "Epu8::horiz_min_ref", "[Epu8][042]") {
REQUIRE(horiz_min_ref(epu8rev) == 0);
REQUIRE(horiz_min_ref(Pc) == 5);
}
// TODO uncomment
// TEST_AGREES(horiz_min_ref, horiz_min_gen)
// TEST_AGREES(horiz_min_ref, horiz_min4)
// TEST_AGREES(horiz_min_ref, horiz_min3)
// TEST_AGREES(horiz_min_ref, horiz_min)

TEST_AGREES_FUN(Fix, Epu8, horiz_min_ref, horiz_min_gen, v, "[Epu8][034]")
TEST_AGREES_FUN(Fix, Epu8, horiz_min_ref, horiz_min4, v, "[Epu8][035]")
TEST_AGREES_FUN(Fix, Epu8, horiz_min_ref, horiz_min3, v, "[Epu8][036]")
TEST_AGREES_FUN(Fix, Epu8, horiz_min_ref, horiz_min, v, "[Epu8][037]")

TEST_CASE_METHOD(Fix, "Epu8::partial_min_ref", "[Epu8][043]") {
REQUIRE_THAT(partial_min_ref(zero), Equals(zero));
@@ -604,12 +594,12 @@ TEST_CASE_METHOD(Fix, "Epu8::eval16_ref", "[Epu8][047]") {
REQUIRE_THAT(eval16_ref(epu8rev), Equals(Epu8({}, 1)));
REQUIRE_THAT(eval16_ref(Pc), Equals(Epu8({0, 0, 0, 0, 0, 2, 0, 10}, 0)));
}
// TODO uncomment
// TEST_Epu8::AGREES(eval16_ref, eval16_cycle, "[Epu8][000]")
// TEST_Epu8::AGREES(eval16_ref, eval16_popcount, "[Epu8][000]")
// TEST_Epu8::AGREES(eval16_ref, eval16_arr, "[Epu8][000]")
// TEST_Epu8::AGREES(eval16_ref, eval16_gen, "[Epu8][000]")
// TEST_Epu8::AGREES(eval16_ref, eval16, "[Epu8][000]")

TEST_AGREES_FUN_EPU8(Fix, Epu8, eval16_ref, eval16_cycle, v, "[Epu8][034]")
TEST_AGREES_FUN_EPU8(Fix, Epu8, eval16_ref, eval16_popcount, v, "[Epu8][034]")
TEST_AGREES_FUN_EPU8(Fix, Epu8, eval16_ref, eval16_arr, v, "[Epu8][034]")
TEST_AGREES_FUN_EPU8(Fix, Epu8, eval16_ref, eval16_gen, v, "[Epu8][034]")
TEST_AGREES_FUN_EPU8(Fix, Epu8, eval16_ref, eval16, v, "[Epu8][034]")

TEST_CASE("Epu8::popcount4", "[Epu8][048]") {
REQUIRE_THAT(popcount4,
24 changes: 19 additions & 5 deletions tests/test_main.hpp
Original file line number Diff line number Diff line change
@@ -22,26 +22,40 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_templated.hpp>

#define TEST_AGREES_FUN(fixture, type, ref, fun, vct, tags) \
TEST_CASE_METHOD(fixture, #type "::" #ref " == " #type "::" #fun, tags) { \
for (auto p : vct) { \
REQUIRE(fun(p) == ref(p)); \
} \
}

#define TEST_AGREES_FUN_EPU8(fixture, type, ref, fun, vct, tags) \
TEST_CASE_METHOD(fixture, #type "::" #ref " == " #type "::" #fun, tags) { \
for (auto p : vct) { \
REQUIRE_THAT(fun(p), Equals(ref(p))); \
} \
}

#define TEST_AGREES(fixture, type, ref, fun, vct, tags) \
TEST_CASE_METHOD(fixture, #type "::" #ref " == " #type "::" #fun, tags) { \
for (type p : vct) { \
for (auto p : vct) { \
REQUIRE(p.fun() == p.ref()); \
} \
}

#define TEST_AGREES2(fixture, type, ref, fun, vct, tags) \
TEST_CASE_METHOD(fixture, #type "::" #ref " == " #type "::" #fun, tags) { \
for (type p1 : vct) { \
for (type p2 : vct) { \
for (auto p1 : vct) { \
for (auto p2 : vct) { \
REQUIRE(p1.fun(p2) == p1.ref(p2)); \
} \
} \
}

#define TEST_AGREES_EPU8(fixture, type, ref, fun, vct, tags) \
TEST_CASE_METHOD(fixture, #type "::" #ref " == " #type "::" #fun, tags) { \
for (type p : vct) { \
REQUIRE_THAT(p.fun(), Equals(p.ref())); \
for (auto p : vct) { \
REQUIRE_THAT(p.fun(), Equals(p.ref())); \
} \
}

132 changes: 65 additions & 67 deletions tests/test_perm16.cpp
Original file line number Diff line number Diff line change
@@ -142,31 +142,25 @@ TEST_CASE("PTransf16::image_mask_ref_ref", "[PTransf16][002]") {
Equals(Epu8({0, FF, 0, FF, FF, 0, FF, FF, FF, FF, FF, FF, FF, FF, FF, 0}, 0)));
}

// TODO uncomment
// TEST_CASE("PTransf16::left_one", "[PTransf16][003]") {
// REQUIRE(PTransf16({}).left_one() == PTransf16::one());
// REQUIRE(PTransf16({4, 4, 4, 4}).left_one() ==
// PTransf16({FF, FF, FF, FF}));
// REQUIRE(PTransf16(Epu8(1)).left_one() == PTransf16(Epu8({FF, 1},
// FF))); REQUIRE(PTransf16(Epu8(2)).left_one() ==
// PTransf16(Epu8({FF, FF, 2}, FF)));
// REQUIRE(PTransf16(Epu8({2, 2, 2, 0xf}, 2)).left_one() ==
// PTransf16({FF, FF, 2, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF,
// FF,
// FF, 15}));
// REQUIRE(PTransf16(Epu8({FF, 2, 2, 0xf}, FF)).left_one() ==
// PTransf16({FF, FF, 2, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF,
// FF,
// FF, 15}));
// REQUIRE(
// PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, 2)).left_one() ==
// PTransf16(
// {0, FF, 2, FF, FF, 5, FF, FF, FF, FF, FF, FF, FF, FF, FF, 15 }));
// REQUIRE(
// PTransf16(Epu8({0, 2, FF, 0xf, 2, FF, 2, FF, 5}, FF)).left_one() ==
// PTransf16(
// {0, FF, 2, FF, FF, 5, FF, FF, FF, FF, FF, FF, FF, FF, FF, 15 }));
// }

TEST_CASE("PTransf16::left_one", "[PTransf16][003]") {
REQUIRE(PTransf16({}).left_one() == PTransf16::one());
REQUIRE(PTransf16({4, 4, 4, 4}).left_one() == PTransf16({FF, FF, FF, FF}));
REQUIRE(PTransf16(Epu8(1)).left_one() == PTransf16(Epu8({FF, 1}, FF)));
REQUIRE(PTransf16(Epu8(2)).left_one() == PTransf16(Epu8({FF, FF, 2}, FF)));
REQUIRE(PTransf16(Epu8({2, 2, 2, 0xf}, 2)).left_one() ==
PTransf16({FF, FF, 2, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF,
FF, 15}));
REQUIRE(PTransf16(Epu8({FF, 2, 2, 0xf}, FF)).left_one() ==
PTransf16({FF, FF, 2, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF, FF,
FF, 15}));
REQUIRE(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, 2)).left_one() ==
PTransf16(
{0, FF, 2, FF, FF, 5, FF, FF, FF, FF, FF, FF, FF, FF, FF, 15}));
REQUIRE(PTransf16(Epu8({0, 2, FF, 0xf, 2, FF, 2, FF, 5}, FF)).left_one() ==
PTransf16(
{0, FF, 2, FF, FF, 5, FF, FF, FF, FF, FF, FF, FF, FF, FF, 15}));
}

TEST_CASE("PTransf16::domain_mask", "[PTransf16][004]") {
REQUIRE_THAT(PTransf16({}).domain_mask(), Equals(Epu8(FF)));
@@ -229,22 +223,22 @@ TEST_CASE("PTransf16::rank_ref", "[PTransf16][006]") {
}

// TODO uncomment
// TEST_CASE("PTransf16::rank", "[PTransf16][007]") {
// REQUIRE(PTransf16({}).rank() == 16);
// REQUIRE(PTransf16({4, 4, 4, 4}).rank() == 12);
// REQUIRE(
// PTransf16({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}).rank() ==
// 1);
// REQUIRE(
// PTransf16({2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}).rank() ==
// 1);
// REQUIRE(
// PTransf16({2, 2, 2, 0xf, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}).rank()
// == 2);
// REQUIRE(
// PTransf16({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2}).rank()
// == 4);
// }
TEST_CASE("PTransf16::rank", "[PTransf16][007]") {
REQUIRE(PTransf16({}).rank() == 16);
REQUIRE(PTransf16({4, 4, 4, 4}).rank() == 12);
REQUIRE(
PTransf16({1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}).rank() ==
1);
REQUIRE(
PTransf16({2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}).rank() ==
1);
REQUIRE(
PTransf16({2, 2, 2, 0xf, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}).rank()
== 2);
REQUIRE(
PTransf16({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2}).rank()
== 4);
}

TEST_CASE("PTransf16::fix_points_mask", "[PTransf16][008]") {
REQUIRE_THAT(PTransf16({}).fix_points_mask(), Equals(Epu8(FF)));
@@ -369,17 +363,15 @@ TEST_CASE("PPerm16::hash", "[PPerm16][018]") {
REQUIRE(std::hash<PPerm16>()(PPerm16::one()) != 0);
REQUIRE(std::hash<PPerm16>()(PPerm16({4, 5, 0}, {9, 0, 1})) != 0);
}
// TODO uncomment
// TEST_CASE_METHOD(Perm16Fixture, "PPerm16::left_one", "[PPerm16][019]") {
// REQUIRE(PPerm16({}).left_one() == PPerm16::one());
// REQUIRE(PPerm16({FF, FF, FF, 4}).left_one() ==
// PPerm16({FF, FF, FF, FF}));
// REQUIRE(PPerm16({FF, 4, FF, FF}).left_one() ==
// PPerm16({FF, FF, FF, FF}));
// for (auto pp : PPlist) {
// REQUIRE(pp.left_one() * pp == pp);
// }
// }

TEST_CASE_METHOD(Perm16Fixture, "PPerm16::left_one", "[PPerm16][019]") {
REQUIRE(PPerm16({}).left_one() == PPerm16::one());
REQUIRE(PPerm16({FF, FF, FF, 4}).left_one() == PPerm16({FF, FF, FF, FF}));
REQUIRE(PPerm16({FF, 4, FF, FF}).left_one() == PPerm16({FF, FF, FF, FF}));
for (auto pp : PPlist) {
REQUIRE(pp.left_one() * pp == pp);
}
}

TEST_CASE_METHOD(Perm16Fixture, "PPerm16::right_one", "[PPerm16][020]") {
REQUIRE(PPerm16({}).right_one() == PPerm16::one());
@@ -429,21 +421,27 @@ TEST_CASE_METHOD(Perm16Fixture, "Perm16::smallest_fix_point", "[Perm16][023]") {

TEST_CASE_METHOD(Perm16Fixture, "Perm16::smallest_moved_point",
"[Perm16][024]") {
REQUIRE(Perm16::one().smallest_moved_point() == FF);
REQUIRE(PPa.smallest_moved_point() == 0);
REQUIRE(PPb.smallest_moved_point() == 0);
REQUIRE(RandPerm.smallest_moved_point() == 0);
REQUIRE(Perm16({0, 1, 3, 2}).smallest_moved_point() == 2);
}

// TODO broken test
// TEST_CASE_METHOD(Perm16Fixture, "Perm16::largest_fix_point", "[Perm16][025]")
// {
// REQUIRE(Perm16::one().largest_fix_point() == 15);
// REQUIRE(PPa.largest_fix_point() == 15);
// REQUIRE(PPb.largest_fix_point() == 14);
// REQUIRE(RandPerm.largest_fix_point() == 1);
// }
CHECK(Perm16::one().smallest_moved_point() == int(FF));
CHECK(PPa.smallest_moved_point() == 0);
CHECK(PPb.smallest_moved_point() == 0);
CHECK(RandPerm.smallest_moved_point() == 0);
CHECK(Perm16({0, 1, 3, 2}).smallest_moved_point() == 2);
}

TEST_CASE_METHOD(Perm16Fixture, "Perm16::largest_fix_point", "[Perm16][025]") {
CHECK(Perm16::one().largest_fix_point() == 15);
CHECK(int(PPa.largest_fix_point()) == 15);
CHECK(PPb.largest_fix_point() == 14);
CHECK(RandPerm.largest_fix_point() == 1);
CHECK(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 5, 2}, 2))
.largest_fix_point() == 2);
CHECK(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 8, 2}, 10))
.largest_fix_point() == 10);
CHECK(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 8, 2}, 14))
.largest_fix_point() == 14);
CHECK(PTransf16(Epu8({0, 2, 2, 0xf, 2, 2, 2, 2, 8, 2}, 15))
.largest_fix_point() == 15);
}

TEST_CASE_METHOD(Perm16Fixture, "Perm16::nb_fix_points", "[Perm16][026]") {
REQUIRE(Perm16::one().nb_fix_points() == 16);