Tomographer  v5.3
Tomographer C++ Framework Documentation
Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ > Class Template Reference

C++ types and functions for calculating the log-likelihood for POVM effects which can be written as a product of individual effects. More...

#include <tomographer/densedm/indepmeasllh.h>

Public Types

enum  
 Declare some stuff as part of the DenseLLH Interface compliance. More...
 
typedef DMTypes_ DMTypes
 The DMTypes in use here.
 
typedef LLHValueType_ LLHValueType
 Type used to calculate the log-likelihood function (see DenseLLH Interface)
 
typedef IntFreqType_ IntFreqType
 Type used to store integer measurement counts.
 
typedef Eigen::Matrix< typename DMTypes::RealScalar, Eigen::Dynamic, DMTypes::FixedDim2, Eigen::RowMajor, FixedMaxParamList, DMTypes::FixedDim2VectorParamListType
 dynamic Matrix with rows = dim*dim Vectors (row-major) [maximum FixedMaxParamList rows, or Dynamic]
 
typedef const Eigen::Ref< const VectorParamListType > & VectorParamListTypeConstRef
 Const ref to a VectorParamListType.
 
typedef VectorParamListType::Index IndexType
 Type used to index entries in VectorParamListType (and also used for indexing entries in FreqListType)
 
typedef Eigen::Array< IntFreqType, Eigen::Dynamic, 1, 0, FixedMaxParamList, 1 > FreqListType
 dynamic Array of integers [maximum FixedMaxParamList entries or Dynamic]
 
typedef const Eigen::Ref< const FreqListType > & FreqListTypeConstRef
 Const ref to a FreqListType.
 

Public Member Functions

 IndepMeasLLH (DMTypes dmt_)
 Simple constructor. More...
 
 IndepMeasLLH (DMTypes dmt_, VectorParamListTypeConstRef Exn_, FreqListTypeConstRef Nx_)
 Constructor with full measurement data. More...
 
const IndexType numEffects () const
 The number of POVM effects in the list. More...
 
const VectorParamListTypeExn () const
 The stored individual POVM effects, in X Parameterization. More...
 
Eigen::Ref< const typename DMTypes::VectorParamTypeExn (IndexType i) const
 The i-th stored POVM effect, in X Parameterization. More...
 
const FreqListTypeNx () const
 The stored frequency counts for each individual POVM effect. More...
 
const IntFreqType Nx (IndexType i) const
 The number of counts stored for the i-th POVM effect. More...
 
void resetMeas ()
 Reset the measurement vectors and frequency counts. More...
 
void addMeasEffect (typename DMTypes::VectorParamTypeConstRef E_x, IntFreqType n, bool check_validity=true)
 Store a measurement POVM effect along with a frequency count. More...
 
void addMeasEffect (typename DMTypes::MatrixTypeConstRef E_m, IntFreqType n, bool check_validity=true)
 Store a POVM measurement effect with frequency count. More...
 
void setMeas (VectorParamListTypeConstRef Exn_, FreqListTypeConstRef Nx_, bool check_validity=true)
 Specify the full measurement data at once. More...
 
void checkAllMeas () const
 
void checkEffect (IndexType i) const
 
template<ENABLED_IF( UseNMeasAmplifyFactor) >
LLHValueType NMeasAmplifyFactor () const
 Factor by which to artificially amplify the number of measurements. More...
 
template<ENABLED_IF( !UseNMeasAmplifyFactor) >
LLHValueType NMeasAmplifyFactor () const
 Basic implementation of NMeasAmplifyFactor() if this feature is disabled.
 
template<ENABLED_IF( UseNMeasAmplifyFactor) >
void setNMeasAmplifyFactor (LLHValueType val)
 Set the factor by which to artificially multiply all frequency counts. More...
 
LLHValueType logLikelihoodX (typename DMTypes::VectorParamTypeConstRef x) const
 Calculates the log-likelihood function, in X parameterization. More...
 

