Tomographer  v1.0a
Tomographer C++ Framework Documentation
Tomographer Namespace Reference

Base namespace for the Tomographer project. More...

Namespaces

 Logger
 Tomographer's Logging Framework
 
 MAT
 Utilities and helpers for reading MATLAB .mat files.
 
 MHRWTasks
 Definitions for running multiple random walks.
 
 MultiProc
 Definitions for multi-processing classes and helpers.
 
 SolveCLyap
 Definitions for solving the Complex Lyapunov Equation.
 
 SphCoords
 
 Tools
 Various useful tools.
 

Classes

struct  AveragedHistogram
 Combines several histograms (with same parameters) into an averaged histogram. More...
 
class  BinningAnalysis
 Simple binning analysis for determining error bars. More...
 
struct  BinningAnalysisParams
 Group template parameters for BinningAnalysis. More...
 
class  DMStateSpaceLLHMHWalker
 A random walk in the density matrix space of a Hilbert state space of a quantum system. More...
 
class  FidelityToRefCalculator
 Calculate the fidelity to a reference state for each sample. More...
 
struct  IndepMeasTomoProblem
 Stores data for a tomography problem with independent measurements. More...
 
struct  MatrQ
 Defines the data types for a particular problem setting. More...
 
struct  MatrQBase
 Basic definitions for MatrQ. More...
 
struct  MatrQBaseDimStore
 Helper intermediate class for MatrQ. More...
 
struct  MatrQBaseDimStore< Derived, false >
 Specialization of MatrQBaseDimStore<Derived,has_fixed_dim> for dynamic sized types. More...
 
class  MHRandomWalk
 A Metropolis-Hastings Random Walk. More...
 
struct  MHRWStatsCollectorStatus
 Template, specializable class to get status reports from stats collectors. More...
 
struct  MHRWStatsCollectorStatus< MultipleMHRWStatsCollectors< Args... > >
 Provide status reporting for a MultipleMHRWStatsCollectors. More...
 
struct  MHRWStatsCollectorStatus< ValueHistogramMHRWStatsCollector< ValueCalculator_, LoggerType_, HistogramType_ > >
 Provide status reporting for a ValueHistogramMHRWStatsCollector. More...
 
struct  MHRWStatsCollectorStatus< ValueHistogramWithBinningMHRWStatsCollector< Params_, LoggerType_ > >
 Provide status reporting for a ValueHistogramWithBinningMHRWStatsCollector. More...
 
class  MultipleMHRWStatsCollectors
 A simple MHRWStatsCollector interface which combines several stats collectors. More...
 
class  ObservableValueCalculator
 Calculate expectation value of an observable for each sample. More...
 
class  ParamRhoA
 Parameterization of density matrices in su(N) generators. More...
 
class  PurifDistToRefCalculator
 Calculate the "purified distance" to a reference state for each sample. More...
 
struct  RandomWalkBase
 Base class performing an abstract random walk. More...
 
class  TrDistToRefCalculator
 Calculate the trace distance to a reference state for each sample. More...
 
struct  UniformBinsHistogram
 Stores a histogram. More...
 
struct  UniformBinsHistogramWithErrorBars
 Stores a histogram along with error bars. More...
 
class  ValueHistogramMHRWStatsCollector
 A StatsCollector which builds a histogram of values calculated with a ValueCalculator for each data sample point. More...
 
class  ValueHistogramWithBinningMHRWStatsCollector
 Collect a histogram of values from a MH random walk, with binning analysis. More...
 
struct  ValueHistogramWithBinningMHRWStatsCollectorParams
 Traits-like class for ValueHistogramWithBinningMHRWStatsCollector. More...
 

Typedefs

typedef MatrQ< Eigen::Dynamic, Eigen::Dynamic, double, int > DefaultMatrQ
 Data types for all arguments set at run-time. More...
 
typedef MatrQ< 2, 6, double, int > QubitPaulisMatrQ
 Data types for Pauli measurements on a single qubit. More...
 

Enumerations

enum  
 

Functions

template<typename HistogramType >
void histogram_pretty_print (std::ostream &str, const HistogramType &histogram, int max_width=0)
 pretty-print the given histogram. More...
 
template<typename HistogramType >
std::string histogram_pretty_print (const HistogramType &histogram, int max_width=0)
 Utility to display histograms for humans. More...
 
template<typename HistogramType >
int histogram_short_bar (std::ostream &str, const HistogramType &histogram, bool log_scale=true, int max_width=0)
 Format the histogram as a one-line bar. More...
 
template<typename HistogramType >
std::string histogram_short_bar (const HistogramType &histogram, bool log_scale=true, int max_width=0)
 Format the histogram as a one-line bar. More...
 
template<typename ValueType , typename Derived , typename Derived2 >
ValueType fidelity (const Eigen::MatrixBase< Derived > &rho, const Eigen::MatrixBase< Derived2 > &sigma)
 Fidelity between two density matrices. More...
 
template<typename ValueType , typename Der1 , typename Der2 >
ValueType fidelity_T (const Eigen::MatrixBase< Der1 > &T1, const Eigen::MatrixBase< Der2 > &T2)
 Fidelity between two quantum states given by their T Parameterization. More...
 
template<bool OnlyLowerTri = false, typename Derived1 = Eigen::MatrixXd, typename Derived2 = Eigen::MatrixXd>
void param_x_to_herm (Eigen::MatrixBase< Derived1 > &Herm, const Eigen::DenseBase< Derived2 > &x)
 Get the Hermitian matrix parameterized by the "X-parameter" vector x. More...
 
template<typename Derived1 , typename Derived2 >
void param_herm_to_x (Eigen::DenseBase< Derived1 > &x, const Eigen::MatrixBase< Derived2 > &Herm)
 Get the X-parameterization corresponding to a given hermitian matrix. More...
 
template<typename DerU , typename Rng , typename Log >
void random_unitary (Eigen::MatrixBase< DerU > &U, Rng &rng, Log &logger)
 Generate a Haar-distributed random unitary. More...
 
template<typename Der1 , typename Rng >
void random_unitary (Eigen::MatrixBase< Der1 > &U, Rng &rng)
 Overload of random_unitary(U, rng, logger) which discards all logging messages.
 
template<typename Der , typename Rng , typename RndDist , typename... IndexTypes>
auto dense_random (Rng &rng, RndDist &rnddist, IndexTypes...sizes) -> const Eigen::CwiseNullaryOp< tomo_internal::random_generator< Rng, RndDist, typename Eigen::internal::traits< Der >::Scalar >, Der >
 a matrix populated with random entries using C++'s random framework More...
 
template<typename Der , typename IndexType >
auto can_basis_vec (IndexType k, IndexType size) -> const Eigen::CwiseNullaryOp< tomo_internal::can_basis_vec_generator< typename Eigen::internal::traits< Der >::Scalar, IndexType >, Der >
 Expression for the k-th canonical basis vector of given dimension. More...
 
template<typename Der , typename IndexType >
auto can_basis_vec (IndexType k, IndexType j, IndexType rows, IndexType cols) -> const Eigen::CwiseNullaryOp< tomo_internal::can_basis_vec_generator< typename Eigen::internal::traits< Der >::Scalar, IndexType >, Der >
 Expression for the (k,j)-th canonical basis matrix of given dimension. More...
 
template<typename Der , typename... IndexTypes>
auto powers_of_two (IndexTypes...sizes) -> const Eigen::CwiseNullaryOp< tomo_internal::powers_of_two_generator< typename Eigen::internal::traits< Der >::Scalar >, Der >
 Expression for a 1-D expression of powers of two. More...
 
template<int RowFactorCTime, int ColFactorCTime, typename Derived , typename std::enable_if<(RowFactorCTime==Eigen::Dynamic||ColFactorCTime==Eigen::Dynamic), bool >::type dummy = true>
auto replicated (const Eigen::DenseBase< Derived > &x, int row_factor, int col_factor) -> const Eigen::Replicate< Derived, Eigen::Dynamic, Eigen::Dynamic >
 Replicate a Eigen Dense object; same call for compile-time & run-time dimensions. More...
 

Detailed Description

Base namespace for the Tomographer project.

This namespace contains the public API for the Tomographer project template library.

Typedef Documentation

typedef MatrQ<Eigen::Dynamic, Eigen::Dynamic, double, int> Tomographer::DefaultMatrQ

Data types for all arguments set at run-time.

In this convenience typedef the dimension and the maximum number of POVM effects are set at runtime.

You might incur a (very?) slight performance loss due to dynamic memory allocation each time a vector or matrix type is instantiated.

Definition at line 364 of file matrq.h.

typedef MatrQ<2,6,double,int> Tomographer::QubitPaulisMatrQ

Data types for Pauli measurements on a single qubit.

Convenience typedef for the data types corresponding to 6 POVM effects on a 2-level quantum system.

Definition at line 371 of file matrq.h.

Enumeration Type Documentation

anonymous enum
Enumerator
MHUseFnValue 

Provides the MH function value at each point (see Role of UseFnSyntaxType)

MHUseFnLogValue 

Provides the logarithm MH function value at each point (see Role of UseFnSyntaxType)

MHUseFnRelativeValue 

Provides directly the ratio of the function values for two consecutive points of the MH random walk (see Role of UseFnSyntaxType)

Definition at line 153 of file mhrw.h.

Function Documentation

template<typename Der , typename IndexType >
auto Tomographer::can_basis_vec ( IndexType  k,
IndexType  size 
) -> const Eigen::CwiseNullaryOp< tomo_internal::can_basis_vec_generator<typename Eigen::internal::traits<Der>::Scalar, IndexType>, Der >
inline

Expression for the k-th canonical basis vector of given dimension.

Definition at line 271 of file util.h.

template<typename Der , typename IndexType >
auto Tomographer::can_basis_vec ( IndexType  k,
IndexType  j,
IndexType  rows,
IndexType  cols 
) -> const Eigen::CwiseNullaryOp< tomo_internal::can_basis_vec_generator<typename Eigen::internal::traits<Der>::Scalar, IndexType>, Der >
inline

Expression for the (k,j)-th canonical basis matrix of given dimension.

This is a matrix of zeros except for the entry (k,j) which is one.

Definition at line 289 of file util.h.

template<typename Der , typename Rng , typename RndDist , typename... IndexTypes>
auto Tomographer::dense_random ( Rng &  rng,
RndDist &  rnddist,
IndexTypes...  sizes 
) -> const Eigen::CwiseNullaryOp< tomo_internal::random_generator<Rng, RndDist, typename Eigen::internal::traits<Der>::Scalar>, Der >
inline

a matrix populated with random entries using C++'s random framework

Parameters
rngthe std::random generator, such as a std::mt19937 instance
rnddistthe std::random distribution to sample from, such as a std::normal_distribution instance
sizeseither no parameter, one parameter or two parameters specifying the sizes of the dense object to return.

Definition at line 215 of file util.h.

template<typename ValueType , typename Derived , typename Derived2 >
ValueType Tomographer::fidelity ( const Eigen::MatrixBase< Derived > &  rho,
const Eigen::MatrixBase< Derived2 > &  sigma 
)
inline

Fidelity between two density matrices.

Calculates \( F(\rho,\sigma) = \left\Vert\sigma^{1/2}\rho^{1/2}\right\Vert_1 \).

Note
This is the Nielsen & Chuang fidelity, sometimes also called "root fidelity."

Definition at line 52 of file dist.h.

template<typename ValueType , typename Der1 , typename Der2 >
ValueType Tomographer::fidelity_T ( const Eigen::MatrixBase< Der1 > &  T1,
const Eigen::MatrixBase< Der2 > &  T2 
)
inline

Fidelity between two quantum states given by their T Parameterization.

The \( T \) -parameterization of \( \rho \) is a matrix \( T \) which satisfies

\[ \rho = T T^\dagger . \]

This function calculates the same fidelity function as fidelity(), but accepts the T Parameterization of the quantum states instead. The formula used by this function acts directly on the \( T \) 's:

\[ F(T_1 T_1^\dagger, T_2 T_2^\dagger) = \left\Vert\rho^{1/2}\sigma^{1/2}\right\Vert_1 = \left\Vert T_1^\dagger T_2\right\Vert_1 . \]

Note
This is the Nielsen & Chuang fidelity, sometimes also called "root fidelity."

Definition at line 79 of file dist.h.

template<typename HistogramType >
void Tomographer::histogram_pretty_print ( std::ostream str,
const HistogramType &  histogram,
int  max_width = 0 
)
inline

pretty-print the given histogram.

This overload dumps the pretty print into the ostream str.

If max_width <= 0, then the screen width (or default width) minus the given amount in absolute value is used. The negative amount is useful if your line is already occupied by some content.

Definition at line 1026 of file histogram.h.

template<typename HistogramType >
std::string Tomographer::histogram_pretty_print ( const HistogramType &  histogram,
int  max_width = 0 
)
inline

Utility to display histograms for humans.

This version of the function returns a formatted std::string.

If max_width <= 0, then the screen width (or default width) minus the given amount in absolute value is used. The negative amount is useful if your line is already occupied by some content.

Definition at line 1048 of file histogram.h.

template<typename HistogramType >
int Tomographer::histogram_short_bar ( std::ostream str,
const HistogramType &  histogram,
bool  log_scale = true,
int  max_width = 0 
)
inline

Format the histogram as a one-line bar.

Produces a one-line visual representation of the histogram. The histogram is printed in the given std::ostream.

There's no final newline.

If max_width <= 0, then the screen width (or default width) minus the given amount in absolute value is used. The negative amount is useful if your line is already occupied by some content.

Returns
The number of characters which are still left to fill a line with maximal width. More precisely, the maximum width is first determined from max_width and/or from the COLUMNS environment variable. Then histogram is formatted into a bar which fits in this width. The difference between the maximum width and the histogram length is returned.

Definition at line 1073 of file histogram.h.

template<typename HistogramType >
std::string Tomographer::histogram_short_bar ( const HistogramType &  histogram,
bool  log_scale = true,
int  max_width = 0 
)
inline

Format the histogram as a one-line bar.

Produces a one-line visual representation of the histogram. Returns a std::string.

There's no final newline.

If max_width <= 0, then the screen width (or default width) minus the given amount in absolute value is used. The negative amount is useful if your line is already occupied by some content.

Definition at line 1101 of file histogram.h.

template<typename Derived1 , typename Derived2 >
void Tomographer::param_herm_to_x ( Eigen::DenseBase< Derived1 > &  x,
const Eigen::MatrixBase< Derived2 > &  Herm 
)
inline

Get the X-parameterization corresponding to a given hermitian matrix.

See also X Parameterization and param_x_to_herm().

Note
This function only accesses lower triangular part of Herm.
Todo:
Currently, we can't pass an expression as second parameter here. So use Eigen::Ref instead to allow for that, too...

Definition at line 93 of file param_herm_x.h.

template<bool OnlyLowerTri = false, typename Derived1 = Eigen::MatrixXd, typename Derived2 = Eigen::MatrixXd>
void Tomographer::param_x_to_herm ( Eigen::MatrixBase< Derived1 > &  Herm,
const Eigen::DenseBase< Derived2 > &  x 
)
inline

Get the Hermitian matrix parameterized by the "X-parameter" vector x.

This calculates the hermitian matrix which is parameterized by x. See X Parameterization.

Definition at line 53 of file param_herm_x.h.

template<typename Der , typename... IndexTypes>
auto Tomographer::powers_of_two ( IndexTypes...  sizes) -> const Eigen::CwiseNullaryOp< tomo_internal::powers_of_two_generator<typename Eigen::internal::traits<Der>::Scalar>, Der >
inline

Expression for a 1-D expression of powers of two.

An Eigen template expression yielding powers of two as a column vector. The \( i\) -th item is \( 2^i \).

Parameters
sizesYou may either specify the length of the vector (1 parameter), or the size of a column matrix (2 parameters, the second being equal to one).

Definition at line 357 of file util.h.

template<typename DerU , typename Rng , typename Log >
void Tomographer::random_unitary ( Eigen::MatrixBase< DerU > &  U,
Rng &  rng,
Log &  logger 
)
inline

Generate a Haar-distributed random unitary.

Parameters
Ureference to an Eigen type (already sized to a square matrix)
rnga std::random random number generator (such as std::mt19937)
loggera reference to a logger (Logging and Loggers) where we can log what we're doing.

Definition at line 60 of file random_unitary.h.

template<int RowFactorCTime, int ColFactorCTime, typename Derived , typename std::enable_if<(RowFactorCTime==Eigen::Dynamic||ColFactorCTime==Eigen::Dynamic), bool >::type dummy = true>
auto Tomographer::replicated ( const Eigen::DenseBase< Derived > &  x,
int  row_factor,
int  col_factor 
) -> const Eigen::Replicate<Derived, Eigen::Dynamic, Eigen::Dynamic>
inline

Replicate a Eigen Dense object; same call for compile-time & run-time dimensions.

See replicated<RowFactorCTime, ColFactorCTime, Derived, dummy>

Allow our libraries to use the same syntax, for example

Eigen::Matrix<...> m_replicated = replicated<1,ColFactorAtCompileTime>(matrix, 1, col_factor);

for replicating a matrix for which one might, or might not, know the factor at compile time.

The corresponding factor template parameter should be either Eigen::Dynamic or a fixed value. If a fixed value is given, you need to specify the same value in the runtime argument (done as an eigen_assert() check, i.e. this is compiled out if -DNDEBUG is used)

This is the implementation for fixed RowFactorCTime and ColFactorCTime.

Definition at line 394 of file util.h.