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

Small class that allows to handle contractions of indices between tensors. More...

#include <indicial.h>

Public Member Functions

 SelfContraction (const Expr &A, const Expr &B, std::optional< std::function< bool(Expr_info, Expr_info)>> t_condition=std::nullopt)
 Constructor. Takes two tensors and determines the contractions between the two. More...
 
 SelfContraction (Expr_info A, Expr_info B, std::optional< std::function< bool(Expr_info, Expr_info)>> t_condition=std::nullopt)
 
bool empty () const
 
bool conditionAppliesOn (Expr_info A, Expr_info B) const
 
bool conditionAppliesOn (const Expr &A, const Expr &B) const
 
bool isSwappable () const
 
void setSwappable (bool t_swappable)
 
bool operator== (const SelfContraction &other) const
 Compares the SelfContraction with another. More...
 
Expr applyIndices (const Expr &A, const Expr &B, const SelfContraction &targetContraction, const Expr &res) const
 

Protected Attributes

std::vector< std::pair< int, csl::Index > > specialAValues
 
std::vector< std::pair< int, csl::Index > > specialBValues
 
std::vector< std::pair< int, int > > contraction
 Contains a list of pairs of integers. Each pair corresponds to the places of the two contracted indices (respectively in the two expressions).
 
std::optional< std::function< bool(Expr_info, Expr_info)> > condition
 
std::array< IndexStructure, 2 > freeStructures
 
bool swappable = true
 

Friends

std::ostream & operator<< (std::ostream &fout, const SelfContraction &c)
 Displays the SelfContraction c. More...
 

Detailed Description

Small class that allows to handle contractions of indices between tensors.

This class provides a constructor that takes two TensorElement and determines automatically the contractions between the two, and an operator== that compares two contractions to see if they are the same.

Constructor & Destructor Documentation

◆ SelfContraction()

csl::SelfContraction::SelfContraction ( const Expr A,
const Expr B,
std::optional< std::function< bool(Expr_info, Expr_info)>>  t_condition = std::nullopt 
)

Constructor. Takes two tensors and determines the contractions between the two.

Parameters
AMust be an TensorElement.
BMust be an TensorElement.

Member Function Documentation

◆ empty()

bool csl::SelfContraction::empty ( ) const
Returns
True if the SelfContraction is empty (no pair of integers).
False else.

◆ operator==()

bool csl::SelfContraction::operator== ( const SelfContraction other) const

Compares the SelfContraction with another.

Returns
True if the other is a part of *this.
False else.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  fout,
const SelfContraction c 
)
friend

Displays the SelfContraction c.

std::ostream& operator<<(std::ostream& fout, const SelfContraction& C)


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