Tomographer
v5.4
Tomographer C++ Framework Documentation
|
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::FixedDim2 > | VectorParamListType |
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 VectorParamListType & | Exn () const |
The stored individual POVM effects, in X Parameterization. More... | |
Eigen::Ref< const typename DMTypes::VectorParamType > | Exn (IndexType i) const |
The i-th stored POVM effect, in X Parameterization. More... | |
const FreqListType & | Nx () 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. | |
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.
Definition at line 69 of file indepmeasllh.h.
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.
|
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.
|
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.
|
inline |
Store a measurement POVM effect along with a frequency count.
E_x | the X-parameterization of the POVM effect corresponding to the observed measurement outcome |
n | the number of times this POVM effect was observed in the experiment |
check_validity | Perform 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.
|
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.
|
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.
|
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.
|
inline |
Calculates the log-likelihood function, in X parameterization.
\[ \log\Lambda(\texttt{x}) = \sum_k \texttt{Nx[k]}\,\ln\mathrm{tr}(\texttt{Exn[k]}\,\rho(\texttt{x})) . \]
Definition at line 384 of file indepmeasllh.h.
|
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.
|
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.
|
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.
|
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.
|
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.
|
inline |
Specify the full measurement data at once.
Definition at line 279 of file indepmeasllh.h.
|
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.