Public Attributes

const DMTypes dmt
 The DMTypes object, storing e.g. the dimension of the problem.
 

Static Public Attributes

static constexpr int FixedMaxParamList = FixedMaxParamList_
 Maximum number of POVM effects, fixed at compile-time or Eigen::Dynamic.
 
static constexpr bool IsDynamicMaxParamList = (FixedMaxParamList_ == Eigen::Dynamic)
 Whether the dimension is specified dynamically at run-time or statically at compile-time.
 
static constexpr bool UseNMeasAmplifyFactor = UseNMeasAmplifyFactor_
 Whether we allow NMeasAmplifyFactor to be set.
 

Detailed Description

template<typename DMTypes_, typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
class Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >

C++ types and functions for calculating the log-likelihood for POVM effects which can be written as a product of individual effects.

Implements the DenseLLH Interface.

Since
Since Tomographer 5.3, a pointer to this class can be serialized with Boost.Serialization.

Definition at line 69 of file indepmeasllh.h.

Member Enumeration Documentation

§ anonymous enum

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
anonymous enum

Declare some stuff as part of the DenseLLH Interface compliance.

See DenseDM::LLHCalcTypeX and DenseLLH Interface for details.

Enumerator
LLHCalcType 

Declare that this DenseLLH object exposes a logLikelihoodX() method.

Definition at line 90 of file indepmeasllh.h.

Constructor & Destructor Documentation

§ IndepMeasLLH() [1/2]

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::IndepMeasLLH ( DMTypes  dmt_)
inline

Simple constructor.

The measurement data is initialially empty. You may call addMeasEffect() or setMeas() to specify the measurement data.

Definition at line 121 of file indepmeasllh.h.

§ IndepMeasLLH() [2/2]

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::IndepMeasLLH ( DMTypes  dmt_,
VectorParamListTypeConstRef  Exn_,
FreqListTypeConstRef  Nx_ 
)
inline

Constructor with full measurement data.

The measurement data is set to Exn_ and Nx_ via a call to setMeas().

Definition at line 131 of file indepmeasllh.h.

Member Function Documentation

§ addMeasEffect() [1/2]

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
void Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::addMeasEffect ( typename DMTypes::VectorParamTypeConstRef  E_x,
IntFreqType  n,
bool  check_validity = true 
)
inline

Store a measurement POVM effect along with a frequency count.

Parameters
E_xthe X-parameterization of the POVM effect corresponding to the observed measurement outcome
nthe number of times this POVM effect was observed in the experiment
check_validityPerform some sanity checks, verifying the E_x and n are valid inputs

If n is zero, then the measurement effect is ignored and not stored. This is because the outcome was never observed in the experiment; furthermore we can't have zero entries in the Nx() vector because that would cause "0*log(0)" terms in our logLikelihoodX() calculation and create a mess of NaNs And Infs.

Definition at line 220 of file indepmeasllh.h.

§ addMeasEffect() [2/2]

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
void Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::addMeasEffect ( typename DMTypes::MatrixTypeConstRef  E_m,
IntFreqType  n,
bool  check_validity = true 
)
inline

Store a POVM measurement effect with frequency count.

This overload accepts the POVM effect specified as a dense matrix instead of a X Parameterization.

See addMeasEffect(typename DMTypes::VectorParamTypeConstRef E_x, IntFreqType n, bool check_validity = true).

Definition at line 256 of file indepmeasllh.h.

§ Exn() [1/2]

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
const VectorParamListType& Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::Exn ( ) const
inline

The stored individual POVM effects, in X Parameterization.

This is an Eigen::Array type (2-D), whose rows are the x-parameterization representation of the POVM effects.

The number of rows of Exn must be equal to the number of rows of Nx. Use setMeas() or addMeasEffect() to populate measurements.

See also Exn(IndexType i) const

