TBTK

Need a break? Support the development by playing Polarity Puzzles 
Base class for PropertyExtractors. More...
#include <PropertyExtractor.h>
Classes  
class  Information 
Public Member Functions  
PropertyExtractor ()  
virtual  ~PropertyExtractor () 
virtual void  setEnergyWindow (double lowerBound, double upperBound, int energyResolution) 
virtual void  setEnergyWindow (int lowerFermionicMatsubaraEnergyIndex, int upperFermionicMatsubaraEnergyIndex, int lowerBosonicMatsubaraEnergyIndex, int upperBosonicMatsubaraEnergyIndex) 
virtual void  setEnergyInfinitesimal (double energyInfinitesimal) 
virtual Property::Density  calculateDensity (Index pattern, Index ranges) 
virtual Property::Density  calculateDensity (std::vector< Index > patterns) 
virtual Property::Magnetization  calculateMagnetization (Index pattern, Index ranges) 
virtual Property::Magnetization  calculateMagnetization (std::vector< Index > patterns) 
virtual Property::LDOS  calculateLDOS (Index pattern, Index ranges) 
virtual Property::LDOS  calculateLDOS (std::vector< Index > patterns) 
virtual Property::SpinPolarizedLDOS  calculateSpinPolarizedLDOS (Index pattern, Index ranges) 
virtual Property::SpinPolarizedLDOS  calculateSpinPolarizedLDOS (std::vector< Index > patterns) 
virtual std::complex< double >  calculateExpectationValue (Index to, Index from) 
virtual Property::DOS  calculateDOS () 
virtual Property::DOS  sampleDOS (unsigned int numSamples, const std::vector< Index > &patterns={}, unsigned int seed=time(nullptr)) 
virtual double  calculateEntropy () 
Protected Types  
enum  EnergyType { Real, Matsubara } 
Protected Member Functions  
EnergyType  getEnergyType () const 
int  getEnergyResolution () const 
double  getLowerBound () const 
double  getUpperBound () const 
int  getLowerFermionicMatsubaraEnergyIndex () const 
int  getUpperFermionicMatsubaraEnergyIndex () const 
int  getLowerBosonicMatsubaraEnergyIndex () const 
int  getUpperBosonicMatsubaraEnergyIndex () const 
double  getEnergyInfinitesimal () const 
template<typename DataType >  
void  calculate (void(*callback)(PropertyExtractor *cb_this, Property::Property &property, const Index &index, int offset, Information &information), Property::AbstractProperty< DataType > &property, Index pattern, const Index &ranges, int currentOffset, int offsetMultiplier, Information &information) 
template<typename DataType >  
void  calculate (void(*callback)(PropertyExtractor *cb_this, Property::Property &property, const Index &index, int offset, Information &information), const IndexTree &allIndices, const IndexTree &memoryLayout, Property::AbstractProperty< DataType > &abstractProperty, Information &information) 
void  ensureCompliantRanges (const Index &pattern, Index &ranges) 
std::vector< int >  getLoopRanges (const Index &pattern, const Index &ranges) 
IndexTree  generateIndexTree (std::vector< Index > patterns, const HoppingAmplitudeSet &hoppingAmplitudeSet, bool keepSummationWildcards, bool keepSpinWildcards) 
Base class for PropertyExtractors.
A PropertyExtractor can be used to extract Properties from a Solver. The PropertyExtractor::PropertyExtractor is a base class for such PropertyExtractors, which each corresponds to a particular Solver. See the documentation for Diagonalizer, BlockDiagonalizer, ArnoldiIterator, and ChebyshevExpander for examples of specific production ready PropertyExtractors.
The PropertyExtractors provide a uniform interface to Solvers and allow for Properties to be extracted with limited knowledge about Solver specific details. The use of PropertyExtractors also makes it possible to switch between different Solvers with minimal changes to the code.

strongprotected 
Energy type.
TBTK::PropertyExtractor::PropertyExtractor::PropertyExtractor  (  ) 
Constructs a PropertyExtractor::PropertyExtractor.

virtual 
Destructor.

protected 
Loops over the indices satisfying the specified patterns and calls the appropriate callback function to calculate the correct quantity.
callback  A callback function that is called to perform the actual calculation for a given Index. 
allIndices  An IndexTree containing all the Indices for which the callback should be called. 
memoryLayout  The memory layout used for the Property. 
abstractProperty  The Property that is being calculated. 
information  Allows for custom information to be passed between the calculatefunctions and the correpsonding callbacks. 

