State vector of arbitrary arity. More...
#include <StateVector.h>
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 LazyDensityOperator > | Ptr |
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... | |
StateVector & | operator= (const StateVector &sv) |
Assignment with by-value semantics. More... | |
template<typename OTHER > | |
StateVector & | operator= (const OTHER &other) |
Mixed-mode assignment with by-value semantics. More... | |
Subscripting | |
template<typename... SubscriptPack> | |
const dcomp & | operator() (int s0, SubscriptPack...subscriptPack) const |
Multi-array style subscription. More... | |
template<typename... SubscriptPack> | |
dcomp & | operator() (int s0, SubscriptPack...subscriptPack) |
” | |
Metric | |
double | norm () const |
Returns the norm . 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 | |
StateVector & | operator+= (const StateVector &psi) |
StateVector & | operator-= (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 > | |
StateVector & | operator*= (const OTHER &dc) |
template<typename OTHER > | |
StateVector & | operator/= (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 Dimensions & | getDimensions () 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) | |
State vector of arbitrary arity.
Cf. rationale
RANK | arity 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.
Definition at line 58 of file StateVector.h.
|
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.
Definition at line 88 of file StateVector.h.
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.
RANK2 | the arity of one of the operands |
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.
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.
|
inline |
Returns the norm .
Implemented in terms of ArrayBase::frobeniusNorm.
Definition at line 131 of file StateVector.h.
const dcomp& quantumdata::StateVector< RANK >::operator() | ( | int | s0, |
SubscriptPack... | subscriptPack | ||
) | const |
Multi-array style subscription.
...SubscriptPack | expected as all integers of number RANK-1 (checked @ compile time) |
|
inline |
OTHER | the “other” type in mixed mode |
Definition at line 162 of file StateVector.h.
|
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.
|
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.)
OTHER | the “other” type in mixed mode |
Definition at line 114 of file StateVector.h.