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
quantumdata::StateVector< RANK > Class Template Reference

State vector of arbitrary arity. More...

#include <StateVector.h>

+ Inheritance diagram for quantumdata::StateVector< RANK >:
+ Collaboration diagram for quantumdata::StateVector< RANK >:

Public Types

typedef LazyDensityOperator< RANK > LDO_Base
 
typedef ArrayBase< RANK > ABase
 
typedef LDO_Base::Dimensions Dimensions
 
typedef ABase::ArrayLow StateVectorLow
 
typedef Types< RANK >::DensityOperatorLow DensityOperatorLow
 
typedef LDO_Base::Idx Idx
 
- Public Types inherited from quantumdata::LazyDensityOperator< RANK >
typedef boost::shared_ptr< const LazyDensityOperatorPtr
 Many class templates in the framework define shared pointers to their own types, in a template-metafunction like manner.
 
typedef DimensionsBookkeeper< RANK, true > Base
 
typedef Base::Dimensions Dimensions
 Inherited from DimensionsBookkeeper.
 
typedef IdxTiny< RANK > Idx
 The type used for indexing the “rows” and the “columns”: a tiny vector of integers (multi-index)
 
- Public Types inherited from DimensionsBookkeeper< RANK, true >
typedef ExtTiny< RANK > Dimensions
 The dimensions as a static vector of size N_RANK.
 

Public Member Functions

void addTo (DensityOperator< RANK > &densityOperator) const
 Adds a dyad of the present object to densityOperator More...
 
void debug () const
 
Construction, assignment
 StateVector (const StateVectorLow &psi, ByReference)
 Constructs the class in such a way that the underlying data reference the same data as psi. More...
 
 StateVector (const Dimensions &, bool init=true)
 Constructs the class with a newly allocated chunk of memory, which is initialized only if init is true.
 
 StateVector (const StateVector &)
 Copy constructor using by value semantics, that is, deep copy.
 
template<int RANK2>
 StateVector (const StateVector< RANK2 > &, const StateVector< RANK-RANK2 > &)
 Constructs the class as the direct product of psi1 and psi2, whose arities add up to RANK. More...
 
StateVectoroperator= (const StateVector &sv)
 Assignment with by-value semantics. More...
 
template<typename OTHER >
StateVectoroperator= (const OTHER &other)
 Mixed-mode assignment with by-value semantics. More...
 
Subscripting
template<typename... SubscriptPack>
const dcompoperator() (int s0, SubscriptPack...subscriptPack) const
 Multi-array style subscription. More...
 
template<typename... SubscriptPack>
dcompoperator() (int s0, SubscriptPack...subscriptPack)
 
 
Metric
double norm () const
 Returns the norm $\norm\Psi$. More...
 
double renorm ()
 ” and also renormalises
 
Dyad
const DensityOperatorLow dyad (const StateVector &) const
 Forms a dyad with the argument. More...
 
const DensityOperatorLow dyad () const
 dyad with the object itself
 
Naive vector-space operations
StateVectoroperator+= (const StateVector &psi)
 
StateVectoroperator-= (const StateVector &psi)
 
const StateVector operator- () const
 involves a deep-copy
 
const StateVector operator+ () const
 simply deep copy
 
Naive vector-space operations allowing also for mixed-mode arithmetics
template<typename OTHER >
StateVectoroperator*= (const OTHER &dc)
 
template<typename OTHER >
StateVectoroperator/= (const OTHER &dc)
 
- Public Member Functions inherited from quantumdata::LazyDensityOperator< RANK >
const IndexerProxy operator() (const Idx &firstIndex) const
 Multi-matrix style indexing via Idx type.
 
template<typename... SubscriptPack>
const IndexerProxy operator() (int s0, SubscriptPack...subscriptPack) const
 Multi-matrix style indexing via packs of integers. More...
 
double trace () const
 Returns the trace (redirected to a pure virtual)
 
template<typename V >
const ldo::DiagonalIterator< RANK, V > begin () const
 Return the ldo::DiagonalIterator corresponding to the beginning of the sequence of slices defined by V More...
 
template<typename V >
const ldo::DiagonalIterator< RANK, V > end () const
 ” for the end
 
- Public Member Functions inherited from DimensionsBookkeeper< RANK, true >
 DimensionsBookkeeper (mpl::bool_< IS_CONST >=mpl::false_())
 Constructor usable only in the IS_CONST=false case. More...
 
 DimensionsBookkeeper (const Dimensions &dimensions)
 Standard constructor usable also in the IS_CONST=true case.
 
const DimensionsgetDimensions () const
 Get the Dimensions vector.
 
size_t getTotalDimension () const
 Get the total dimension of a system of arbitrary arity.
 
size_t getDimension (mpl::int_< RANK >=mpl::int_< 1 >()) const
 Get the (single) dimension for a unary system.
 
size_t getDimension (size_t i) const
 
void setDimensions (const Dimensions &dimensions)
 This will work only in the non-const case.
 

Static Public Attributes

static const int N_RANK =RANK
 
- Static Public Attributes inherited from DimensionsBookkeeper< RANK, true >
static const int N_RANK
 Arity of the Hilbert space.
 
static const int DIMESIONS_BOOKKEEPER_RANK
 Ditto (to break ambiguity if a class is derived from another base featuring N_RANK).
 

Additional Inherited Members

- Protected Member Functions inherited from quantumdata::LazyDensityOperator< RANK >
 LazyDensityOperator (const Dimensions &dims)
 

Detailed Description

template<int RANK>
class quantumdata::StateVector< RANK >

State vector of arbitrary arity.

Cf. rationale

Template Parameters
RANKarity of the Hilbert space

The inheritance of StateVector from linalg::VectorSpace provides for a lot of free-standing helpers describing vector-space algebra. These are all naively based on the arithmetic member functions like StateVector::operator+=, StateVector::operator*=, etc.

Todo:
provide a move constructor

Definition at line 58 of file StateVector.h.

Constructor & Destructor Documentation

template<int RANK>
quantumdata::StateVector< RANK >::StateVector ( const StateVectorLow &  psi,
ByReference   
)
inline

Constructs the class in such a way that the underlying data reference the same data as psi.

Simply furnishes an already existing StateVectorLow with a StateVector interface.

Note
By-reference semantics! Since everywhere else the class represents by-value semantics, some care is needed with this constructor’s use. For this reason, the tagging dummy class ByReference is introduced, to make the user conscious of what the semantics is.

Definition at line 88 of file StateVector.h.

template<int RANK>
template<int RANK2>
quantumdata::StateVector< RANK >::StateVector ( const StateVector< RANK2 > &  ,
const StateVector< RANK-RANK2 > &   
)

Constructs the class as the direct product of psi1 and psi2, whose arities add up to RANK.

The implementation relies on blitzplusplus::concatenateTinies and blitzplusplus::doDirect.

Template Parameters
RANK2the arity of one of the operands

Member Function Documentation

template<int RANK>
void quantumdata::StateVector< RANK >::addTo ( DensityOperator< RANK > &  densityOperator) const

Adds a dyad of the present object to densityOperator

This is done without actually forming the dyad in memory (so that this is not implemented in terms of StateVector::dyad). This is important in situations when an average density operator is needed from an ensemble of state vectors, an example being quantumtrajectory::EnsembleMCWF.

template<int RANK>
const DensityOperatorLow quantumdata::StateVector< RANK >::dyad ( const StateVector< RANK > &  ) const

Forms a dyad with the argument.

This is a rather expensive operation, implemented in terms of blitzplusplus::doDirect.

template<int RANK>
double quantumdata::StateVector< RANK >::norm ( ) const
inline

Returns the norm $\norm\Psi$.

Implemented in terms of ArrayBase::frobeniusNorm.

Definition at line 131 of file StateVector.h.

template<int RANK>
template<typename... SubscriptPack>
const dcomp& quantumdata::StateVector< RANK >::operator() ( int  s0,
SubscriptPack...  subscriptPack 
) const

Multi-array style subscription.

Template Parameters
...SubscriptPackexpected as all integers of number RANK-1 (checked @ compile time)
template<int RANK>
template<typename OTHER >
StateVector& quantumdata::StateVector< RANK >::operator*= ( const OTHER &  dc)
inline
Template Parameters
OTHERthe “other” type in mixed mode

Definition at line 162 of file StateVector.h.

template<int RANK>
StateVector& quantumdata::StateVector< RANK >::operator= ( const StateVector< RANK > &  sv)
inline

Assignment with by-value semantics.

Default assignment doesn't work, because LazyDensityOperator is always purely constant (const DimensionsBookkeeper base).

Definition at line 104 of file StateVector.h.

template<int RANK>
template<typename OTHER >
StateVector& quantumdata::StateVector< RANK >::operator= ( const OTHER &  other)
inline

Mixed-mode assignment with by-value semantics.

The standard assignment and the templated assignment together cover a lot of possibilities, including also assignment from a StateVectorLow, but for example also from a DArray<RANK>, or just a const c-number. (Can be assigned from anything a CArray<RANK> can be assigned from.)

Template Parameters
OTHERthe “other” type in mixed mode

Definition at line 114 of file StateVector.h.


The documentation for this class was generated from the following file: