Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Functions and operations
[Quantum States and Operations library]

Collaboration diagram for Functions and operations:

Collected useful quantum routines, usually functions of matrices/vectors, or operations on them. More...

Functions

template<class T>
DenseMatrix< T > Commutator (const DenseMatrix< T > &m1, const DenseMatrix< T > &m2)
 Creates a new DenseMatrix containing the commutator of two DenseMatrices: $[A,B] = AB-BA$ .
template<class T>
DenseMatrix< T > AntiCommutator (const DenseMatrix< T > &m1, const DenseMatrix< T > &m2)
 Creates a new DenseMatrix containing the anticommutator of two DenseMatrices: $\{A,B\} = AB+BA$ .
template<class T>
DenseMatrix< T > & scavenge (DenseMatrix< T > &m, typename linalg_traits< T >::abs_type minabs)
 Sets all the entries of m whose absolute value falls below minabs to zero, and returns a reference to the result.
template<class T>
DenseVector< T > & scavenge (DenseVector< T > &v, typename linalg_traits< T >::abs_type minabs)
 Sets all the entries of v whose absolute value falls below minabs to zero, and returns a reference to the result.
template<class T>
DenseMatrix< T > scavenge (const DenseMatrix< T > &m, typename linalg_traits< T >::abs_type minabs)
 Creates a new DenseMatrix which is a scavenged copy of m, and returns it.
template<class T>
DenseVector< T > scavenge (const DenseVector< T > &v, typename linalg_traits< T >::abs_type minabs)
 Creates a new DenseVector which is a scavenged copy of m, and returns it.
double Entropy (Operator &rho)
 Computes the Von Neumann entropy $ H(\rho) = -\mathrm{Tr}\rho\ln\rho $ of the positive semidefinite matrix rho.
double LinearEntropy (Operator &rho)
 Computes the linear entropy $ H(\rho) = 1-\mathrm{Tr}\rho^2 $ of the positive semidefinite matrix rho.
OperatorRandomMixedState (Operator &Rho, itype Nancillae)
 Assigns to Rho a random mixed state from the induced measure on 1+Nancillae copies.
OperatorHaarRandomize (Operator &Rho)
 Assigns to Rho a random pure state. Equivalent to RandomMixedState() with Nancillae=0.
OperatorHilbertSchmidtRandomize (Operator &Rho)
 Assigns to Rho a positive semidefinite matrix selected from Hilbert-Schmidt measure. Equivalent to RandomMixedState() with Nancillae=1.
double TraceNorm (Operator &M)
 Computes the sum of the absolute values of the eigenvalues of a Hermitian matrix M.
double InfinityNorm (Operator &M)
 Computes the square root of the largest eigenvalue of $ M^\dagger M $ . If $ M $ is Hermitian, then this is the maximum of the absolute values of $ M $ 's eigenvalues.
double Fidelity (Operator &Sigma, Operator &Rho)
 Computes the fidelity between two states as $ F = \left[\mathrm{Tr}\sqrt{\sqrt{\rho}\sigma\sqrt{\rho}}\right]^2 $ .
double Fidelity (Operator &Sigma, State &Psi)
 Computes the fidelity between a mixed state $ \sigma $ and a pure state $ \left|\psi\right\rangle $ : $ F = \left\langle\psi\right|\sigma\left|\psi\right\rangle $ .
double Fidelity (State &Psi, Operator &Rho)
 Computes the fidelity between a pure state $ \left|\psi\right\rangle $ and a mixed state a mixed state $ \rho $ : $ F = \left\langle\psi\right|\rho\left|\psi\right\rangle $ .
double Fidelity (State &Psi, State &Phi)
 Computes the fidelity between two pure states $ \left|\phi\right\rangle $ and $ \left|\psi\right\rangle $ : $ F = \left|\left\langle\psi|\phi\right\rangle\right|^2 $ .
double NullspaceProjection (Operator &Sigma, Operator &Rho, double MinProbability=DBL_EPSILON)
 Computes the projection of $ \rho $ onto the nullspace of $ \sigma $ .
double RelativeEntropy (Operator &Sigma, Operator &Rho, double MinProbability=DBL_EPSILON)
 Computes the relative entropy, or Kullback-Leibler divergence, of $ \sigma $ relative to $ \rho $ : $ S(\rho||\sigma) = \mathrm{Tr}\rho\ln\frac{\rho}{\sigma} $.
void RelativeEntropyAndNullProjection (double &RelEnt, double &NullProj, Operator &Sigma, Operator &Rho, double MinProbability)
 Computes the relative entropy of $ \sigma $ relative to $ \rho $ and the projection of $ \rho $ onto $ \sigma $ 's null space.
OperatorPositivize (Operator &M)
 Converts M to a positive-definite matrix by replacing all its negative eigenvalues with 0.
OperatorSquareRoot (Operator &M)
 Replaces the Hermitian positive-definite matrix M with its unique positive-definite square root.
template<class Op>
double Entanglement (const State &psi, const TensorProductStructure &Universe, ISet &SubSystem, Op EntropyFunction)
 Computes the bipartite entanglement of psi between SubSystem and its complement, using the user-supplied EntropyFunction.
double Entanglement (const State &psi, const TensorProductStructure &Universe, ISet &Subsystem)
 Computes the bipartite entanglement of psi between SubSystem and its complement, using Von Neumann entropy.

Detailed Description

Collected useful quantum routines, usually functions of matrices/vectors, or operations on them.


Function Documentation

template<class T>
DenseMatrix< T > & scavenge DenseMatrix< T > &  m,
typename linalg_traits< T >::abs_type  minabs
 

