4 #ifndef CPPQEDCORE_QUANTUMDATA_LAZYDENSITYOPERATOR_H_INCLUDED
5 #define CPPQEDCORE_QUANTUMDATA_LAZYDENSITYOPERATOR_H_INCLUDED
7 #include "LazyDensityOperatorFwd.h"
14 #include <boost/shared_ptr.hpp>
16 #include <boost/mpl/if.hpp>
19 namespace mpl=boost::mpl;
36 template<
typename V,
typename T,
int RANK,
typename F>
38 partialTrace(
const LazyDensityOperator<RANK>&, F
function);
65 typedef boost::shared_ptr<const LazyDensityOperator>
Ptr;
79 IndexerProxy(
const LazyDensityOperator* ldo,
const Idx& firstIndex) : ldo_(ldo), firstIndex_(firstIndex) {}
81 const dcomp operator()(
const Idx& secondIndex)
const {
return ldo_->index(firstIndex_,secondIndex);}
83 template<
typename... SubscriptPack>
86 static_assert( mpl::size<mpl::vector<SubscriptPack...> >::value==RANK-1 ,
"Incorrect number of subscripts for LazyDensityOperator::IndexerProxy." );
90 operator double()
const {
return real(ldo_->index(firstIndex_,firstIndex_));}
94 const Idx firstIndex_;
98 friend class IndexerProxy;
102 const IndexerProxy
operator()(
const Idx& firstIndex)
const {
return IndexerProxy(
this,firstIndex);}
119 template<
typename... SubscriptPack>
120 const IndexerProxy
operator()(
int s0, SubscriptPack... subscriptPack)
const
122 static_assert( mpl::size<mpl::vector<SubscriptPack...> >::value==RANK-1 ,
"Incorrect number of subscripts for LazyDensityOperator." );
126 double trace()
const {
return trace_v();}
145 virtual const dcomp index(
const Idx& i,
const Idx& j)
const = 0;
147 virtual double trace_v()
const = 0;
160 const DArray<1> deflate(
const LazyDensityOperator<RANK>&,
bool offDiagonals);
271 #endif // CPPQEDCORE_QUANTUMDATA_LAZYDENSITYOPERATOR_H_INCLUDED
const ldo::DiagonalIterator< RANK, V > begin() const
Return the ldo::DiagonalIterator corresponding to the beginning of the sequence of slices defined by ...
quantumdata::LazyDensityOperator< 1 > LazyDensityOperator
unary LazyDensityOperator
blitz::TinyVector< ptrdiff_t, RANK > IdxTiny
A tiny vector used for indexing of objects of arbitrary arity.
Comprises classes representing the state of composite quantum systems and providing various interface...
Iterator for slices of a LazyDensityOperator that are diagonal in the dummy indices.
double trace() const
Returns the trace (redirected to a pure virtual)
const IndexerProxy operator()(int s0, SubscriptPack...subscriptPack) const
Multi-matrix style indexing via packs of integers.
IdxTiny< RANK > Idx
The type used for indexing the “rows” and the “columns”: a tiny vector of integers (multi-index) ...
blitz::Array< double, RANK > DArray
An array of doubles of arbitrary arity.
Defines class of the same name.
Stores and manipulates dimensions of constructs over composite Hilbert spaces of arbitrary arity...
Additional helpers for dcomp.
boost::shared_ptr< const LazyDensityOperator > Ptr
Many class templates in the framework define shared pointers to their own types, in a template-metafu...
Common interface for calculating quantum averages.
const DArray< 1 > deflate(const LazyDensityOperator< RANK > &, bool offDiagonals)
Turns the data of a LazyDensityOperator into a real 1D array.
Base::Dimensions Dimensions
Inherited from DimensionsBookkeeper.
const IndexerProxy operator()(const Idx &firstIndex) const
Multi-matrix style indexing via Idx type.
const ldo::DiagonalIterator< RANK, V > end() const
” for the end
std::complex< double > dcomp
Double-precision complex number.
ExtTiny< RANK > Dimensions
The dimensions as a static vector of size N_RANK.
const T partialTrace(const LazyDensityOperator< RANK > &, F function)
The primary tool for performing slice iterations.
Defines template aliases for real and complex arrays.