24 #ifndef COM_DAFER45_TBTK_SOLVER_EXACT_DIAGONALIZATION
25 #define COM_DAFER45_TBTK_SOLVER_EXACT_DIAGONALIZATION
28 #include "TBTK/FockStateRuleSet.h"
29 #include "TBTK/FockStateRule/WrapperRule.h"
30 #include "TBTK/InteractionAmplitudeSet.h"
32 #include "TBTK/ManyParticleContext.h"
35 #include <initializer_list>
40 class ExactDiagonalizer :
public Solver{
48 virtual ~ExactDiagonalizer();
51 unsigned int addSubspace(std::initializer_list<const FockStateRule::WrapperRule> rules);
54 unsigned int addSubspace(std::vector<FockStateRule::WrapperRule> rules);
57 unsigned int addSubspace(
const FockStateRuleSet &rules);
60 void run(
unsigned int subspace);
63 const CArray<double>& getEigenValues(
unsigned int subspace);
66 const double getEigenValue(
unsigned int subspace,
int state);
73 const std::complex<double> getAmplitude(
74 unsigned int subspace,
87 class SubspaceContext{
91 std::initializer_list<const FockStateRule::WrapperRule> rules
96 std::vector<FockStateRule::WrapperRule> rules
101 const FockStateRuleSet &rules
109 FockStateRuleSet fockStateRuleSet;
113 std::shared_ptr<Model> manyParticleModel;
117 std::shared_ptr<Diagonalizer> dSolver;
122 std::vector<SubspaceContext> subspaceContexts;
125 void setupManyParticleModel(
unsigned int subspace);
128 template<
typename BIT_REGISTER>
129 void setupManyParticleModel(
unsigned int subspace);
132 inline const CArray<double>& ExactDiagonalizer::getEigenValues(
133 unsigned int subspace
135 return subspaceContexts.at(subspace).dSolver->getEigenValues();
138 inline const double ExactDiagonalizer::getEigenValue(
139 unsigned int subspace,
142 return subspaceContexts.at(subspace).dSolver->getEigenValue(state);
145 inline const std::complex<double> ExactDiagonalizer::getAmplitude(
146 unsigned int subspace,
150 return subspaceContexts.at(subspace).dSolver->getAmplitude(