Sets all the entries of m whose absolute value falls below minabs to zero, and returns a reference to the result.

For complex-valued matrices, scavenge acts independently on the real and imaginary components of each entry.

template<class T>
DenseVector< T > & scavenge DenseVector< T > &  v,
typename linalg_traits< T >::abs_type  minabs
 

Sets all the entries of v whose absolute value falls below minabs to zero, and returns a reference to the result.

For complex-valued vectors, scavenge acts independently on the real and imaginary components of each entry.

double Entropy Operator rho  ) 
 

Computes the Von Neumann entropy $ H(\rho) = -\mathrm{Tr}\rho\ln\rho $ of the positive semidefinite matrix rho.

The Von Neumann entropy is computed by diagonalizing the density matrix, and computing the sum of $ -x_i\ln(x_i) $ over all eigenvalues $x_i$. We assume Hermiticity, but we do verify that:

  • rho is square (NxN); violation will cause an error message and failure,
  • Trace(rho) = 1 to within $ 10^{-6}\sqrt{N} $ ; violation will cause a warning to std::cerr,
  • each eigenvalue $ x_i $ is between 0 and 1; violation will cause a warning to std::cerr,
  • the eigenvalues add up to the trace (to within $ 10^{-6}\sqrt{N} $ ); violation will cause a warning to std::cerr. Failure (and an error message) can also be caused by any failure of the (LAPACK) EigenValuesHermitian() routine.

Operator& RandomMixedState Operator Rho,
itype  Nancillae
 

Assigns to Rho a random mixed state from the induced measure on 1+Nancillae copies.

There is no unique measure from which to choose a random mixed state. One appealing class of measures is the set of induced measures obtained by partial-tracing a random pure state (according to Haar measure) on a larger system. This function generates such a state for a D-dimensional system (where D is the size of Rho). The larger system comprises Nancillae + 1 D-dimensional systems.

Warning: be cautious in setting Nancillae too high; generating the state could take huge amounts of memory, increasing exponentially with Nancillae.

double Fidelity Operator Sigma,
Operator Rho
 

Computes the fidelity between two states as $ F = \left[\mathrm{Tr}\sqrt{\sqrt{\rho}\sigma\sqrt{\rho}}\right]^2 $ .

Both arguments must be positive-definite, or the routine will complain to std::cerr and return 0. This routine is rather computationally intensive, so if one of the two states is known to be pure, use the faster routine for that case.

double NullspaceProjection Operator Sigma,
Operator Rho,
double  MinProbability = DBL_EPSILON
 

Computes the projection of $ \rho $ onto the nullspace of $ \sigma $ .

This can be interpreted as the maximum of the probability that an event for which $ \sigma $ predicts zero probability is selected from an ensemble represented by $ \rho $ . Any eigenvalue of $ \sigma $ less than MinProbability will be considered effectively zero for the purposes of computing the null space. MinProbability can therefore be any real number, although the default value is DBL_EPSILON, which is defined in float.h as the smallest number $ \epsilon $ such that $ 1+\epsilon \neq 1 $ in double-precision arithmetic.

double RelativeEntropy Operator Sigma,
Operator Rho,
double  MinProbability = DBL_EPSILON
 

Computes the relative entropy, or Kullback-Leibler divergence, of $ \sigma $ relative to $ \rho $ : $ S(\rho||\sigma) = \mathrm{Tr}\rho\ln\frac{\rho}{\sigma} $.

If $ \sigma $ has zero or negative eigenvalues (which may occur due to rounding error), then the relative entropy will probably be infinite. In order to avoid this, all eigenvalues of $ \sigma $ less than MinProbability will be rounded up to MinProbability. This parameter should always be a positive number; by default it is DBL_EPSILON, which is defined in float.h as the smallest number $ \epsilon $ such that $ 1+\epsilon \neq 1 $ in double-precision arithmetic.

void RelativeEntropyAndNullProjection double &  RelEnt,
double &  NullProj,
Operator Sigma,
Operator Rho,
double  MinProbability
 

Computes the relative entropy of $ \sigma $ relative to $ \rho $ and the projection of $ \rho $ onto $ \sigma $ 's null space.

The results are stored in RelEnt and NullProj, respectively. The parameter MinProbability divides the eigenvalues of $ \sigma $ into:

  • those below MinProbability, which are treated as null space, and
  • those above it, which are used to compute relative entropy.

Operator& SquareRoot Operator M  ) 
 

Replaces the Hermitian positive-definite matrix M with its unique positive-definite square root.

NOTE: if the argument turns out not to be positive-definite, then the result is non-unique, non-Hermitian, and will be constructed by setting $ \sqrt{-1} = i $ . Hermiticity is a precondition; non-Hermitian inputs will lead to undefined results including possible failure.

template<class Op>
double Entanglement const State psi,
const TensorProductStructure Universe,
ISet SubSystem,
Op  EntropyFunction
 

Computes the bipartite entanglement of psi between SubSystem and its complement, using the user-supplied EntropyFunction.

The entropy function should be a function pointer or class such that for a density matrix rho, EntropyFunction( rho ) is well-defined. The entanglement will be computed as the entropy of the reduced density matrix either for SubSystem or for its complement. These are equivalent, thanks to the Schmidt decomposition, provided that EntropyFunction( rho ) is (a) a function only of rho's eigenvalues, and (b) not affected by adding zero eigenvalues.


Generated on Wed Jun 14 22:25:40 2006 for linalg by  doxygen 1.4.4