TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
nda::sym_grp< F, A >

#include <nda/sym_grp.hpp>

Detailed Description

template<typename F, typename A>
requires (Array<A> && NdaSymmetry<F, A>)
class nda::sym_grp< F, A >

Class representing a symmetry group.

A symmetry group detects and stores all different symmetry classes associated with a given nda::Array object.

A symmetry class is simply a set of all the elements of the array that are related to each other by some symmetry. The elements in a symmetry class have all the same values except for a possible sign flip or complex conjugation, i.e. an nda::operation. The symmetry classes form a partition of all the elements of the array.

Template Parameters
Fnda::NdaSymmetry type.
Anda::Array type.

Definition at line 145 of file sym_grp.hpp.

Public Types

using arr_idx_t = std::array<long, static_cast<std::size_t>(ndims)>
 Multi-dimensional index type.
 
using sym_class_t = std::span<sym_idx_t>
 Symmetry class type.
 
using sym_idx_t = std::pair<long, operation>
 Element type of a symmetry class.
 

Public Member Functions

 sym_grp ()=default
 Default constructor for a symmetry group.
 
 sym_grp (A const &a, std::vector< F > const &sym_list, long const max_length=0)
 Construct a symmetry group for a given array and a list of its symmetries.
 
std::vector< get_value_t< A > > get_representative_data (A const &a) const
 Reduce an nda::Array to its representative data using symmetries.
 
std::vector< sym_class_t > const & get_sym_classes () const
 Get the symmetry classes.
 
template<typename H >
requires (NdaInitFunc<H, A>)
void init (A &a, H const &init_func, bool parallel=false) const
 Initialize an nda::Array using an nda::NdaInitFunc.
 
template<typename V >
void init_from_representative_data (A &a, V const &vec) const
 Initialize a multi-dimensional array from its representative data using symmetries.
 
long num_classes () const
 Get the number of symmetry classes.
 
std::pair< double, arr_idx_tsymmetrize (A &a) const
 Symmetrize an array and return the maximum symmetry violation and its corresponding array index.
 

Static Public Attributes

static constexpr int ndims = get_rank<A>
 Rank of the input array.
 

Constructor & Destructor Documentation

◆ sym_grp()

template<typename F , typename A >
nda::sym_grp< F, A >::sym_grp ( A const & a,
std::vector< F > const & sym_list,
long const max_length = 0 )
inline

Construct a symmetry group for a given array and a list of its symmetries.

It uses nda::for_each to loop over all possible multi-dimensional indices of the given array and applies the symmetries to each index to generate the different symmetry classes.

Parameters
anda::Array object.
sym_listList of symmetries containing nda::NdaSymmetry objects.
max_lengthMaximum recursion depth for out-of-bounds projection. Default is 0.

Definition at line 295 of file sym_grp.hpp.

Member Function Documentation

◆ get_representative_data()

template<typename F , typename A >
std::vector< get_value_t< A > > nda::sym_grp< F, A >::get_representative_data ( A const & a) const
inlinenodiscard

Reduce an nda::Array to its representative data using symmetries.

Parameters
anda::Array object.
Returns
std::vector of data values for the representative elements of each symmetry class.

Definition at line 261 of file sym_grp.hpp.

◆ get_sym_classes()

template<typename F , typename A >
std::vector< sym_class_t > const & nda::sym_grp< F, A >::get_sym_classes ( ) const
inlinenodiscard

Get the symmetry classes.

Returns
std::vector containing the individual classes.

Definition at line 171 of file sym_grp.hpp.

◆ init()

template<typename F , typename A >
template<typename H >
requires (NdaInitFunc<H, A>)
void nda::sym_grp< F, A >::init ( A & a,
H const & init_func,
bool parallel = false ) const
inline

Initialize an nda::Array using an nda::NdaInitFunc.

The nda::NdaInitFunc object is evaluated only once per symmetry class. The result is then assigned to all elements in the symmetry class after applying the nda::operation.

Template Parameters
HCallable type of nda::NdaInitFunc.
Parameters
anda::Array object to be initialized.
init_funcCallable that is used to initialize the array.
parallelParallelize using openmp and mpi.

Definition at line 192 of file sym_grp.hpp.

◆ init_from_representative_data()

template<typename F , typename A >
template<typename V >
void nda::sym_grp< F, A >::init_from_representative_data ( A & a,
V const & vec ) const
inline

Initialize a multi-dimensional array from its representative data using symmetries.

Parameters
anda::Array object to be initialized.
vecstd::vector of data values for the representative elements of each symmetry class.

Definition at line 275 of file sym_grp.hpp.

◆ num_classes()

template<typename F , typename A >
long nda::sym_grp< F, A >::num_classes ( ) const
inlinenodiscard

Get the number of symmetry classes.

Returns
Number of detected symmetry classes.

Definition at line 177 of file sym_grp.hpp.

◆ symmetrize()

template<typename F , typename A >
std::pair< double, arr_idx_t > nda::sym_grp< F, A >::symmetrize ( A & a) const
inline

Symmetrize an array and return the maximum symmetry violation and its corresponding array index.

Note
This actually requires the definition of an inverse operation but with the current implementation, all operations are self-inverse (sign flip and complex conjugation).
Parameters
anda::Array object to be symmetrized.
Returns
Maximum symmetry violation and corresponding array index.

Definition at line 226 of file sym_grp.hpp.


The documentation for this class was generated from the following file: