3 #ifndef CPPQEDCORE_COMPOSITES_COMPOSITE_H_INCLUDED
4 #define CPPQEDCORE_COMPOSITES_COMPOSITE_H_INCLUDED
6 #include "CompositeFwd.h"
15 #include "details_TMP_helpers.h"
17 #include <boost/fusion/container/generation/make_list.hpp>
22 using boost::fusion::make_list;
28 using boost::fusion::result_of::make_list;
34 struct MaxRank : MaxMF<typename MaxMF<VA,SeqLess<mpl::_1,mpl::_2> >::type>::type::type {};
43 static const int RANK=
N_RANK;
45 typedef boost::shared_ptr<const RankedBase<RANK> > Ptr;
47 typedef blitz::TinyVector<SubSystemFree,RANK> Frees;
51 typedef typename QS_Base::Dimensions Dimensions;
57 static const Dimensions fillDimensions(
const Frees&);
61 : QS_Base(fillDimensions(frees)), frees_(frees) {}
63 const Frees& getFrees()
const {
return frees_;}
78 typedef boost::shared_ptr<const Base<VA> > Ptr;
85 static_assert( composite::CheckMeta<RANK,VA>::type::value ==
true ,
"Composite not consistent" );
96 typedef typename Av_Base::Averages
Averages ;
98 typedef typename RBase:: Frees Frees;
101 template<structure::LiouvilleanAveragedTag>
102 static std::ostream& displayKeyLA(std::ostream& ,
size_t&,
const Frees&,
const VA& acts);
104 template<structure::LiouvilleanAveragedTag>
107 template<structure::LiouvilleanAveragedTag>
108 static size_t nAvrLA(
const Frees& frees,
const VA& acts);
110 template<structure::LiouvilleanAveragedTag>
113 template<structure::LiouvilleanAveragedTag>
114 static const Averages averageLA(
double t,
const LazyDensityOperator& ldo,
const Frees& frees,
const VA& acts,
size_t numberAvr);
116 template<structure::LiouvilleanAveragedTag>
121 explicit Base(
const Frees& frees,
const VA& acts)
122 : RBase(frees), frees_(RBase::getFrees()), acts_(acts) {}
124 const VA& getActs()
const {
return acts_;}
129 double highestFrequency_v( )
const;
130 std::ostream& displayParameters_v(std::ostream&)
const;
class DisplayParameters;
134 std::ostream& displayKey_v(std::ostream& os,
size_t& i)
const {
return displayKeyLA<structure::LA_Av>(os,i, frees_,acts_ );}
135 size_t nAvr_v()
const {
return nAvrLA<structure::LA_Av>( frees_,acts_ );}
136 const Averages average_v(
double t,
const LazyDensityOperator& ldo)
const {
return averageLA<structure::LA_Av>(t,ldo,frees_,acts_,nAvr_v());}
138 void process_v(Averages&)
const;
class Process;
139 std::ostream& display_v(
const Averages&, std::ostream&,
int)
const;
class Display;
148 template<
typename VA>
149 const typename Base<VA>::Frees fillFrees(
const VA& acts);
153 template<
typename VA>
158 template<
typename VA>
165 typedef blitz::TinyVector<SubSystemFree,RANK> Frees;
167 typedef typename quantumdata::Types<RANK>::StateVectorLow StateVectorLow;
172 Exact(
const Frees& frees,
const VA& acts) : frees_(frees), acts_(acts) {}
175 bool applicableInMaster_v( )
const;
class IsUnitary;
176 void actWithU_v(
double, StateVectorLow&,
double)
const;
class ActWithU ;
184 template<
typename VA>
191 typedef blitz::TinyVector<SubSystemFree,RANK> Frees;
193 typedef typename quantumdata::Types<RANK>::StateVectorLow StateVectorLow;
198 Hamiltonian(
const Frees& frees,
const VA& acts) : frees_(frees), acts_(acts) {}
201 void addContribution_v(
double,
const StateVectorLow&, StateVectorLow&,
double)
const;
class AddContribution;
209 template<
typename VA>
216 typedef blitz::TinyVector<SubSystemFree,RANK> Frees;
218 typedef typename quantumdata::Types<RANK>::StateVectorLow StateVectorLow;
227 Liouvillean(
const Frees& frees,
const VA& acts) : frees_(frees), acts_(acts) {}
230 std::ostream& displayKey_v(std::ostream& os,
size_t& i)
const {
return Base<VA>::template displayKeyLA<structure::LA_Li>(os,i, frees_,acts_ );}
231 size_t nAvr_v()
const {
return Base<VA>::template nAvrLA<structure::LA_Li>( frees_,acts_ );}
232 const Rates average_v(
double t,
const LazyDensityOperator& ldo)
const {
return Base<VA>::template averageLA<structure::LA_Li>(t,ldo,frees_,acts_,nAvr_v());}
234 void actWithJ_v(
double, StateVectorLow&,
size_t)
const;
class ActWithJ;
246 template<
typename VA>
256 #define BASE_class(Aux,Class) mpl::if_c<IS_##Aux,composite::Class<VA>,composite::EmptyBase<composite::Class<VA> > >::type
313 template<
typename VA,
bool IS_EX=true,
bool IS_HA=true,
bool IS_LI=true>
317 public BASE_class(EX,Exact),
318 public BASE_class(HA,Hamiltonian),
319 public BASE_class(LI,Liouvillean)
324 typedef typename BASE_class(EX,Exact) ExactBase;
325 typedef typename BASE_class(HA,Hamiltonian) HamiltonianBase;
326 typedef typename BASE_class(LI,Liouvillean) LiouvilleanBase;
328 typedef typename composite::Base<VA>::Frees Frees;
331 static const int RANK=Base::RANK;
334 using Base::getFrees;
using Base::getActs ;
339 : Base(composite::fillFrees(acts),acts),
340 ExactBase (getFrees(),getActs()),
341 HamiltonianBase(getFrees(),getActs()),
342 LiouvilleanBase(getFrees(),getActs()) {}
345 Composite(
const Frees& frees,
const VA& acts)
347 ExactBase (getFrees(),getActs()),
348 HamiltonianBase(getFrees(),getActs()),
349 LiouvilleanBase(getFrees(),getActs()) {}
351 friend const typename composite::Base<VA>::Ptr composite::doMake<VA>(
const VA&);
364 namespace result_of {
367 template<
bool IS_EX,
bool IS_HA,
bool IS_LI,
typename... Acts>
368 struct MakeConcrete : boost::mpl::identity<Composite<typename make_list<Acts...>::type, IS_EX, IS_HA, IS_LI> > {};
371 template<
typename... Acts>
372 struct Make : boost::mpl::identity<typename Base<typename make_list<Acts...>::type>::Ptr> {};
379 template<
typename... Acts>
381 make(
const Acts&... acts)
383 return doMake(make_list(acts...));
390 #endif // CPPQEDCORE_COMPOSITES_COMPOSITE_H_INCLUDED
The interface every system that needs transformation between two quantum mechanical pictures must pre...
Definition of blitzplusplus::basi::Iterator together with its helpers.
boost::shared_ptr< const Base > Ptr
Convenience typedef.
Auxiliary tools to Composite.
const Ptr doMake(Interaction::Ptr)
Maker function for BinarySystem.
The interface every system having (possibly non-Hermitian) Hamiltonian time-evolution must present to...
The interface every system that calculates and displays quantum averages must present towards the tra...
Class representing a full-fledged composite quantum system defined by a network of interactions...
Common interface for calculating quantum averages.
Defines the helper class composite::_.
The abstract interface every system has to present towards the quantum trajectory drivers quantumtraj...
The interface every system having Liouvillean time-evolution must present towards the trajectory driv...
static const int N_RANK
Arity of the Hilbert space.
Defines composite::SubSystemFree and composite::SubSystemsInteraction.
LiouvilleanAveragedCommon::DArray1D Averages
The 1D real array storing the calculated quantum averages (perhaps in real-imaginary pairs if a given...
Base::DArray1D Rates
The 1D real array for storing the jump rates.