C++QEDCore  2.100.2 (v2 Milestone 10 Development branch)
a framework for simulating open quantum dynamics – core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TridiagonalHamiltonian.h
Go to the documentation of this file.
1 // Copyright András Vukics 2006–2014. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
2 // -*- C++ -*-
4 #ifndef CPPQEDCORE_QUANTUMOPERATOR_TRIDIAGONALHAMILTONIAN_H_INCLUDED
5 #define CPPQEDCORE_QUANTUMOPERATOR_TRIDIAGONALHAMILTONIAN_H_INCLUDED
6 
7 #include "TridiagonalHamiltonianFwd.h"
8 
9 #include "Hamiltonian.h"
10 
11 #include "Tridiagonal.h"
12 
13 #include <list>
14 
15 
16 namespace quantumoperator {
17 
18 
19 namespace details {
20 
21 using namespace structure;
22 
24 template<int RANK, bool IS_TIME_DEPENDENT>
25 class TDH_Base
27  mpl::if_c<IS_TIME_DEPENDENT,
28  mpl::integral_c<TimeDependence,ONE_TIME>,
29  mpl::integral_c<TimeDependence, NO_TIME>
30  >::type::value
31  >
32 {
33 protected:
35  typedef std::list<Tridiagonal> Tridiagonals;
36 
37  typedef typename Hamiltonian<RANK>::StateVectorLow StateVectorLow;
38 
39  TDH_Base(const Tridiagonals& hOverIs) : hOverIs_(hOverIs) {}
40 
41  const Tridiagonals& getH_OverIs() const {return hOverIs_;}
42  Tridiagonals& getH_OverIs() {return const_cast<Tridiagonals&>(static_cast<const TDH_Base*>(this)->getH_OverIs());}
43 
44 private:
46 
47  void addContribution_v(OneTime, const StateVectorLow&, StateVectorLow&) const;
49  void addContribution_v( NoTime, const StateVectorLow&, StateVectorLow&) const;
51 
52 
53  mutable Tridiagonals hOverIs_;
54 
55 };
56 
57 
58 } // details
59 
60 
61 
63 
76 template<int RANK, bool IS_TIME_DEPENDENT>
77 class TridiagonalHamiltonian : public details::TDH_Base<RANK,IS_TIME_DEPENDENT>
78 {
79 private:
80  typedef details::TDH_Base<RANK,IS_TIME_DEPENDENT> Base;
81 
82 public:
83  typedef typename Base::Tridiagonal Tridiagonal ;
84  typedef typename Base::Tridiagonals Tridiagonals;
85 
86  TridiagonalHamiltonian(const Tridiagonals& hOverIs) : Base(hOverIs) {}
87  TridiagonalHamiltonian(const Tridiagonal & hOverI ) : Base(Tridiagonals(1,hOverI)) {}
88 
89 };
90 
91 #undef BASE_class
92 
93 } // quantumoperator
94 
95 
96 #endif // CPPQEDCORE_QUANTUMOPERATOR_TRIDIAGONALHAMILTONIAN_H_INCLUDED
Implements the action of a Hamiltonian whose matrix consists of a sum of tridiagonal matrices...
quantumdata::Types< 1 >::StateVectorLow StateVectorLow
unary StateVectorLow
Definition: Free.h:34
TridiagonalHamiltonian(const Tridiagonal &hOverI)
quantumoperator::Tridiagonal< 1 > Tridiagonal
unary Tridiagonal
Definition: Free.h:32
Defines class of the same name.
Comprises modules for describing quantum systems.
Definition: Averaged.h:17
Describes one-time dependence corresponding to the case ONE_TIME.
Defines class of the same name.
Comprises modules representing operators of special structure (tridiagonal, sparse) over Hilbert spac...
Definition: Sigma.h:12
TridiagonalHamiltonian(const Tridiagonals &hOverIs)
Generic constructor.
Class representing a (unary) tridiagonal matrix or direct product of such matrices.
Definition: Tridiagonal.h:103
Implements the general Hamiltonian interface by dispatching the different time-dependence levels...
Definition: Hamiltonian.h:68
Describes no-time dependence corresponding to the case NO_TIME.