24 #ifndef COM_DAFER45_TBTK_ABSTRACT_STATE
25 #define COM_DAFER45_TBTK_ABSTRACT_STATE
27 #include "TBTK/AbstractOperator.h"
28 #include "TBTK/DefaultOperator.h"
33 #include <initializer_list>
39 class AbstractState :
public Serializable{
54 AbstractState(StateID stateID);
57 virtual ~AbstractState();
60 virtual AbstractState* clone()
const = 0;
66 virtual std::complex<double> getOverlap(
const AbstractState &ket)
const = 0;
72 virtual std::complex<double> getMatrixElement(
73 const AbstractState &ket,
74 const AbstractOperator &o = DefaultOperator()
78 StateID getStateID()
const;
81 void setCoordinates(std::initializer_list<double> coordinates);
84 void setCoordinates(
const std::vector<double> &coordinates);
87 void setSpecifiers(std::initializer_list<int> specifiers);
90 void setSpecifiers(
const std::vector<int> &specifiers);
93 void setIndex(
const Index &index);
96 void setContainer(
const Index &container);
99 void setExtent(
double extent);
102 const std::vector<double>& getCoordinates()
const;
105 const std::vector<int>& getSpecifiers()
const;
108 const Index& getIndex()
const;
111 const Index& getContainer()
const;
114 double getExtent()
const;
117 bool hasFiniteExtent()
const;
120 std::string serialize(Mode mode)
const;
126 std::vector<double> coordinates;
129 std::vector<int> specifiers;
142 inline AbstractState::StateID AbstractState::getStateID()
const{
146 inline void AbstractState::setIndex(
const Index& index){
150 inline void AbstractState::setContainer(
const Index& container){
151 this->container = container;
154 inline void AbstractState::setExtent(
double extent){
155 this->extent = extent;
158 inline const std::vector<double>& AbstractState::getCoordinates()
const{
162 inline const std::vector<int>& AbstractState::getSpecifiers()
const{
166 inline const Index& AbstractState::getIndex()
const{
170 inline const Index& AbstractState::getContainer()
const{
174 inline double AbstractState::getExtent()
const{
178 inline bool AbstractState::hasFiniteExtent()
const{
179 if(std::numeric_limits<double>::has_infinity)
180 return !(extent == std::numeric_limits<double>::infinity());
182 return !(extent == std::numeric_limits<double>::max());