28 #ifndef TOMOGRAPHER_DENSEDM_DMTYPES_H 29 #define TOMOGRAPHER_DENSEDM_DMTYPES_H 34 #include <Eigen/Eigen> 99 template<
int FixedDim_,
typename RealScalar_ =
double,
int MaxFixedDim_ = FixedDim_>
106 (FixedDim_ <= MaxFixedDim_)) ;
113 static constexpr
int FixedDim2 = ((FixedDim!=Eigen::Dynamic) ? FixedDim*FixedDim : Eigen::Dynamic);
117 static constexpr
int FixedNdof = ((FixedDim2!=Eigen::Dynamic) ? FixedDim2-1 : Eigen::Dynamic);
125 static inline ComplexScalar
cplx(RealScalar a, RealScalar b)
156 TOMOGRAPHER_ENABLED_IF(!IsDynamicDim)
204 TOMOGRAPHER_ENABLED_IF(!IsDynamicDim)
207 return MatrixType::Zero();
217 return MatrixType::Zero(_dim.
value(), _dim.
value());
228 return VectorParamType::Zero();
238 return VectorParamType::Zero(
dim2());
250 return VectorParamNdofType::Zero();
261 return VectorParamNdofType::Zero(
ndof());
#define TOMO_STATIC_ASSERT_EXPR(...)
Tool for static assertions without message.
std::size_t dim2() const
get the square of the dimension of the quantum system
Eigen::Matrix< RealScalar, FixedDim2, 1 > VectorParamType
Real vector with dim*dim elements.
Base namespace for the Tomographer project.
std::complex< RealScalar > ComplexScalar
The corresponding complex scalar type.
const Eigen::Ref< const MatrixType > & MatrixTypeConstRef
Shorthand for a const reference to a MatrixType-like Eigen object.
Eigen::Matrix< RealScalar, FixedNdof, 1 > VectorParamNdofType
Real vector with dim*dim-1 elements.
static ComplexScalar cplx(RealScalar a, RealScalar b)
Utility to initialize a complex number using the current scalar type.
VectorParamNdofType::ConstantReturnType initVectorParamNdofType() const
Zero initializer for a VectorParamNdofType [implementation for static dimension]. ...
static constexpr int FixedDim2
The square of the dimension of the quantum system, or Eigen::Dynamic.
static constexpr bool IsDynamicDim
Whether the dimension is specified dynamically at run-time or statically at compile-time.
static constexpr int FixedDim
The fixed dimension of the quantum system, or Eigen::Dynamic.
Some C++ utilities, with a tad of C++11 tricks.
std::size_t ndof() const
get the square of the dimension of the quantum system, minus one
Eigen::Matrix< ComplexScalar, FixedDim, FixedDim, Eigen::Matrix< ComplexScalar, FixedDim, FixedDim >::Options, MaxFixedDim_, MaxFixedDim_ > MatrixType
Matrix type, to store the density operator as a dense matrix.
const Eigen::Ref< const VectorParamType > & VectorParamTypeConstRef
Shorthand for a const reference to a VectorParamType-like Eigen object.
static constexpr int FixedNdof
The square of the dimension of the quantum system minus one, or Eigen::Dynamic.
MatrixType::ConstantReturnType initMatrixType() const
Zero initializer for a MatrixType [implementation for static dimension].
C++ types needed to store a quantum state as a dense matrix.
DMTypes(std::size_t d)
Constructor [works for both static or dynamic dim].
std::size_t dim() const
get the dimension of the quantum system (dimension of the Hilbert space)
const Eigen::Ref< const VectorParamNdofType > & VectorParamNdofTypeConstRef
Shorthand for a const reference to a VectorParamNdofType-like Eigen object.
VectorParamType::ConstantReturnType initVectorParamType() const
Zero initializer for a VectorParamType [implementation for static dimension].
RealScalar_ RealScalar
Real scalar type, given in template parameter. Usually double is fine.