24 #ifndef COM_DAFER45_TBTK_BASIC_STATE
25 #define COM_DAFER45_TBTK_BASIC_STATE
27 #include "TBTK/AbstractState.h"
28 #include "TBTK/DefaultOperator.h"
37 class BasicState :
public AbstractState{
40 BasicState(
const Index &index,
const Index &unitCellIndex = {});
43 virtual ~BasicState();
46 virtual BasicState* clone()
const;
50 std::complex<double> overlap,
51 const Index &braIndex,
52 const Index &braRelativeUnitCell = {}
56 void addMatrixElement(
57 std::complex<double> matrixElement,
59 const Index &braRelativeUnitCell = {}
63 virtual std::complex<double> getOverlap(
const AbstractState &bra)
const;
66 virtual std::complex<double> getMatrixElement(
67 const AbstractState &bra,
68 const AbstractOperator &o = DefaultOperator()
81 std::vector<std::tuple<std::complex<double>, Index, Index>> overlaps;
84 bool overlapsIsSorted;
95 std::vector<std::tuple<std::complex<double>, Index, Index>> matrixElements;
98 bool matrixElementsIsSorted;
123 void sortMatrixElements();
126 unsigned int referenceCounter;
132 inline void BasicState::Storage::grab(){
136 inline bool BasicState::Storage::release(){
138 if(referenceCounter == 0)