4 #ifndef CPPQEDCORE_QUANTUMDATA_DIMENSIONSBOOKKEEPER_H_INCLUDED
5 #define CPPQEDCORE_QUANTUMDATA_DIMENSIONSBOOKKEEPER_H_INCLUDED
7 #include "DimensionsBookkeeperFwd.h"
13 namespace mpl=boost::mpl;
27 template<
int RANK,
bool IS_CONST>
45 : dimensions_(), totalDimension_() {}
48 : dimensions_(dimensions), totalDimension_(product(dimensions)) {}
53 size_t getDimension(mpl::int_<RANK> =mpl::int_<1>())
const {
return totalDimension_;}
55 size_t getDimension(
size_t i)
const {
return dimensions_[i];}
57 void setDimensions(
const Dimensions& dimensions) {dimensions_=dimensions; totalDimension_=product(dimensions);}
67 template<
int RANK,
bool IS_CONST1,
bool IS_CONST2>
75 template<
int RANK,
bool IS_CONST1,
bool IS_CONST2>
82 #endif // CPPQEDCORE_QUANTUMDATA_DIMENSIONSBOOKKEEPER_H_INCLUDED
The class that is (meant to be, at least) the base of all exceptions in the framework.
blitz::TinyVector< size_t, RANK > ExtTiny
A tiny vector describing extensions of objects of arbitrary arity.
bool operator!=(const DimensionsBookkeeper< RANK, IS_CONST1 > &d1, const DimensionsBookkeeper< RANK, IS_CONST2 > &d2)
dimensionality comparison for types derived from DimensionsBookkeeper
DimensionsBookkeeper(const Dimensions &dimensions)
Standard constructor usable also in the IS_CONST=true case.
Thrown in the case of dimensionality mismatch of constructs over the same Hilbert space...
Stores and manipulates dimensions of constructs over composite Hilbert spaces of arbitrary arity...
DimensionsBookkeeper(mpl::bool_< IS_CONST >=mpl::false_())
Constructor usable only in the IS_CONST=false case.
size_t getDimension(mpl::int_< RANK >=mpl::int_< 1 >()) const
Get the (single) dimension for a unary system.
static const int DIMESIONS_BOOKKEEPER_RANK
Ditto (to break ambiguity if a class is derived from another base featuring N_RANK).
Defines template aliases for blitz::TinyVectors used for characterising the size of multi-arrays and ...
bool operator==(const DimensionsBookkeeper< RANK, IS_CONST1 > &d1, const DimensionsBookkeeper< RANK, IS_CONST2 > &d2)
dimensionality comparison for types derived from DimensionsBookkeeper
void setDimensions(const Dimensions &dimensions)
This will work only in the non-const case.
const Dimensions & getDimensions() const
Get the Dimensions vector.
static const int N_RANK
Arity of the Hilbert space.
ExtTiny< RANK > Dimensions
The dimensions as a static vector of size N_RANK.
Defines tentative base classes for the exception classes of the framework.
size_t getTotalDimension() const
Get the total dimension of a system of arbitrary arity.