10#include <kernel/util/random.hpp> 
   27      using IndexVector = std::vector < Index>;
 
   84        const Index* v = 
nullptr);
 
  172      template<
typename IT_>
 
  175        return IT_(
_perm_pos.at(std::size_t(i)));
 
  197      template<
typename Tx_>
 
  198      void apply(Tx_* x, 
bool invert = 
false)
 const 
  208            ASSERTM((j >= i) && (j < this->
size()), 
"invalid swap position");
 
  220          for(
Index i(this->
size() -1); i > 0; --i)
 
  223            ASSERTM((j >= i-1) && (j < this->
size()), 
"invalid swap position");
 
  250      template<
typename Ty_, 
typename Tx_>
 
  252      void apply(Ty_* y, 
const Tx_* x, 
bool invert = 
false)
 const 
#define ASSERTM(expr, msg)
Debug-Assertion macro definition with custom message.
#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
const Index * get_perm_pos() const
returns the permute-position array
Index * get_perm_pos()
returns the permute-position array
IndexVector _swap_pos
the swap-position vector
bool empty() const
Checks whether the permutation is empty.
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
Index * get_swap_pos()
returns the swap-position array
Permutation inverse() const
Computes the inverse permutation.
void apply(Ty_ *y, const Tx_ *x, bool invert=false) const
Applies permutation.
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
const Index * get_swap_pos() const
returns the swap-position array
void apply(Tx_ *x, bool invert=false) const
Applies In-Situ permutation.
Permutation clone() const
Clones this permutation.
IndexVector _perm_pos
the permute-position vector
Pseudo-Random Number Generator.
std::uint64_t Index
Index data type.