TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
permutation.hpp File Reference
#include "../macros.hpp"
#include "../stdutil/array.hpp"
#include "../stdutil/concepts.hpp"
#include <algorithm>
#include <array>
#include <concepts>
#include <cstddef>
#include <cstdint>

Detailed Description

Provides utilities to work with permutations and to compactly encode/decode std::array objects.

Definition in file permutation.hpp.

Go to the source code of this file.

Functions

template<typename T , std::integral Int, size_t N>
constexpr std::array< T, N > nda::permutations::apply (std::array< Int, N > const &p, std::array< T, N > const &a)
 Apply a permutation to a std::array.
 
template<typename T , std::integral Int, size_t N>
constexpr std::array< T, N > nda::permutations::apply_inverse (std::array< Int, N > const &p, std::array< T, N > const &a)
 Apply the inverse of a permutation to a std::array.
 
template<std::integral Int, size_t N>
constexpr std::array< Int, N > nda::permutations::compose (std::array< Int, N > const &p1, std::array< Int, N > const &p2)
 Composition of two permutations.
 
template<size_t N>
constexpr std::array< int, N > nda::permutations::cycle (int p, int pos=N)
 Perform a forward (partial) cyclic permutation of the identity p times.
 
template<size_t N>
constexpr std::array< int, N > nda::decode (uint64_t binary_representation)
 Decode a uint64_t into a std::array<int, N>.
 
template<size_t N>
constexpr uint64_t nda::encode (std::array< int, N > const &a)
 Encode a std::array<int, N> in a uint64_t.
 
template<size_t N>
constexpr std::array< int, N > nda::permutations::identity ()
 Get the identity permutation.
 
template<std::integral Int, size_t N>
constexpr std::array< Int, N > nda::permutations::inverse (std::array< Int, N > const &p)
 Inverse of a permutation.
 
template<std::integral Int, size_t N>
constexpr bool nda::permutations::is_valid (std::array< Int, N > const &p)
 Check if a given array is a valid permutation.
 
template<size_t N>
constexpr std::array< int, N > nda::permutations::reverse_identity ()
 Get the reverse identity permutation.
 
template<size_t N>
constexpr std::array< int, N > nda::permutations::transposition (int i, int j)
 Get the permutation representing a single given transposition.