TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::Property::Density Class Reference

Property container for density. More...

#include <Density.h>

Inheritance diagram for TBTK::Property::Density:
TBTK::Property::AbstractProperty< double > TBTK::Property::Property TBTK::Serializable TBTK::Streamable

Public Member Functions

 Density ()
 
 Density (const std::vector< int > &ranges)
 
 Density (const std::vector< int > &ranges, const double *data)
 
 Density (const IndexTree &indexTree)
 
 Density (const IndexTree &indexTree, const double *data)
 
 Density (const std::string &serialization, Mode mode)
 
Densityoperator+= (const Density &rhs)
 
Density operator+ (const Density &rhs) const
 
Densityoperator-= (const Density &rhs)
 
Density operator- (const Density &rhs) const
 
Densityoperator*= (const double &rhs)
 
Density operator* (const double &rhs) const
 
Densityoperator/= (const double &rhs)
 
Density operator/ (const double &rhs) const
 
double getMin () const
 
double getMax () const
 
virtual std::string toString () const
 
virtual std::string serialize (Mode mode) const
 
- Public Member Functions inherited from TBTK::Property::AbstractProperty< double >
unsigned int getBlockSize () const
 
unsigned int getSize () const
 
const std::vector< double > & getData () const
 
std::vector< double > & getDataRW ()
 
unsigned int getDimensions () const
 
std::vector< int > getRanges () const
 
int getOffset (const Index &index) const
 
const IndexDescriptorgetIndexDescriptor () const
 
bool contains (const Index &index) const
 
void reduce (const std::vector< Index > &targetPatterns, const std::vector< Index > &newPatterns)
 
void hermitianConjugate ()
 
std::vector< SparseMatrix< double > > toSparseMatrices (const Model &model) const
 
virtual const double & operator() (const Index &index, unsigned int offset=0) const
 
virtual double & operator() (const Index &index, unsigned int offset=0)
 
double & operator() (const std::initializer_list< Subindex > &index)
 
const double & operator() (const std::initializer_list< Subindex > &index) const
 
virtual const double & operator() (unsigned int offset) const
 
virtual double & operator() (unsigned int offset)
 
void setAllowIndexOutOfBoundsAccess (bool allowIndexOutOfBoundsAccess)
 
void setDefaultValue (const double &defaultValue)
 
void replaceValues (const double &targetValue, const double &replacementValue)
 
- Public Member Functions inherited from TBTK::Serializable
template<>
std::string serialize (const bool &data, Mode mode)
 
template<>
std::string serialize (const double &data, Mode mode)
 
template<>
std::string serialize (const std::complex< double > &data, Mode mode)
 
template<>
std::string serialize (const int &data, Mode mode)
 
template<>
std::string serialize (const unsigned int &data, Mode mode)
 
template<>
std::string serialize (const SpinMatrix &data, Mode mode)
 
template<>
std::string serialize (const Statistics &data, Mode mode)
 
template<>
std::string serialize (const std::vector< std::complex< double >> &data, Mode mode)
 
template<>
int deserialize (const std::string &serialization, Mode mode)
 
template<>
unsigned int deserialize (const std::string &serialization, Mode mode)
 
template<>
double deserialize (const std::string &serialization, Mode mode)
 
template<>
std::complex< double > deserialize (const std::string &serialization, Mode mode)
 
template<>
SpinMatrix deserialize (const std::string &serialization, Mode mode)
 
template<>
Statistics deserialize (const std::string &serialization, Mode mode)
 
template<>
std::vector< std::complex< double > > deserialize (const std::string &serialization, Mode mode)
 

Friends

Density operator* (const double &lhs, const Density &rhs)
 

Additional Inherited Members

- Public Types inherited from TBTK::Serializable
enum  Mode { Debug, Binary, XML, JSON }
 
- Static Public Member Functions inherited from TBTK::Serializable
static bool hasID (const std::string &serialization, Mode mode)
 
static std::string getID (const std::string &serialization, Mode mode)
 
static std::string extractComponent (const std::string &serialization, const std::string &containerID, const std::string &componentID, const std::string &componentName, Mode mode)
 
- Protected Member Functions inherited from TBTK::Property::AbstractProperty< double >
 AbstractProperty ()
 
 AbstractProperty (unsigned int blockSize)
 
 AbstractProperty (unsigned int blockSize, const double *data)
 
 AbstractProperty (const std::vector< int > &ranges, unsigned int blockSize)
 
 AbstractProperty (const std::vector< int > &ranges, unsigned int blockSize, const double *data)
 
 AbstractProperty (const IndexTree &indexTree, unsigned int blockSize)
 
 AbstractProperty (const IndexTree &indexTree, unsigned int blockSize, const double *data)
 
 AbstractProperty (const AbstractProperty &abstractProperty)
 
 AbstractProperty (AbstractProperty &&abstractProperty)
 
 AbstractProperty (const std::string &serialization, Mode mode)
 
virtual ~AbstractProperty ()
 
AbstractPropertyoperator= (const AbstractProperty &abstractProperty)
 
AbstractPropertyoperator= (AbstractProperty &&abstractProperty)
 
AbstractPropertyoperator+= (const AbstractProperty &rhs)
 
AbstractPropertyoperator-= (const AbstractProperty &rhs)
 
AbstractPropertyoperator*= (const double &rhs)
 
AbstractPropertyoperator/= (const double &rhs)
 
- Protected Member Functions inherited from TBTK::Property::Property
 Property ()
 
virtual ~Property ()
 
- Static Protected Member Functions inherited from TBTK::Serializable
static bool validate (const std::string &serialization, const std::string &id, Mode mode)
 
static std::string getContent (const std::string &serialization, Mode mode)
 
static std::vector< std::string > split (const std::string &content, Mode mode)
 
template<typename DataType >
static std::enable_if<!std::is_pointer< DataType >::value, std::string >::type serialize (const DataType &data, Mode mode)
 
template<typename DataType >
static std::enable_if< std::is_pointer< DataType >::value, std::string >::type serialize (const DataType &data, Mode mode)
 
template<typename DataType >
static DataType deserialize (const std::string &serialization, Mode mode)
 
static std::string extract (const std::string &serialization, Mode mode, std::string component)
 

Detailed Description

Property container for density.

The Density is a Property with DataType double and is defined for a number of Indices.

Example

#include "TBTK/PropertyExtractor/Diagonalizer.h"
#include "TBTK/Solver/Diagonalizer.h"
#include "TBTK/Streams.h"
#include "TBTK/TBTK.h"
#include "TBTK/Visualization/MatPlotLib/Plotter.h"
using namespace TBTK;
using namespace Visualization::MatPlotLib;
int main(){
const unsigned int SIZE_X = 10;
const unsigned int SIZE_Y = 10;
double t = 1;
Model model = Models::SquareLattice({SIZE_X, SIZE_Y}, {0, t});
model.construct();
solver.setModel(model);
solver.run();
PropertyExtractor::Diagonalizer propertyExtractor(solver);
= propertyExtractor.calculateDensity({{_a_, _a_}});
Streams::out << "density({5, 5}) = " << density({5, 5}) << "\n";
Plotter plotter;
plotter.plot({_a_, _a_}, density);
plotter.save("figures/Density.png");
plotter.clear();
plotter.plot({_a_, 5}, density);
plotter.save("figures/DensityCut.png");
}

Output

density({5, 5}) = 0.191111
PropertyDensityDensity.png
PropertyDensityDensityCut.png

Constructor & Destructor Documentation

◆ Density() [1/6]

TBTK::Property::Density::Density ( )
inline

Constructs an uninitialized Density.

◆ Density() [2/6]

TBTK::Property::Density::Density ( const std::vector< int > &  ranges)

Constructs a Density on the Ranges format. [See AbstractProperty for detailed information about the Ranges format.]

Parameters
rangesThe upper limits (exclusive) for the corresponding dimensions.

◆ Density() [3/6]

TBTK::Property::Density::Density ( const std::vector< int > &  ranges,
const double *  data 
)

Constructs a Density on the Ranges format and initializes it with data. [See AbstractProperty for detailed information about the Ranges format and the raw data format.]

Parameters
rangesThe upper limits (exclusive) for the corresponding dimensions.
dataRaw data to initialize the Density with.

◆ Density() [4/6]

TBTK::Property::Density::Density ( const IndexTree indexTree)

Constructs a Density on the Custom format. [See AbstractProperty for detailed information about the Custom format.]

Parameters
indexTreeIndexTree containing the Indices for which the Density should be contained.

◆ Density() [5/6]

TBTK::Property::Density::Density ( const IndexTree indexTree,
const double *  data 
)

Constructs a Density on the Custom format. [See AbstractProperty for detailed information about the Custom format and the raw data format.]

Parameters
indexTreeIndexTree containing the Indices for which the Density should be contained.
dataRaw data to initialize the Density with.

◆ Density() [6/6]

TBTK::Property::Density::Density ( const std::string &  serialization,
Mode  mode 
)

Constructor. Constructs the Density from a serializeation string.

Parameters
serializationSerialization string from which to construct the Density.
modeMode with which the string has been serialized.

Member Function Documentation

◆ getMax()

double TBTK::Property::Density::getMax ( ) const

Get maximum value for the Density.

Returns
The maximum value.

◆ getMin()

double TBTK::Property::Density::getMin ( ) const

Get the minimum value for the Density.

Returns
The minimum value.

◆ operator*()

Density TBTK::Property::Density::operator* ( const double &  rhs) const
inline

Multiplication operator.

Parameters
rhsThe right hand side of the equation.
Returns
A new Density that is the product of the Density and the right hand side.

◆ operator*=()

Density & TBTK::Property::Density::operator*= ( const double &  rhs)
inline

Overrides AbstractPropertye::operator*=().

◆ operator+()

Density TBTK::Property::Density::operator+ ( const Density rhs) const
inline

Addition operator.

Parameters
rhsThe right hand side of the equation.
Returns
A new Density that is the sum of this Density and the right hand side.

◆ operator+=()

Density & TBTK::Property::Density::operator+= ( const Density rhs)
inline

Overrides AbstractPropertye::operator+=().

◆ operator-()

Density TBTK::Property::Density::operator- ( const Density rhs) const
inline

Subtraction operator.

Parameters
rhsThe right hand side of the equation.
Returns
A new Density that is the difference between this Density and the right hand side.

◆ operator-=()

Density & TBTK::Property::Density::operator-= ( const Density rhs)
inline

Overrides AbstractPropertye::operator-=().

◆ operator/()

Density TBTK::Property::Density::operator/ ( const double &  rhs) const
inline

Division operator.

Parameters
rhsThe right hand side of the equation.
Returns
A new Density that is the quotient of the Density and the right hand side.

◆ operator/=()

Density & TBTK::Property::Density::operator/= ( const double &  rhs)
inline

Overrides AbstractPropertye::operator/=().

◆ serialize()

virtual std::string TBTK::Property::Density::serialize ( Mode  mode) const
virtual

◆ toString()

virtual std::string TBTK::Property::Density::toString ( ) const
virtual

Friends And Related Function Documentation

◆ operator*

Density operator* ( const double &  lhs,
const Density rhs 
)
friend

Multiplication operator.

Parameters
lhsThe left hand side of the equation.
rhsThe right hand side of the equation.
Returns
A new Density that is the product of the left hand side and the Density.

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