Definition at line 158 of file indepmeasllh.h.

§ Exn() [2/2]

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
Eigen::Ref<const typename DMTypes::VectorParamType> Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::Exn ( IndexType  i) const
inline

The i-th stored POVM effect, in X Parameterization.

Returns the i-th stored POVM effect, in X-parameterization, as a column vector.

See also Exn()

Definition at line 166 of file indepmeasllh.h.

§ logLikelihoodX()

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
LLHValueType Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::logLikelihoodX ( typename DMTypes::VectorParamTypeConstRef  x) const
inline

Calculates the log-likelihood function, in X parameterization.

Returns
the value of the log-likelihood function of this data at the point x, defined as

\[ \log\Lambda(\texttt{x}) = \sum_k \texttt{Nx[k]}\,\ln\mathrm{tr}(\texttt{Exn[k]}\,\rho(\texttt{x})) . \]

Note
this does not include a sometimes conventional factor \( -2\).

Definition at line 384 of file indepmeasllh.h.

§ NMeasAmplifyFactor()

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
template<ENABLED_IF( UseNMeasAmplifyFactor) >
LLHValueType Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::NMeasAmplifyFactor ( ) const
inline

Factor by which to artificially amplify the number of measurements.

This should always be set to one for any physical experiment. It is only useful for tests.

Definition at line 359 of file indepmeasllh.h.

§ numEffects()

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
const IndexType Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::numEffects ( ) const
inline

The number of POVM effects in the list.

Returns the size of the list of POVM effects. They are not guaranteed to be different (although this is usually the case); that depends on what the user specified to setMeas().

Definition at line 146 of file indepmeasllh.h.

§ Nx() [1/2]

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
const FreqListType& Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::Nx ( ) const
inline

The stored frequency counts for each individual POVM effect.

This is an Eigen::Array object (1-D), of an integer type, which stores the number of times the corresponding POVM effect (given in the corresponding row in Exn) was observed in the experiment.

The number of rows of Exn must be equal to the number of rows of Nx. Use setMeas() or addMeasEffect to specify the measurement data.

See also Nx(IndexType i) const

Definition at line 183 of file indepmeasllh.h.

§ Nx() [2/2]

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
const IntFreqType Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::Nx ( IndexType  i) const
inline

The number of counts stored for the i-th POVM effect.

Returns the frequency count corresponding to the i-th POVM effect, i.e. the number of times this POVM effect was observed in the experiment.

See also Nx()

Definition at line 192 of file indepmeasllh.h.

§ resetMeas()

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
void Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::resetMeas ( )
inline

Reset the measurement vectors and frequency counts.

Resets the measurement data to an empty list. Consequently the return values of Exn() and Nx() are subsequently empty vectors.

Definition at line 199 of file indepmeasllh.h.

§ setMeas()

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
void Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::setMeas ( VectorParamListTypeConstRef  Exn_,
FreqListTypeConstRef  Nx_,
bool  check_validity = true 
)
inline

Specify the full measurement data at once.

Definition at line 279 of file indepmeasllh.h.

§ setNMeasAmplifyFactor()

template<typename DMTypes_ , typename LLHValueType_ = typename DMTypes_::RealScalar, typename IntFreqType_ = int, int FixedMaxParamList_ = Eigen::Dynamic, bool UseNMeasAmplifyFactor_ = false>
template<ENABLED_IF( UseNMeasAmplifyFactor) >
void Tomographer::DenseDM::IndepMeasLLH< DMTypes_, LLHValueType_, IntFreqType_, FixedMaxParamList_, UseNMeasAmplifyFactor_ >::setNMeasAmplifyFactor ( LLHValueType  val)
inline

Set the factor by which to artificially multiply all frequency counts.

Only use this for tests and debugging. It does not have any meaning for actual measurement data, as with this you are altering the numbers that you observed in the experiment!

Definition at line 372 of file indepmeasllh.h.


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