protected 
Loops over range indices and calls the given callback function to calculate the correct quantity. The function recursively calls itself replacing any IDX_SUM_ALL, IDX_X, IDX_Y, and IDX_Z specifiers by actual subindices in the range [0, ranges[s]), where s is the subindex at which the specifier appears. For example, the pattern ranges pair {IDX_SUM_ALL, 2, IDX_X} and {2, 1, 3} will result in the callback being called for {0, 2, 0}, {0, 2, 1}, {0, 2, 2}, {1, 2, 0}, {1, 2, 1}, and {1, 2, 2}. The first and fourth, second and fifth, and third and sixth Index will further be passed to the callback with the same memory offset since their result should be summed.
The memory offset is further calculated by traversing the subindices of the apttern from right to left and multiplying the current offset multiplier by the number of indices in the range size for the given subindex. This results in an offset that places the elements in consequtive order in increasing order of the Index order. Where an Index is considered to come before another Index if the first subindex to differ between two Indices from the left is smaller than the other Index.
callback  A callback function that is called to perform the actual calculation for a given Index. 
property  Reference to Property where the result is to be stored. 
pattern  An Index specifying the pattern for which to perform the calculation. 
ranges  The upper limit (exclusive) for which subindices with wildcard specifiers will be replaced. The lower limit is 0. 
currentOffset  The memory offset calculated for the given pattern Index. Should be zero for the initial call to the function. 
offsetMultiplier  Number indicating the block size associated with increasing the current subindex by one. Should be equal to the number of data elements per Index for the initial call to the function. 
information  Allows for custom information to be passed between the calculatefunctions and the correpsonding callbacks. 

virtual 
Calculate the density. This function should be overriden by those deriving classes that provide support for calculating the density. By default the PropertyExtractor prints an error message that the given property is not supported.
pattern  Specifies the index pattern for which to calculate the density. For example, assume that the index scheme is {x, y, z, spin}. {ID_X, 5, 10, IDX_SUM_ALL} will calculate the density for each x along (y,z)=(5,10) by summing over spin. Similarly {ID_X, 5, IDX_Y, IDX_SUM_ALL} will return a two dimensional density for all x and z and y = 5. Note that IDX_X IDX_Y, and IDX_Z refers to the first, second, and third index used by the routine to create a one, two, or threedimensional output, rather than being tied to the x, y, and z used as physical subindices. 
ranges  Speifies the number of elements for each subindex. Is ignored for indices specified with positive integers in the pattern, but is used to loop from 0 to the value in ranges for IDX_X, IDX_Y, IDX_Z, and IDX_SUM_ALL. Appropriate ranges corresponding to the two pattern examples above are {SIZE_X, 1, 1, NUM_SPINS} and {SIZE_X, 1, SIZE_Z, NUM_SPINS}, respectively. 
Reimplemented in TBTK::PropertyExtractor::Diagonalizer, and TBTK::PropertyExtractor::ChebyshevExpander.

virtual 
Calculate the density. This function should be overriden by those deriving classes that provide support for calculating the density. By default the PropertyExtractor prints an error message that the given property is not supported.
patterns  A list of patterns that will be matched against the Indices in the Model to determine which Indices for which to calculate the Density. 
Reimplemented in TBTK::PropertyExtractor::BlockDiagonalizer, TBTK::PropertyExtractor::Diagonalizer, and TBTK::PropertyExtractor::ChebyshevExpander.

virtual 
Calculate the density of states. This function should be overriden by those deriving classes that provide support for calculating the density of states. By default the PropertyExtractor prints an error message that the given property is not supported.
Reimplemented in TBTK::PropertyExtractor::BlockDiagonalizer, TBTK::PropertyExtractor::Diagonalizer, and TBTK::PropertyExtractor::ArnoldiIterator.

virtual 
Calculate the entropy. This function should be overriden by those deriving classes that provide support for calculating the entropy. By default the PropertyExtractor prints an error message that the given property is not supported.
Reimplemented in TBTK::PropertyExtractor::BlockDiagonalizer, and TBTK::PropertyExtractor::Diagonalizer.

virtual 
Calculate the expectation value \(\langle c_{to}^{\dagger}c_{from}\). This function should be overriden by those deriving classes that provide support for calculating the expecation value. By default the PropertyExtractor prints an error message that the given property is not supported.
to  The Index on the left operator. 
from  The index on the right operator. 
Reimplemented in TBTK::PropertyExtractor::BlockDiagonalizer, TBTK::PropertyExtractor::Diagonalizer, and TBTK::PropertyExtractor::ChebyshevExpander.

virtual 
Calculate the local density of states. This function should be overriden by those deriving classes that provide support for calculating the local density of states. By default the PropertyExtractor prints an error message that the given property is not supported.
pattern  Specifies the index pattern for which to calculate the LDOS. For example, assume that the index scheme is {x, y, z, spin}. {ID_X, 5, 10, IDX_SUM_ALL} will calculate the LDOS for each x along (y,z)=(5,10) by summing over spin. Similarly {ID_X, 5, IDX_Y, IDX_SUM_ALL} will return a two dimensional LDOS for all x and z and y = 5. Note that IDX_X, IDX_Y, and IDX_Z refers to the first, second, and third index used by the routine to create a one, two, or threedimensional output, rather than being tied to the x, y, and z used as physical subindices. 
ranges  Speifies the number of elements for each subindex. Is ignored for indices specified with positive integers in the pattern, but is used to loop from 0 to the value in ranges for IDX_X, IDX_Y, IDX_Z, and IDX_SUM_ALL. Appropriate ranges corresponding to the two pattern examples above are {SIZE_X, 1, 1, NUM_SPINS} and {SIZE_X, 1, SIZE_Z, NUM_SPINS}, respectively. 
Reimplemented in TBTK::PropertyExtractor::Diagonalizer, TBTK::PropertyExtractor::ChebyshevExpander, and TBTK::PropertyExtractor::ArnoldiIterator.

virtual 
Calculate the local density of states. This function should be overriden by those deriving classes that provide support for calculating the local density of states. By default the PropertyExtractor prints an error message that the given property is not supported.
patterns  A list of patterns that will be matched against the Indices in the Model to determine which Indices for which to calculate the local density of states. 
Reimplemented in TBTK::PropertyExtractor::BlockDiagonalizer, TBTK::PropertyExtractor::Diagonalizer, TBTK::PropertyExtractor::ChebyshevExpander, and TBTK::PropertyExtractor::ArnoldiIterator.

virtual 
Calculate the magnetization. This function should be overriden by those deriving classes that provide support for calculating the magnetization. By default the PropertyExtractor prints an error message that the given property is not supported.
pattern  Specifies the index pattern for which to calculate the magnetization. For example, assume that the index scheme is {x, y, z, spin}. {ID_X, 5, 10, IDX_SPIN} will calculate the magnetization for each x along (y,z)=(5,10). Similarly {ID_X, 5, IDX_Y, IDX_SPIN} will return a two dimensional magnetiation for all x and z and y = 5. Note that IDX_X, IDX_Y, and IDX_Z refers to the first, second, and third index used by the routine to create a one, two, or threedimensional output, rather than being tied to the x, y, and z used as physical subindices. 
ranges  Speifies the number of elements for each subindex. Is ignored for indices specified with positive integers in the pattern, but is used to loop from 0 to the value in ranges for IDX_X, IDX_Y, IDX_Z, and IDX_SUM_ALL. Appropriate ranges corresponding to the two pattern examples above are {SIZE_X, 1, 1, NUM_SPINS} and {SIZE_X, 1, SIZE_Z, NUM_SPINS}, respectively. 
\[ \left[\begin{array}{cc} 0 & 1\\ 2 & 3 \end{array}\right] = \left[\begin{array}{cc} \langle c_{i\uparrow}^{\dagger}c_{i\uparrow}\rangle & \langle c_{i\uparrow}^{\dagger}c_{i\downarrow}\rangle\\ \langle c_{i\downarrow}^{\dagger}c_{u\uparrow}\rangle & \langle c_{i\downarrow}^{\dagger}c_{i\downarrow}\rangle \end{array}\right]. \]
Reimplemented in TBTK::PropertyExtractor::Diagonalizer, and TBTK::PropertyExtractor::ChebyshevExpander.

virtual 
Calculate the Magnetization. This function should be overriden by those deriving classes that provide support for calculating the magnetization. By default the PropertyExtractor prints an error message that the given property is not supported.
patterns  A list of patterns that will be matched against the Indices in the Model to determine which Indices for which to calculate the Magnetization. 
Reimplemented in TBTK::PropertyExtractor::BlockDiagonalizer, TBTK::PropertyExtractor::Diagonalizer, and TBTK::PropertyExtractor::ChebyshevExpander.

virtual 
Calculate the spinpolarized local density of states. This function should be overriden by those deriving classes that provide support for calculating the spinpolarized local density of states. By default the PropertyExtractor prints an error message that the given property is not supported.
pattern  Specifies the index pattern for which to calculate the spinpolarized LDOS. For example, assume that the index scheme is {x, y, z, spin}. {ID_X, 5, 10, IDX_SPIN} will calculate the spinpolarized LDOS for each x along (y,z)=(5,10). Similarly {ID_X, 5, IDX_Y, IDX_SPIN} will return a two dimensional spinpolarized LDOS for all x and z and y = 5. Note that IDX_X, IDX_Y, and IDX_Z refers to the first, second, and third index used by the routine to create a one, two, or threedimensional output, rather than being tied to the x, y, and z used as physical subindices. 
ranges  Speifies the number of elements for each subindex. Is ignored for indices specified with positive integers in the pattern, but is used to loop from 0 to the value in ranges for IDX_X, IDX_Y, IDX_Z, and IDX_SUM_ALL. Appropriate ranges corresponding to the two pattern examples above are {SIZE_X, 1, 1, NUM_SPINS} and {SIZE_X, 1, SIZE_Z, NUM_SPINS}, respectively. 
\[ \left[\begin{array}{cc} 0 & 1\\ 2 & 3 \end{array}\right] = \left[\begin{array}{cc} \rho_{i\uparrow i\uparrow}(E) & \rho_{i\uparrow i\downarrow}(E)\\ \rho_{i\downarrow i\uparrow}(E) & \rho_{i\downarrow i\downarrow}(E)\\ \end{array}\right], \]
where\[ \rho_{i\sigma i\sigma'}(E) = \sum_{E_n}\langle\Psi_nc_{i\sigma}^{\dagger}c_{i\sigma'}\Psi_n\rangle\delta(E  E_n) . \]
Reimplemented in TBTK::PropertyExtractor::Diagonalizer, TBTK::PropertyExtractor::ChebyshevExpander, and TBTK::PropertyExtractor::ArnoldiIterator.

virtual 
Calculate the spinpolarized local density of states. This function should be overriden by those deriving classes that provide support for calculating the spinpolarized local density of states. By default the PropertyExtractor prints an error message that the given property is not supported.
patterns  A list of patterns that will be matched against the Indices in the Model to determine which Indices for which to calculate the spinpolarized local density of states. 
Reimplemented in TBTK::PropertyExtractor::BlockDiagonalizer, TBTK::PropertyExtractor::Diagonalizer, TBTK::PropertyExtractor::ChebyshevExpander, and TBTK::PropertyExtractor::ArnoldiIterator.

protected 
Ensure that range indices are on compliant format. I.e., sets the range to one for indices with nonnegative pattern value.
pattern  The pattern. 
ranges  The ranges that will have its subindices set to one for every pattern subindex that is non negative. 

protected 
Generate an IndexTree containing all the Indices in the HoppingAmplitudeSet that matches the given patterns. Before being added to the IndexTree, the Indices may be modified to replace subindices by their corresponding pattern value. I.e. A summation or spin subindex may still be labeld such in the IndexTree depending on the flags that are passed to the function.
The pattern can also be a compund Index consisting of two Indices, in which case the pattern matching is applied to each component Index separately.
patterns  List of patterns to match against. 
The  HoppingAmplitudeSet cntaining all the Indices that will be matched against the patterns. 
keepSummationWildcards  If true, summation wildcards in the pattern will be preserved in the IndexTree. 
keepSpinWildcards  If true, spin wildcards in the pattern will be preserved in the IndexTree. 

inlineprotected 
Get the energy resolution.

inlineprotected 
Get the energy type.

protected 
Extract ranges for loop indices. The subindices with IDX_X, IDX_Y and IDX_Z are identified and counted and an array of the same size as the number of loop indices is created and filled with the ranges for the corrsponding loop subindices.
pattern  A pattern. 
ranges  The ranges for the given pattern. 
loopDimensions  Pointer to int that will hold the number of loop dimensions after the call has completed. 

inlineprotected 
Get the lower Bosonic Matsubara energy index.

inlineprotected 
Get lower bound for the energy window.

inlineprotected 
Get the lower Fermionic Matsubara energy index.

inlineprotected 
Get the upper Bosonic Matsubara energy index.

inlineprotected 
Get the upper bound for the energy window.

inlineprotected 
Get the upper Fermionic Matsubara energy index.

virtual 
Sample the DOS by averaging over the LDOS for multiple random Indices. The resulting DOS is normalized to integrate to the total number of states in the sample space covered by the patterns Indices.
numSamples  The number of samples to use. 
patterns  A list of patterns to randomize over. If the list is empty (default value), all Indices are randomized over. 
seed  Seed to use for randomization. 

virtual 
Set the size of the energy infinitesimal that can be used to add for example an \(i\delta\) term to the denominator of the Green's function.
energyInfinitesimal  The energy infinitesimal \(\delta\). 

virtual 
Set the energy window used for energy dependent quantities. The energy window is set to be real.
lowerBound  The lower bound for the energy window. 
upperBound  The upper bound for the energy window. 
energyResolution  The number of energy points used to resolve the energy window. 
Reimplemented in TBTK::PropertyExtractor::ChebyshevExpander.

virtual 
Set the energy window used for energy dependent quantities. The energy window is set to consist of Matsubara energies.
lowerFermionicMatsubaraEnergyIndex  The lower Fermionic Matsubara energy index. 
upperFermionicMatsubaraEnergyIndex  The upper Fermionic Matsubara energy index. 
lowerBosonicMatsubaraEnergyIndex  The lower Bosonic Matsubara energy index. 
upperBosonicMatsubaraEnergyIndex  The upper Bosonic Matsubara energy index. 