CheMPS2
CheMPS2::TensorOperator Class Reference

#include <TensorOperator.h>

+ Inheritance diagram for CheMPS2::TensorOperator:
+ Collaboration diagram for CheMPS2::TensorOperator:

Public Member Functions

 TensorOperator (const int boundary_index, const int two_j, const int n_elec, const int n_irrep, const bool moving_right, const bool prime_last, const bool jw_phase, const SyBookkeeper *bk_up, const SyBookkeeper *bk_down)
 Constructor. More...
 
virtual ~TensorOperator ()
 Destructor.
 
int gNKappa () const
 Get the number of symmetry blocks. More...
 
double * gStorage ()
 Get the pointer to the storage. More...
 
int gKappa (const int N1, const int TwoS1, const int I1, const int N2, const int TwoS2, const int I2) const
 Get the index corresponding to a certain tensor block. More...
 
int gKappa2index (const int kappa) const
 Get the storage jump corresponding to a certain tensor block. More...
 
double * gStorage (const int N1, const int TwoS1, const int I1, const int N2, const int TwoS2, const int I2)
 Get the pointer to the storage of a certain tensor block. More...
 
int gIndex () const
 Get the boundary index. More...
 
int get_2j () const
 Get twice the spin of the tensor operator. More...
 
int get_nelec () const
 Get how many electrons there are more in the symmetry sector of the lower leg compared to the upper leg. More...
 
int get_irrep () const
 Get the (real-valued abelian) point group irrep difference between the symmetry sectors of the lower and upper legs (see Irreps.h) More...
 
void update (TensorOperator *previous, TensorT *mps_tensor_up, TensorT *mps_tensor_down, double *workmem)
 Clear and update. More...
 
void daxpy (double alpha, TensorOperator *to_add)
 daxpy for TensorOperator More...
 
void daxpy_transpose_tensorCD (const double alpha, TensorOperator *to_add)
 daxpy_transpose for C- and D-tensors (with special spin-dependent factors) More...
 
void clear ()
 Set all storage variables to 0.0.
 
double inproduct (TensorOperator *buddy, const char trans) const
 Make the in-product of two TensorOperator. More...
 

Protected Member Functions

void update_moving_right (const int ikappa, TensorOperator *previous, TensorT *mps_tensor_up, TensorT *mps_tensor_down, double *workmem)
 Update moving right. More...
 
void update_moving_left (const int ikappa, TensorOperator *previous, TensorT *mps_tensor_up, TensorT *mps_tensor_down, double *workmem)
 Update moving left. More...
 

Protected Attributes

const SyBookkeeperbk_up
 The bookkeeper of the upper MPS.
 
const SyBookkeeperbk_down
 The bookkeeper of the lower MPS.
 
int two_j
 Twice the spin of the tensor operator.
 
int n_elec
 How many electrons there are more in the symmetry sector of the lower leg compared to the upper leg.
 
int n_irrep
 The (real-valued abelian) point group irrep difference between the symmetry sectors of the lower and upper legs (see Irreps.h)
 
bool moving_right
 Whether or not moving right.
 
int * sector_nelec_up
 The up particle number sector.
 
int * sector_irrep_up
 The up spin symmetry sector.
 
int * sector_spin_up
 The up spin symmetry sector.
 
int * sector_spin_down
 The down spin symmetry sector (pointer points to sectorTwoS1 if two_j == 0)
 
bool prime_last
 Convention in which the tensor operator is stored (see class information)
 
bool jw_phase
 Whether or not to include a Jordan-Wigner phase due to the fermion anti-commutation relations.
 
- Protected Attributes inherited from CheMPS2::Tensor
int index
 Index of the Tensor object. For TensorT: a site index; for other tensors: a boundary index.
 
double * storage
 The actual variables. Tensor block kappa begins at storage+kappa2index[kappa] and ends at storage+kappa2index[kappa+1].
 
int nKappa
 Number of Tensor blocks.
 
int * kappa2index
 kappa2index[kappa] indicates the start of tensor block kappa in storage. kappa2index[nKappa] gives the size of storage.
 

Detailed Description

TensorOperator class.

Author
Sebastian Wouters sebas.nosp@m.tian.nosp@m.woute.nosp@m.rs@g.nosp@m.mail..nosp@m.com
Date
October 15, 2015

The TensorOperator class is a storage and update class for tensor operators with a given:

  • spin (two_j)
  • particle number (n_elec)
  • point group irrep (n_irrep).

It replaces the previous classes TensorDiag, TensorSwap, TensorS0Abase, TensorS1Bbase, TensorF0Cbase, TensorF1Dbase, TensorA, TensorB, TensorC, and TensorD. Their storage and update functions have a common origin. The boolean prime_last denotes whether in which convention the tensor operator is stored:

  • $ \braket{ j m J M | j' m' } \braket{ j ( N, I ) || J ( n\_elec, n\_irrep ) || j' ( N + n\_elec, I \times n\_irrep ) } $ (prime_last == true)
  • $ \braket{ j' m' J M | j m } \braket{ j ( N, I ) || J ( n\_elec, n\_irrep ) || j' ( N + n\_elec, I \times n\_irrep ) } $ (prime_last == false).

This determines the specific reduced update formulae when contracting with the Clebsch-Gordan coefficients of the reduced MPS tensors.

Definition at line 42 of file TensorOperator.h.

Constructor & Destructor Documentation

CheMPS2::TensorOperator::TensorOperator ( const int  boundary_index,
const int  two_j,
const int  n_elec,
const int  n_irrep,
const bool  moving_right,
const bool  prime_last,
const bool  jw_phase,
const SyBookkeeper bk_up,
const SyBookkeeper bk_down 
)

Constructor.

Parameters
boundary_indexThe boundary index
two_jTwice the spin of the tensor operator
n_elecHow many electrons there are more in the symmetry sector of the lower leg compared to the upper leg
n_irrepThe (real-valued abelian) point group irrep difference between the symmetry sectors of the lower and upper legs (see Irreps.h)
moving_rightIf true: sweep from left to right. If false: sweep from right to left.
prime_lastConvention in which the tensor operator is stored (see class information)
jw_phaseWhether or not to include a Jordan-Wigner phase due to the fermion anti-commutation relations
bk_upSymmetry bookkeeper of the upper MPS
bk_downSymmetry bookkeeper of the lower MPS

Definition at line 29 of file TensorOperator.cpp.

+ Here is the call graph for this function:

Member Function Documentation

void CheMPS2::TensorOperator::daxpy ( double  alpha,
TensorOperator to_add 
)

daxpy for TensorOperator

Parameters
alphaThe prefactor
to_addThe TensorOperator x which should be added: this <– this + alpha * to_add

Definition at line 407 of file TensorOperator.cpp.

+ Here is the call graph for this function:

void CheMPS2::TensorOperator::daxpy_transpose_tensorCD ( const double  alpha,
TensorOperator to_add 
)

daxpy_transpose for C- and D-tensors (with special spin-dependent factors)

Parameters
alphaThe prefactor
to_addThe TensorOperator x which should be added: this <– this + alpha * special_spin_dependent_factor * to_add^T

Definition at line 416 of file TensorOperator.cpp.

+ Here is the call graph for this function:

int CheMPS2::TensorOperator::get_2j ( ) const

Get twice the spin of the tensor operator.

Returns
Twice the spin of the tensor operatorg

Definition at line 151 of file TensorOperator.cpp.

+ Here is the caller graph for this function:

int CheMPS2::TensorOperator::get_irrep ( ) const

Get the (real-valued abelian) point group irrep difference between the symmetry sectors of the lower and upper legs (see Irreps.h)

Returns
The (real-valued abelian) point group irrep difference between the symmetry sectors of the lower and upper legs (see Irreps.h)

Definition at line 155 of file TensorOperator.cpp.

+ Here is the caller graph for this function:

int CheMPS2::TensorOperator::get_nelec ( ) const

Get how many electrons there are more in the symmetry sector of the lower leg compared to the upper leg.

Returns
How many electrons there are more in the symmetry sector of the lower leg compared to the upper leg

Definition at line 153 of file TensorOperator.cpp.

+ Here is the caller graph for this function:

int CheMPS2::TensorOperator::gIndex ( ) const
virtual

Get the boundary index.

Returns
the index

Implements CheMPS2::Tensor.

Definition at line 149 of file TensorOperator.cpp.

int CheMPS2::TensorOperator::gKappa ( const int  N1,
const int  TwoS1,
const int  I1,
const int  N2,
const int  TwoS2,
const int  I2 
) const
virtual

Get the index corresponding to a certain tensor block.

Parameters
N1The up particle number sector
TwoS1The up spin symmetry sector
I1The up irrep sector
N2The down particle number sector
TwoS2The down spin symmetry sector
I2The down irrep sector
Returns
The kappa corresponding to the input parameters; -1 means no such block

Implements CheMPS2::Tensor.

Definition at line 119 of file TensorOperator.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int CheMPS2::TensorOperator::gKappa2index ( const int  kappa) const
virtual

Get the storage jump corresponding to a certain tensor block.

Parameters
kappaThe symmetry block
Returns
kappa2index[kappa], the memory jumper to a certain block

Implements CheMPS2::Tensor.

Definition at line 139 of file TensorOperator.cpp.

+ Here is the caller graph for this function:

int CheMPS2::TensorOperator::gNKappa ( ) const
virtual

Get the number of symmetry blocks.

Returns
The number of symmetry blocks

Implements CheMPS2::Tensor.

Definition at line 115 of file TensorOperator.cpp.

+ Here is the caller graph for this function:

double * CheMPS2::TensorOperator::gStorage ( )
virtual

Get the pointer to the storage.

return pointer to the storage

Implements CheMPS2::Tensor.

Definition at line 117 of file TensorOperator.cpp.

+ Here is the caller graph for this function:

double * CheMPS2::TensorOperator::gStorage ( const int  N1,
const int  TwoS1,
const int  I1,
const int  N2,
const int  TwoS2,
const int  I2 
)
virtual

Get the pointer to the storage of a certain tensor block.

Parameters
N1The up particle number sector
TwoS1The up spin symmetry sector
I1The up irrep sector
N2The down particle number sector
TwoS2The down spin symmetry sector
I2The down irrep sector
Returns
Pointer to the storage of the specified tensor block; NULL means no such block

Implements CheMPS2::Tensor.

Definition at line 141 of file TensorOperator.cpp.

+ Here is the call graph for this function:

double CheMPS2::TensorOperator::inproduct ( TensorOperator buddy,
const char  trans 
) const

Make the in-product of two TensorOperator.

Parameters
buddyThe second tensor
transIf trans == 'N' a regular ddot is taken. If trans == 'T' and n_elec==0, the in-product with buddy's transpose is made.
Returns
The in-product

Definition at line 457 of file TensorOperator.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CheMPS2::TensorOperator::update ( TensorOperator previous,
TensorT mps_tensor_up,
TensorT mps_tensor_down,
double *  workmem 
)

Clear and update.

Parameters
previousThe previous TensorOperator needed for the update
mps_tensor_upThe upper MPS tensor needed for the update
mps_tensor_downThe lower MPS tensor needed for the update
workmemWork memory

Definition at line 163 of file TensorOperator.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CheMPS2::TensorOperator::update_moving_left ( const int  ikappa,
TensorOperator previous,
TensorT mps_tensor_up,
TensorT mps_tensor_down,
double *  workmem 
)
protected

Update moving left.

Parameters
ikappaThe tensor block which should be updated
previousThe previous TensorOperator needed for the update
mps_tensor_upThe upper MPS tensor needed for the update
mps_tensor_downThe lower MPS tensor needed for the update
workmemWork memory

Definition at line 293 of file TensorOperator.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CheMPS2::TensorOperator::update_moving_right ( const int  ikappa,
TensorOperator previous,
TensorT mps_tensor_up,
TensorT mps_tensor_down,
double *  workmem 
)
protected

Update moving right.

Parameters
ikappaThe tensor block which should be updated
previousThe previous TensorOperator needed for the update
mps_tensor_upThe upper MPS tensor needed for the update
mps_tensor_downThe lower MPS tensor needed for the update
workmemWork memory

Definition at line 179 of file TensorOperator.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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