7#include <kernel/adjacency/permutation.hpp> 
    8#include <kernel/util/random.hpp> 
   15      _perm_pos(num_entries),
 
   16      _swap_pos(num_entries)
 
   18      XASSERTM(num_entries > 0, 
"cannot create empty permutation");
 
   27        for(
Index i(0); i < num_entries; ++i)
 
   39      XASSERTM(v != 
nullptr, 
"invalid input array");
 
   45        for(
Index i(0); i < num_entries; ++i)
 
   54        for(
Index i(0); i < num_entries; ++i)
 
   63        for(
Index i(0); i < num_entries; ++i)
 
   73        for(
Index i(0); i < num_entries; ++i)
 
   78        for(
Index i(num_entries-1); i > 0; --i)
 
   94      _perm_pos(num_entries),
 
   95      _swap_pos(num_entries)
 
   97      XASSERTM(num_entries > 0, 
"cannot create empty random permutation");
 
   98      for(
Index i(0); i+1 < num_entries; ++i)
 
  102      _swap_pos[num_entries-1] = num_entries-1;
 
  107      _perm_pos(std::forward<IndexVector>(other._perm_pos)),
 
  108      _swap_pos(std::forward<IndexVector>(other._swap_pos))
 
  117      _perm_pos = std::forward<IndexVector>(other._perm_pos);
 
  118      _swap_pos = std::forward<IndexVector>(other._swap_pos);
 
  156      const Index* p2 = p.get_perm_pos();
 
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Index size() const
returns the size of the permutation
Index * get_perm_pos()
returns the permute-position array
IndexVector _swap_pos
the swap-position vector
void calc_swap_from_perm()
Computes the swap-position vector from the permutation-position vector.
virtual ~Permutation()
virtual destructor
void concat(const Permutation &p)
concatenates two permutations
Permutation & operator=(Permutation &&)
move-assign operator
Permutation()
default CTOR
void calc_perm_from_swap()
Computes the permutation-position vector from the swap-position vector.
ConstrType
Construction type enumeration.
@ inv_perm
create from inverse permutation array
@ none
create uninitialized permutation
@ inv_swap
create from inverse swap array
@ perm
create from permutation array
@ swap
create from swap array
@ identity
create identity permutation
void apply(Tx_ *x, bool invert=false) const
Applies In-Situ permutation.
IndexVector _perm_pos
the permute-position vector
Pseudo-Random Number Generator.
std::uint64_t Index
Index data type.