Documentation of CSL
Public Member Functions | Protected Attributes | Friends
csl::Symmetry Class Reference

Handles the full symmetry properties of an TensorElement, i.e. a vector of Permutation objects, each giving a permutation of the indices and the sign of the permutation (if the permutation is symmetric or anti-symmetric). More...

#include <symmetry.h>

Inheritance diagram for csl::Symmetry:
Inheritance graph
[legend]

Public Member Functions

 Symmetry ()
 Default constructor.
 
 Symmetry (int t_dim)
 Initializes the symmetry in a given dimension.
 
 Symmetry (const Symmetry &t_symmetry)=default
 Copy constructor. More...
 
 ~Symmetry ()
 Destructor.
 
int getDim () const
 The dimension of the symmetry is the number of indices on which it is applied, and then also the Permutation::size of the Permutation objects it encapsulates. More...
 
size_t getNPermutation () const
 
std::vector< PermutationgetPermutation () const
 
int getSymmetryOf (int i, int j) const
 
void addSymmetry (const Permutation &newPermutation, int sym=1)
 Adds a new symmetry in the form of a Permutation. The user must give the Permutation and the symmetry factor associated (1 if the Permutation is a symmetry, -1 if it is an anti-symmetry). More...
 
void addSymmetry (const std::vector< int > &newPermutation, int sym=1)
 Adds a new symmetry in the form of a Permutation. The user must give the Permutation and the symmetry factor associated (1 if the Permutation is a symmetry, -1 if it is an anti-symmetry). More...
 
void addSymmetry (const std::vector< std::vector< int >> &newPermutation, int sym=1)
 Adds a new symmetry in the form of a Permutation. The user must give the Permutation and the symmetry factor associated (1 if the Permutation is a symmetry, -1 if it is an anti-symmetry). More...
 
void adjustPermutationSize ()
 
void setMustGetSpan (bool t_must)
 
bool operator== (const Symmetry &symmetry) const
 operator==, compares two Symmetry objects. More...
 
bool operator!= (const Symmetry &symmetry) const
 operator!=, compares two Symmetry objects. More...
 
Symmetry operator* (const Symmetry &other) const
 

Protected Attributes

int dim
 Dimension of the symmetry, i.e. number of indices of the TensorElement.
 
bool mustGetSpan = true
 
std::vector< Permutationpermutation
 List of the permutations for which the TensorElement have a symmetry or an antisymmetry property.
 

Friends

std::ostream & operator<< (std::ostream &fout, const Symmetry &symmetry)
 operator<<, displays the Symmetry symmetry in the output fout. More...
 

Detailed Description

Handles the full symmetry properties of an TensorElement, i.e. a vector of Permutation objects, each giving a permutation of the indices and the sign of the permutation (if the permutation is symmetric or anti-symmetric).

Constructor & Destructor Documentation

◆ Symmetry()

csl::Symmetry::Symmetry ( const Symmetry t_symmetry)
default

Copy constructor.

Parameters
t_symmetrySymmetry to copy.

Member Function Documentation

◆ addSymmetry() [1/3]

void csl::Symmetry::addSymmetry ( const Permutation newPermutation,
int  sym = 1 
)

Adds a new symmetry in the form of a Permutation. The user must give the Permutation and the symmetry factor associated (1 if the Permutation is a symmetry, -1 if it is an anti-symmetry).

Parameters
newPermutationNew Permutation describing the symmetry.
symSymmetry factor, +1 or -1.

◆ addSymmetry() [2/3]

void csl::Symmetry::addSymmetry ( const std::vector< int > &  newPermutation,
int  sym = 1 
)

Adds a new symmetry in the form of a Permutation. The user must give the Permutation and the symmetry factor associated (1 if the Permutation is a symmetry, -1 if it is an anti-symmetry).

Warning
This function may be used only if the symmetry has already a defined dimension.
Parameters
newPermutationNew Permutation describing the symmetry.
symSymmetry factor, +1 or -1.

◆ addSymmetry() [3/3]

void csl::Symmetry::addSymmetry ( const std::vector< std::vector< int >> &  newPermutation,
int  sym = 1 
)

Adds a new symmetry in the form of a Permutation. The user must give the Permutation and the symmetry factor associated (1 if the Permutation is a symmetry, -1 if it is an anti-symmetry).

Warning
This function may be used only if the symmetry has already a defined dimension.
Parameters
newPermutationNew Permutation describing the symmetry.
symSymmetry factor, +1 or -1.

◆ getDim()

int csl::Symmetry::getDim ( ) const

The dimension of the symmetry is the number of indices on which it is applied, and then also the Permutation::size of the Permutation objects it encapsulates.

Returns
The dimension of the Symmetry object.

◆ getNPermutation()

size_t csl::Symmetry::getNPermutation ( ) const
Returns
The number of Permutation objects the Symmetry handles.

◆ getPermutation()

vector< Permutation > csl::Symmetry::getPermutation ( ) const
Returns
The vector of Permutation objects managed by the Symmetry.

◆ operator!=()

bool csl::Symmetry::operator!= ( const Symmetry symmetry) const

operator!=, compares two Symmetry objects.

Parameters
symmetrySymmetry to compare to *this.
Returns
False if the two symmetries are the same.
True else.

◆ operator==()

bool csl::Symmetry::operator== ( const Symmetry symmetry) const

operator==, compares two Symmetry objects.

Parameters
symmetrySymmetry to compare to *this.
Returns
True if the two symmetries are the same.
False else.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  fout,
const Symmetry symmetry 
)
friend

operator<<, displays the Symmetry symmetry in the output fout.

Parameters
foutOutput flux.
permutationSymmetry to diplay.
Returns
A reference to the modified flux fout.

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