Documentation of CSL
Public Member Functions | Friends
csl::Permutation Class Reference

Handles a std::vector of integers that represents the permutation of n indices, with a possible symmetry of an IndexStructure. More...

#include <symmetry.h>

Public Member Functions

 Permutation ()
 Default constructor.
 
 Permutation (int n)
 Initializes the identity permutation of n elements. More...
 
 Permutation (const std::vector< int > &t_permutation)
 constructor that takes a vector of integers corresponding to the permutation. All integers between 0 and the size of t_permutation-1 must be represented. More...
 
 Permutation (int n, const std::vector< int > &list)
 Constructor that initializes the size of the Permutation to n, and takes one cycle (that concerns possibly only few elements) as initialization. For example, Permutation(5,{1,0,2}) intializes the permutation to (2,0,1,3,4). More...
 
 Permutation (int n, const std::vector< int > &list, int sym)
 
 Permutation (int n, const std::vector< std::vector< int > > &list)
 Constructor that initializes the size of the Permutation to n, and takes several cycles (that concerns possibly only few elements) as initialization. For example Permutation(10,{{6,7},{1,0,2}}) initializes the permutation to (2,0,1,3,4,5,7,6,8,9). More...
 
 Permutation (const Permutation &permutation)=default
 Copy constructor. More...
 
 ~Permutation ()
 Destructor.
 
int getOrder ()
 This function calculates the order of the permutation the first time, or just return it if it has already been calculated. More...
 
int getSign ()
 This function calculates the sign of the permutation the first time, or just return it if it has already been calculated. More...
 
int getSymmetry () const
 
std::vector< int > getPermutation () const
 
void setSymmetry (int t_symmetry)
 
void adjustToSize (size_t newSize)
 
void applyRedefinition (const std::vector< size_t > &redefinition)
 
Permutationoperator= (const Permutation &t_permutation)=default
 Assignement operator. Copies t_permutation and returns a reference to *this. More...
 
Permutation operator* (const Permutation &t_permutation) const
 operator*, Compose two Permutation objects and returns the result in a new Permutation. More...
 
bool operator== (const Permutation &t_permutation) const
 operator==, tells if two Permutation objects are equal. More...
 
bool operator!= (const Permutation &t_permuation) const
 operator!=, tells if two Permutation objects are not equal. More...
 

Friends

std::ostream & operator<< (std::ostream &fout, const Permutation &permutation)
 operator<<, displays the Permutation t_permutation in the output fout. More...
 

Detailed Description

Handles a std::vector of integers that represents the permutation of n indices, with a possible symmetry of an IndexStructure.

Constructor & Destructor Documentation

◆ Permutation() [1/5]

csl::Permutation::Permutation ( int  n)
explicit

Initializes the identity permutation of n elements.

Parameters
nThe number of elements of the permutation.

◆ Permutation() [2/5]

csl::Permutation::Permutation ( const std::vector< int > &  t_permutation)
explicit

constructor that takes a vector of integers corresponding to the permutation. All integers between 0 and the size of t_permutation-1 must be represented.

Parameters
t_permutationThe complete permutation in the form of a std::vector<int>.

◆ Permutation() [3/5]

csl::Permutation::Permutation ( int  n,
const std::vector< int > &  list 
)

Constructor that initializes the size of the Permutation to n, and takes one cycle (that concerns possibly only few elements) as initialization. For example, Permutation(5,{1,0,2}) intializes the permutation to (2,0,1,3,4).

Parameters
nTotal size of the permutation.
listOnly cycle in the permutation.

◆ Permutation() [4/5]

csl::Permutation::Permutation ( int  n,
const std::vector< std::vector< int > > &  list 
)

Constructor that initializes the size of the Permutation to n, and takes several cycles (that concerns possibly only few elements) as initialization. For example Permutation(10,{{6,7},{1,0,2}}) initializes the permutation to (2,0,1,3,4,5,7,6,8,9).

Parameters
nTotal size of the permutation.
listCycles in the permutation.

Here just test of validity of the cycle

◆ Permutation() [5/5]

csl::Permutation::Permutation ( const Permutation permutation)
default

Copy constructor.

Parameters
permutationPermutation to copy.

Member Function Documentation

◆ getOrder()

int csl::Permutation::getOrder ( )

This function calculates the order of the permutation the first time, or just return it if it has already been calculated.

Returns
The order of the permutation.

◆ getPermutation()

vector< int > csl::Permutation::getPermutation ( ) const
Returns
The vector of integers defining the permutation.

◆ getSign()

int csl::Permutation::getSign ( )

This function calculates the sign of the permutation the first time, or just return it if it has already been calculated.

Returns
The sign of the permutation.

◆ getSymmetry()

int csl::Permutation::getSymmetry ( ) const
Returns
The symmetry factor the user associated with the permutation, (1 if symmetric -1 if antisymmetric).

◆ operator!=()

bool csl::Permutation::operator!= ( const Permutation t_permuation) const

operator!=, tells if two Permutation objects are not equal.

Parameters
t_permutationPermutation to compare to *this.
Returns
False if the two Permutation objects are equal.
True else.

◆ operator*()

Permutation csl::Permutation::operator* ( const Permutation t_permutation) const

operator*, Compose two Permutation objects and returns the result in a new Permutation.

Parameters
t_permutationPermutation to multiply to *this.
Returns
A Permutation that is the product of *this and t_permutation.

◆ operator=()

Permutation& csl::Permutation::operator= ( const Permutation t_permutation)
default

Assignement operator. Copies t_permutation and returns a reference to *this.

Parameters
t_permutationPermutation to copy.
Returns
A reference to the modified object.

◆ operator==()

bool csl::Permutation::operator== ( const Permutation t_permutation) const

operator==, tells if two Permutation objects are equal.

Parameters
t_permutationPermutation to compare to *this.
Returns
True if the two Permutation objects are equal.
False else.

◆ setSymmetry()

void csl::Permutation::setSymmetry ( int  t_symmetry)
Parameters
t_symmetryNew symmetry factor, =1 if symmetric, =-1 if antisymmetric.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  fout,
const Permutation permutation 
)
friend

operator<<, displays the Permutation t_permutation in the output fout.

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

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