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

Property container for eigen values. More...

#include <EigenValues.h>

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

Public Member Functions

 EigenValues (int size)
 
 EigenValues (int size, const double *data)
 
 EigenValues (const std::string &serialization, Mode mode)
 
EigenValuesoperator+= (const EigenValues &rhs)
 
EigenValues operator+ (const EigenValues &rhs) const
 
EigenValuesoperator-= (const EigenValues &rhs)
 
EigenValues operator- (const EigenValues &rhs) const
 
EigenValuesoperator*= (const double &rhs)
 
EigenValues operator* (const double &rhs) const
 
EigenValuesoperator/= (const double &rhs)
 
EigenValues operator/ (const double &rhs) const
 
virtual std::string toString () const
 
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)
 
virtual std::string toString () const
 
- 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)
 

Friends

EigenValues operator* (const double &lhs, const EigenValues &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 eigen values.

The EigenValues is a Property with DataType double.

Conventions

EigenValues extracted by native PropertyExtractors satisfies the following convention.

  • The eigenvalues are ordered in accending order.

Example

#include "TBTK/PropertyExtractor/Diagonalizer.h"
#include "TBTK/Streams.h"
#include "TBTK/TBTK.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.getEigenValues();
Streams::out << "eigenValues(0) = " << eigenValues(0) << "\n";
Streams::out << "eigenValues(10) = " << eigenValues(10) << "\n";
Streams::out << "eigenValues(99) = " << eigenValues(99) << "\n";
Plotter plotter;
plotter.plot(eigenValues);
plotter.save("figures/EigenValues.png");
}

Output

eigenValues(0) = -3.83797
eigenValues(10) = -2.61944
eigenValues(99) = 3.83797

Constructor & Destructor Documentation

◆ EigenValues() [1/3]

TBTK::Property::EigenValues::EigenValues ( int  size)

Constructs EigenValues.

Parameters
sizeThe number of eigenvalues.

◆ EigenValues() [2/3]

TBTK::Property::EigenValues::EigenValues ( int  size,
const double *  data 
)

Constructs EigenValues and initializes it with data.

Parameters
sizeThe number of eigenvalues.
dataRaw data to initialize the EigenValues with.

◆ EigenValues() [3/3]

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

Constructor. Constructs the EigenValues from a serialization string.

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

Member Function Documentation

◆ operator*()

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

Multiplication operator.

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

◆ operator*=()

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

◆ operator+()

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

Addition operator.

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

◆ operator+=()

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

◆ operator-()

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

Subtraction operator.

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

◆ operator-=()

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

◆ operator/()

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

Division operator.

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

◆ operator/=()

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

◆ serialize()

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

◆ toString()

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

Overriding Streamable::toString().

Implements TBTK::Streamable.

Friends And Related Function Documentation

◆ operator*

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

Multiplication operator.

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

The documentation for this class was generated from the following file:
Plotter.h
Plots data.
TBTK::Model
Container of Model related information.
Definition: Model.h:57
EigenValues.h
Property container for eigen values.
TBTK::Solver::Diagonalizer
Solves a Model using diagonalization.
Definition: Diagonalizer.h:52
Streams.h
Streams for TBTK output.
TBTK::PropertyExtractor::Diagonalizer
Extracts physical properties from the Solver::Diagonalizer.
Definition: Diagonalizer.h:55
TBTK::Solver::Diagonalizer::run
void run()
Diagonalizer.h
Solves a Model using diagonalization.
TBTK::Initialize
void Initialize()
TBTK::Solver::Solver::setModel
virtual void setModel(Model &model)
Definition: Solver.h:69
SquareLattice.h
Square lattice model.
TBTK::Streams::out
static std::ostream out
Definition: Streams.h:70
TBTK.h
TBTK initialization.
TBTK::Property::EigenValues
Property container for eigen values.
Definition: EigenValues.h:46
TBTK::Model::construct
void construct()
TBTK::Models::SquareLattice
Square lattice model.
Definition: SquareLattice.h:60