28#ifndef HPCOMBI_PERM16_HPP_
29#define HPCOMBI_PERM16_HPP_
33#include <initializer_list>
42#if defined(__GNUC__) && !defined(__clang__)
43#pragma GCC diagnostic push
44#pragma GCC diagnostic ignored "-Wswitch-default"
45#pragma GCC diagnostic ignored "-Wpacked"
48#pragma clang diagnostic push
49#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
51#include "simde/x86/sse4.1.h"
52#include "simde/x86/sse4.2.h"
54#pragma clang diagnostic pop
56#if defined(__GNUC__) && !defined(__clang__)
57#pragma GCC diagnostic pop
71 static constexpr size_t size() {
return 16; }
80 PTransf16(std::vector<uint8_t> dom, std::vector<uint8_t> rng,
82 PTransf16(std::initializer_list<uint8_t> il);
101#ifdef SIMDE_X86_SSE4_2_NATIVE
122 uint32_t
rank()
const;
168 explicit Transf16(uint64_t compressed);
170 explicit operator uint64_t()
const;
182 PPerm16(std::vector<uint8_t> dom, std::vector<uint8_t> rng,
219#ifdef SIMDE_X86_SSE4_2_NATIVE
492static_assert(
sizeof(
epu8) ==
sizeof(Perm16),
493 "epu8 and Perm16 have a different memory layout !");
494static_assert(std::is_trivial<epu8>(),
"epu8 is not a trivial class !");
495static_assert(std::is_trivial<Perm16>(),
"Perm16 is not a trivial class !");
509 return std::hash<HPCombi::epu8>{}(ar.
v);
518 return static_cast<uint64_t
>(ar);
527 return std::hash<HPCombi::epu8>{}(ar.
v);
536 return static_cast<uint64_t
>(ar);
uint8_t __attribute__((vector_size(16))) epu8
epu8 stands for Extended Packed Unsigned, grouped by 8 bits; this is the low level type chosen by Int...
Definition epu8.hpp:73
declaration of HPCombi::epu8.
epu8 permuted(epu8 a, epu8 b) noexcept
Same as permuted_ref but with an optimized implementation using intrinsics.
Definition epu8.hpp:103
epu8 permutation_of(epu8 a, epu8 b) noexcept
Find if a vector is a permutation of another one.
Definition epu8_impl.hpp:304
bool is_permutation(epu8 v, const size_t k=16) noexcept
Definition epu8_impl.hpp:531
bool is_partial_permutation(epu8 v, const size_t k=16) noexcept
Test for partial permutations.
Definition epu8_impl.hpp:500
constexpr TPUBuild< epu8 > Epu8
Factory object acting as a class constructor for type HPCombi::epu8.
Definition epu8.hpp:81
uint8_t __attribute__((vector_size(16))) epu8
epu8 stands for Extended Packed Unsigned, grouped by 8 bits; this is the low level type chosen by Int...
Definition epu8.hpp:73
bool is_transformation(epu8 v, const size_t k=16) noexcept
Test for transformation.
Definition epu8_impl.hpp:494
bool is_partial_transformation(epu8 v, const size_t k=16) noexcept
Test for partial transformation.
Definition epu8_impl.hpp:486
Definition bmat16_impl.hpp:362
implementation of perm16.hpp ; this file should not be included directly.
Generic compile-time unrolling of the fast exponentiation algorithm.
Partial permutation of ; see also HPCombi::Perm16; partial means it might not be defined everywhere (...
Definition perm16.hpp:176
PPerm16 right_one() const
Definition perm16.hpp:229
PPerm16 inverse_ref() const
The inverse of a partial permutation.
Definition perm16_impl.hpp:145
PPerm16 operator*(const PPerm16 &p) const
The product of two partial perrmutations.
Definition perm16.hpp:196
PPerm16 & operator=(const PPerm16 &)=default
constexpr PPerm16(const PPerm16 &vv)=default
PPerm16(std::vector< uint8_t > dom, std::vector< uint8_t > rng, size_t=0)
Definition perm16.hpp:182
constexpr PPerm16(const vect vv)
Definition perm16.hpp:179
static constexpr PPerm16 one()
The identity partial permutations.
Definition perm16.hpp:194
PPerm16 left_one() const
Definition perm16.hpp:230
PPerm16(std::initializer_list< uint8_t > il)
Definition perm16.hpp:185
bool validate(size_t k=16) const
Return whether *this is a well constructed object.
Definition perm16.hpp:189
constexpr PPerm16(const epu8 x)
Definition perm16.hpp:181
Partial transformation of ; see HPCombi::Transf16; partial means it might not be defined everywhere.
Definition perm16.hpp:70
uint8_t nb_fix_points() const
Returns the number of fix points of *this.
Definition perm16_impl.hpp:120
constexpr PTransf16(const epu8 x)
Definition perm16.hpp:79
uint32_t fix_points_bitset(bool complement=false) const
Returns a bit mask for the fix point of *this.
Definition perm16_impl.hpp:98
static constexpr size_t size()
Definition perm16.hpp:71
HPCombi::Vect16 vect
Definition perm16.hpp:73
PTransf16 operator*(const PTransf16 &p) const
The product of two partial transformations.
Definition perm16.hpp:92
static constexpr PTransf16 one()
The identity partial transformation.
Definition perm16.hpp:90
uint8_t largest_moved_point() const
Returns the largest non fix point of *this.
Definition perm16_impl.hpp:115
uint32_t domain_bitset(bool complement=false) const
Returns a bit mask for the domain of *this.
Definition perm16_impl.hpp:47
PTransf16 left_one() const
Returns the partial left identity for *this.
Definition perm16_impl.hpp:71
typename decltype(Epu8)::array array
Definition perm16.hpp:74
uint32_t rank_ref() const
Returns the size of the image of *this.
Definition perm16_impl.hpp:74
PTransf16 right_one() const
Returns the partial right identity for *this.
Definition perm16_impl.hpp:50
uint32_t image_bitset(bool complement=false) const
Returns a bit mask for the image of *this.
Definition perm16_impl.hpp:68
epu8 fix_points_mask(bool complement=false) const
Returns a mask for the fix point of *this.
Definition perm16_impl.hpp:95
constexpr PTransf16(const vect vv)
Definition perm16.hpp:78
uint8_t smallest_fix_point() const
Returns the smallest fix point of *this.
Definition perm16_impl.hpp:102
uint32_t rank_cmpestrm() const
Returns the size of the image of *this.
Definition perm16_impl.hpp:83
epu8 domain_mask(bool complement=false) const
Returns a mask for the domain of *this.
Definition perm16_impl.hpp:44
uint32_t rank() const
Returns the size of the image of *this.
Definition perm16_impl.hpp:87
epu8 image_mask_ref(bool complement=false) const
Returns a mask for the image of *this.
Definition perm16_impl.hpp:60
bool validate(size_t k=16) const
Return whether *this is a well constructed object.
Definition perm16.hpp:85
uint8_t largest_fix_point() const
Returns the largest fix point of *this.
Definition perm16_impl.hpp:110
epu8 image_mask(bool complement=false) const
Definition perm16.hpp:100
epu8 image_mask_cmpestrm(bool complement=false) const
Returns a mask for the image of *this.
uint8_t smallest_moved_point() const
Returns the smallest non fix point of *this.
Definition perm16_impl.hpp:106
Permutations of : A permutation is a bijective mapping of a set of n elements onto itself.
Definition perm16.hpp:237
Perm16 inverse_cycl() const
Same as inverse but with a different algorithm.
Definition perm16_impl.hpp:248
Perm16 inverse() const
The inverse permutation.
Definition perm16.hpp:274
epu8 lehmer() const
The Lehmer code of a permutation.
Definition perm16_impl.hpp:289
uint8_t length_ref() const
Same interface as length, with a different implementation.
Definition perm16_impl.hpp:298
epu8 cycles_partition() const
The set partition of the cycles of a permutation.
Definition perm16_impl.hpp:343
bool left_weak_leq_ref(Perm16 other) const
Same interface as left_weak_leq but with a different implementation.
Definition perm16_impl.hpp:361
uint8_t nb_descents_ref() const
Same interface as nb_descents, with a different implementation.
Definition perm16_impl.hpp:319
Perm16(uint64_t compressed)
Construct a permutations from its 64 bits compressed.
Definition perm16.hpp:259
Perm16 inverse_sort() const
Same as inverse but with a different algorithm.
Definition perm16_impl.hpp:224
Perm16 operator*(const Perm16 &p) const
The product of two permutations.
Definition perm16.hpp:254
Perm16(std::initializer_list< uint8_t > il)
Definition perm16.hpp:243
constexpr Perm16(const epu8 x)
Definition perm16.hpp:241
Perm16 inverse_find() const
Same as inverse but with a different algorithm.
Definition perm16.hpp:305
static constexpr Perm16 one()
The identity partial permutation.
Definition perm16.hpp:252
epu8 lehmer_ref() const
Same interface as lehmer but with a different implementation.
Definition perm16_impl.hpp:270
bool left_weak_leq_length(Perm16 other) const
Same interface as left_weak_leq but with a different implementation.
Definition perm16_impl.hpp:384
uint8_t length() const
The Coxeter length (ie: number of inversion) of a permutation.
Definition perm16_impl.hpp:317
constexpr Perm16(const Perm16 &)=default
Perm16 inverse_ref() const
Same as inverse but with a different algorithm.
Definition perm16_impl.hpp:208
uint8_t nb_descents() const
The number of descent of a permutation.
Definition perm16_impl.hpp:326
uint8_t nb_cycles() const
The number of cycles of a permutation.
Definition perm16.hpp:444
uint8_t nb_cycles_ref() const
Same interface as nb_cycles but with a different implementation.
Definition perm16_impl.hpp:330
bool validate(size_t k=16) const
Return whether *this is a well constructed object.
Definition perm16.hpp:246
static Perm16 elementary_transposition(uint64_t i)
The elementary transposition exchanging and .
Definition perm16_impl.hpp:200
epu8 lehmer_arr() const
Same interface as lehmer but with a different implementation.
Definition perm16_impl.hpp:279
static Perm16 unrankSJT(int n, int r)
The r -th permutation of size n for the Steinhaus–Johnson–Trotter order.
Definition perm16_impl.hpp:172
constexpr Perm16(const vect vv)
Definition perm16.hpp:240
bool left_weak_leq(Perm16 other) const
Compare two permutations for the left weak order.
Definition perm16_impl.hpp:371
uint8_t nb_cycles_unroll() const
Same interface as nb_cycles but with a different implementation.
Definition perm16_impl.hpp:356
Perm16 & operator=(const Perm16 &)=default
Perm16 inverse_pow() const
Same as inverse but with a different algorithm.
Definition perm16_impl.hpp:266
uint8_t length_arr() const
Same interface as length, with a different implementation.
Definition perm16_impl.hpp:307
Perm16 inverse_arr() const
Same as inverse but with a different algorithm.
Definition perm16_impl.hpp:215
static Perm16 random(uint64_t n=16)
A random permutation of size .
Definition perm16_impl.hpp:160
Full transformation of : a transformation is a mapping of a set of n elements into itself; ie as oppo...
Definition perm16.hpp:146
Transf16 operator*(const Transf16 &p) const
The product of two transformations.
Definition perm16.hpp:163
Transf16(std::initializer_list< uint8_t > il)
Definition perm16.hpp:152
constexpr Transf16(const epu8 x)
Definition perm16.hpp:151
Transf16 & operator=(const Transf16 &)=default
constexpr Transf16(const vect vv)
Definition perm16.hpp:149
bool validate(size_t k=16) const
Return whether *this is a well constructed object.
Definition perm16.hpp:156
constexpr Transf16(const Transf16 &vv)=default
static constexpr Transf16 one()
The identity transformation.
Definition perm16.hpp:161
Vector of 16 bytes, with some optimized methods, superclass of HPCombi::Transf16.
Definition vect16.hpp:39
epu8 v
Definition vect16.hpp:42
Partial transformation of ; see HPCombi::Transf16; partial means it might not be defined everywhere.
Definition perm16.hpp:70
Full transformation of : a transformation is a mapping of a set of n elements into itself; ie as oppo...
Definition perm16.hpp:146
size_t operator()(const HPCombi::PPerm16 &ar) const
A hash operator for HPCombi::PPerm16.
Definition perm16.hpp:526
size_t operator()(const HPCombi::PTransf16 &ar) const
A hash operator for HPCombi::PTransf16.
Definition perm16.hpp:508
size_t operator()(const HPCombi::Perm16 &ar) const
A hash operator for HPCombi::Perm16.
Definition perm16.hpp:535
size_t operator()(const HPCombi::Transf16 &ar) const
A hash operator for HPCombi::Transf16.
Definition perm16.hpp:517