38    for (
size_t i = 0; i < dom.size(); ++i) {
 
 
   45    return complement ? 
v == 
Epu8(0xFF) : 
v != 
Epu8(0xFF);
 
 
   48    return simde_mm_movemask_epi8(
domain_mask(complement));
 
 
   54#ifdef SIMDE_X86_SSE4_2_NATIVE 
   56    return complement ? _mm_cmpestrm(
v, 16, 
one().
v, 16, FIND_IN_VECT)
 
   57                      : _mm_cmpestrm(
v, 16, 
one().
v, 16, FIND_IN_VECT_COMPL);
 
   65    return complement ? 
static_cast<epu8>(!
res) : 
res;
 
 
   69    return simde_mm_movemask_epi8(
image_mask(complement));
 
 
   76    static_assert(
decltype(
Epu8)
::size == 16, 
"Wrong size of EPU8 array");
 
   80    return std::accumulate(tmp.begin(), tmp.end(), uint8_t(0));
 
 
   88#ifdef SIMDE_X86_SSE4_2_NATIVE 
 
   96    return complement ? 
v != 
one().
v : 
v == 
one().
v;
 
 
  112    return res == 0 ? 0xFF : 31 - __builtin_clz(
res);
 
 
  117    return res == 0 ? 0xFF : 31 - __builtin_clz(
res);
 
 
  124inline static constexpr uint8_t hilo_exchng_fun(uint8_t i) {
 
  125    return i < 8 ? i + 8 : i - 8;
 
  127static constexpr epu8 hilo_exchng = 
Epu8(hilo_exchng_fun);
 
  128inline static constexpr uint8_t hilo_mask_fun(uint8_t i) {
 
  129    return i < 8 ? 0x0 : 0xFF;
 
  131static constexpr epu8 hilo_mask = 
Epu8(hilo_mask_fun);
 
  134    epu8 res = simde_mm_set_epi64x(compressed, compressed);
 
  135    v = simde_mm_blendv_epi8(
res & 
Epu8(0x0F), 
res >> 4, hilo_mask);
 
 
  138inline Transf16::operator uint64_t()
 const {
 
  140        static_cast<epu8>(simde_mm_slli_epi32(
static_cast<simde__m128i
>(
v), 4));
 
  142    return simde_mm_extract_epi64(
res, 0);
 
 
  147    for (
size_t i = 0; i < 16; ++i)
 
 
  153#ifdef SIMDE_X86_SSE4_2_NATIVE 
  154inline PPerm16 PPerm16::inverse_find()
 const {
 
  155    epu8 mask = _mm_cmpestrm(
v, 16, 
one(), 16, FIND_IN_VECT);
 
  161    static std::random_device rd;
 
  162    static std::mt19937 g(rd());
 
  165    auto ar = 
res.as_array();
 
  167    std::shuffle(ar.begin(), ar.begin() + n, g);
 
 
  174    std::array<int, 16> dir;
 
  176    for (j = 0; j < n; ++j)
 
  178    for (j = n - 1; j >= 0; --j) {
 
 
  210    for (
size_t i = 0; i < 16; ++i)
 
 
  219    for (
size_t i = 0; i < 16; ++i)
 
 
  229                   simde_mm_slli_epi32(
static_cast<simde__m128i
>(
v), 4)) +
 
 
  251    for (
int i = 9; i <= 16; i++) {
 
  253        newpow = oldpow * *
this;
 
  254        res.v = simde_mm_blendv_epi8(
res, oldpow, newpow.
v == 
one().
v);
 
 
  259static constexpr uint32_t lcm_range(uint8_t n) {
 
  261    for (uint8_t i = 1; i <= n; ++i)
 
  267    return pow<lcm_range(16) - 1>(*this);
 
 
  272    for (
size_t i = 0; i < 16; i++)
 
  273        for (
size_t j = i + 1; j < 16; j++)
 
 
  282    for (
size_t i = 0; i < 16; i++)
 
  283        for (
size_t j = i + 1; j < 16; j++)
 
 
  291    for (
int i = 1; i < 16; i++) {
 
 
  300    for (
size_t i = 0; i < 16; i++)
 
  301        for (
size_t j = i + 1; j < 16; j++)
 
 
  310    for (
size_t i = 0; i < 16; i++)
 
  311        for (
size_t j = i + 1; j < 16; j++)
 
 
  321    for (
size_t i = 0; i < 16 - 1; i++)
 
 
  327    return __builtin_popcountl(simde_mm_movemask_epi8(
v < 
shifted_right(
v)));
 
 
  331    std::array<bool, 16> b{};
 
  333    for (
size_t i = 0; i < 16; i++) {
 
  335            for (
size_t j = i; !b[j]; j = 
v[j])
 
 
  358    return __builtin_popcountl(simde_mm_movemask_epi8(
res));
 
 
  362    for (
size_t i = 0; i < 16; i++) {
 
  363        for (
size_t j = i + 1; j < 16; j++) {
 
  364            if ((
v[i] > 
v[j]) && (other[i] < other[j]))
 
 
  372    epu8 srot = 
v, orot = other;
 
  373    for (
size_t i = 0; i < 15; i++) {
 
  376        uint64_t sinv = simde_mm_movemask_epi8(
v < srot);
 
  377        uint64_t oinv = simde_mm_movemask_epi8(other.
v < orot);
 
  378        if ((sinv & oinv) != sinv)
 
 
const PTransf16 id
Definition RD.cpp:37
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
#define HPCOMBI_ASSERT(x)
Definition debug.hpp:31
std::array< std::tuple< uint16_t, uint16_t, std::array< uint16_t, gens.size()> >, 65536 > res
Definition image.cpp:66
Definition perm16_impl.hpp:236
Perm16 Perm16
Definition perm16_impl.hpp:239
epu8 permuted(epu8 a, epu8 b) noexcept
Same as permuted_ref but with an optimized implementation using intrinsics.
Definition epu8.hpp:103
epu8 shifted_right(epu8 a) noexcept
Left shifted of a HPCombi::epu8 inserting a 0.
Definition epu8.hpp:110
epu8 permutation_of(epu8 a, epu8 b) noexcept
Find if a vector is a permutation of another one.
Definition epu8_impl.hpp:304
uint8_t horiz_sum(epu8 v) noexcept
Horizontal sum of a HPCombi::epu8.
Definition epu8.hpp:260
epu8 sorted(epu8 a) noexcept
Return a sorted HPCombi::epu8.
Definition epu8_impl.hpp:204
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
epu8 shifted_left(epu8 a) noexcept
Right shifted of a HPCombi::epu8 inserting a 0.
Definition epu8.hpp:117
TPUBuild< TPU >::array & as_array(TPU &v) noexcept
Cast a TPU to a c++ std::array.
Definition builder.hpp:145
const T pow(const T x)
A generic compile time exponentiation function.
Definition power.hpp:91
Partial permutation of ; see also HPCombi::Perm16; partial means it might not be defined everywhere (...
Definition perm16.hpp:176
PPerm16 inverse_ref() const
The inverse of a partial permutation.
Definition perm16_impl.hpp:145
static constexpr PPerm16 one()
The identity partial permutations.
Definition perm16.hpp:194
uint8_t nb_fix_points() const
Returns the number of fix points of *this.
Definition perm16_impl.hpp:120
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
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
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
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
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 inverse_sort() const
Same as inverse but with a different algorithm.
Definition perm16_impl.hpp:224
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
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_ref() const
Same interface as nb_cycles but with a different implementation.
Definition perm16_impl.hpp:330
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
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 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
array & as_array()
Definition vect16.hpp:50
epu8 v
Definition vect16.hpp:42
static const Perm16 one()
Definition perm16_impl.hpp:242
static Perm16 prod(Perm16 a, Perm16 b)
Definition perm16_impl.hpp:243
Algebraic monoid structure used by default for type T by the pow function and prod function.
Definition power.hpp:111