Quantum++
v1.0
A modern C++11 quantum computing library
|
Quantum++ main namespace. More...
Namespaces | |
exception | |
Quantum++ exception hierarchy namespace. | |
experimental | |
Experimental/test functions/classes, do not use or modify. | |
internal | |
Internal utility functions, do not use them directly or modify them. | |
literals | |
Classes | |
class | Bit_circuit |
Classical reversible circuit simulator. More... | |
class | Codes |
const Singleton class that defines quantum error correcting codes More... | |
class | Dynamic_bitset |
Dynamic bitset class, allows the specification of the number of bits at runtime (unlike std::bitset<N>) More... | |
class | Gates |
const Singleton class that implements most commonly used gates More... | |
class | IDisplay |
Abstract class (interface) that mandates the definition of virtual std::ostream& display(std::ostream& os) const. More... | |
class | Init |
const Singleton class that performs additional initializations/cleanups More... | |
struct | is_complex |
Checks whether the type is a complex type. More... | |
struct | is_complex< std::complex< T > > |
Checks whether the type is a complex number type, specialization for complex types. More... | |
struct | is_iterable |
Checks whether T is compatible with an STL-like iterable container. More... | |
struct | is_iterable< T, to_void< decltype(std::declval< T >().begin()), decltype(std::declval< T >().end()), typename T::value_type > > |
Checks whether T is compatible with an STL-like iterable container, specialization for STL-like iterable containers. More... | |
struct | is_matrix_expression |
Checks whether the type is an Eigen matrix expression. More... | |
struct | make_void |
Helper for qpp::to_void<> alias template. More... | |
class | RandomDevices |
Singleton class that manages the source of randomness in the library. More... | |
class | States |
const Singleton class that implements most commonly used states More... | |
class | Timer |
Chronometer. More... | |
Typedefs | |
template<typename... Ts> | |
using | to_void = typename make_void< Ts... >::type |
Alias template that implements the proposal for void_t. More... | |
using | idx = std::size_t |
Non-negative integer index. More... | |
using | bigint = long long int |
Big integer. More... | |
using | cplx = std::complex< double > |
Complex number in double precision. More... | |
using | ket = Eigen::VectorXcd |
Complex (double precision) dynamic Eigen column vector. More... | |
using | bra = Eigen::RowVectorXcd |
Complex (double precision) dynamic Eigen row vector. More... | |
using | cmat = Eigen::MatrixXcd |
Complex (double precision) dynamic Eigen matrix. More... | |
using | dmat = Eigen::MatrixXd |
Real (double precision) dynamic Eigen matrix. More... | |
template<typename Scalar > | |
using | dyn_mat = Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > |
Dynamic Eigen matrix over the field specified by Scalar. More... | |
template<typename Scalar > | |
using | dyn_col_vect = Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > |
Dynamic Eigen column vector over the field specified by Scalar. More... | |
template<typename Scalar > | |
using | dyn_row_vect = Eigen::Matrix< Scalar, 1, Eigen::Dynamic > |
Dynamic Eigen row vector over the field specified by Scalar. More... | |
Functions | |
constexpr cplx | operator"" _i (long double x) noexcept |
User-defined literal for complex ![]() | |
cplx | omega (idx D) |
D-th root of unity. More... | |
template<typename Derived > | |
dyn_col_vect< double > | schmidtcoeffs (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims) |
Schmidt coefficients of the bi-partite pure state A. More... | |
template<typename Derived > | |
dyn_col_vect< double > | schmidtcoeffs (const Eigen::MatrixBase< Derived > &A, idx d=2) |
Schmidt coefficients of the bi-partite pure state A. More... | |
template<typename Derived > | |
cmat | schmidtA (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims) |
Schmidt basis on Alice side. More... | |
template<typename Derived > | |
cmat | schmidtA (const Eigen::MatrixBase< Derived > &A, idx d=2) |
Schmidt basis on Alice side. More... | |
template<typename Derived > | |
cmat | schmidtB (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims) |
Schmidt basis on Bob side. More... | |
template<typename Derived > | |
cmat | schmidtB (const Eigen::MatrixBase< Derived > &A, idx d=2) |
Schmidt basis on Bob side. More... | |
template<typename Derived > | |
std::vector< double > | schmidtprobs (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims) |
Schmidt probabilities of the bi-partite pure state A. More... | |
template<typename Derived > | |
std::vector< double > | schmidtprobs (const Eigen::MatrixBase< Derived > &A, idx d=2) |
Schmidt probabilities of the bi-partite pure state A. More... | |
template<typename Derived > | |
double | entanglement (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims) |
Entanglement of the bi-partite pure state A. More... | |
template<typename Derived > | |
double | entanglement (const Eigen::MatrixBase< Derived > &A, idx d=2) |
Entanglement of the bi-partite pure state A. More... | |
template<typename Derived > | |
double | gconcurrence (const Eigen::MatrixBase< Derived > &A) |
G-concurrence of the bi-partite pure state A. More... | |
template<typename Derived > | |
double | negativity (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims) |
Negativity of the bi-partite mixed state A. More... | |
template<typename Derived > | |
double | negativity (const Eigen::MatrixBase< Derived > &A, idx d=2) |
Negativity of the bi-partite mixed state A. More... | |
template<typename Derived > | |
double | lognegativity (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims) |
Logarithmic negativity of the bi-partite mixed state A. More... | |
template<typename Derived > | |
double | lognegativity (const Eigen::MatrixBase< Derived > &A, idx d=2) |
Logarithmic negativity of the bi-partite mixed state A. More... | |
template<typename Derived > | |
double | concurrence (const Eigen::MatrixBase< Derived > &A) |
Wootters concurrence of the bi-partite qubit mixed state A. More... | |
template<typename Derived > | |
double | entropy (const Eigen::MatrixBase< Derived > &A) |
von-Neumann entropy of the density matrix A More... | |
double | entropy (const std::vector< double > &prob) |
Shannon entropy of the probability distribution prob. More... | |
template<typename Derived > | |
double | renyi (const Eigen::MatrixBase< Derived > &A, double alpha) |
Renyi- ![]() ![]() | |
double | renyi (const std::vector< double > &prob, double alpha) |
Renyi- ![]() ![]() | |
template<typename Derived > | |
double | tsallis (const Eigen::MatrixBase< Derived > &A, double q) |
Tsallis- ![]() ![]() | |
double | tsallis (const std::vector< double > &prob, double q) |
Tsallis- ![]() ![]() | |
template<typename Derived > | |
double | qmutualinfo (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &subsysA, const std::vector< idx > &subsysB, const std::vector< idx > &dims) |
Quantum mutual information between 2 subsystems of a composite system. More... | |
template<typename Derived > | |
double | qmutualinfo (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &subsysA, const std::vector< idx > &subsysB, idx d=2) |
Quantum mutual information between 2 subsystems of a composite system. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | transpose (const Eigen::MatrixBase< Derived > &A) |
Transpose. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | conjugate (const Eigen::MatrixBase< Derived > &A) |
Complex conjugate. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | adjoint (const Eigen::MatrixBase< Derived > &A) |
Adjoint. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | inverse (const Eigen::MatrixBase< Derived > &A) |
Inverse. More... | |
template<typename Derived > | |
Derived::Scalar | trace (const Eigen::MatrixBase< Derived > &A) |
Trace. More... | |
template<typename Derived > | |
Derived::Scalar | det (const Eigen::MatrixBase< Derived > &A) |
Determinant. More... | |
template<typename Derived > | |
Derived::Scalar | logdet (const Eigen::MatrixBase< Derived > &A) |
Logarithm of the determinant. More... | |
template<typename Derived > | |
Derived::Scalar | sum (const Eigen::MatrixBase< Derived > &A) |
Element-wise sum of A. More... | |
template<typename Derived > | |
Derived::Scalar | prod (const Eigen::MatrixBase< Derived > &A) |
Element-wise product of A. More... | |
template<typename Derived > | |
double | norm (const Eigen::MatrixBase< Derived > &A) |
Frobenius norm. More... | |
template<typename Derived > | |
std::pair< dyn_col_vect< cplx >, cmat > | eig (const Eigen::MatrixBase< Derived > &A) |
Full eigen decomposition. More... | |
template<typename Derived > | |
dyn_col_vect< cplx > | evals (const Eigen::MatrixBase< Derived > &A) |
Eigenvalues. More... | |
template<typename Derived > | |
cmat | evects (const Eigen::MatrixBase< Derived > &A) |
Eigenvectors. More... | |
template<typename Derived > | |
std::pair< dyn_col_vect< double >, cmat > | heig (const Eigen::MatrixBase< Derived > &A) |
Full eigen decomposition of Hermitian expression. More... | |
template<typename Derived > | |
dyn_col_vect< double > | hevals (const Eigen::MatrixBase< Derived > &A) |
Hermitian eigenvalues. More... | |
template<typename Derived > | |
cmat | hevects (const Eigen::MatrixBase< Derived > &A) |
Hermitian eigenvectors. More... | |
template<typename Derived > | |
std::tuple< cmat, dyn_col_vect< double >, cmat > | svd (const Eigen::MatrixBase< Derived > &A) |
Full singular value decomposition. More... | |
template<typename Derived > | |
dyn_col_vect< double > | svals (const Eigen::MatrixBase< Derived > &A) |
Singular values. More... | |
template<typename Derived > | |
cmat | svdU (const Eigen::MatrixBase< Derived > &A) |
Left singular vectors. More... | |
template<typename Derived > | |
cmat | svdV (const Eigen::MatrixBase< Derived > &A) |
Right singular vectors. More... | |
template<typename Derived > | |
cmat | funm (const Eigen::MatrixBase< Derived > &A, cplx(*f)(const cplx &)) |
Functional calculus f(A) More... | |
template<typename Derived > | |
cmat | sqrtm (const Eigen::MatrixBase< Derived > &A) |
Matrix square root. More... | |
template<typename Derived > | |
cmat | absm (const Eigen::MatrixBase< Derived > &A) |
Matrix absolute value. More... | |
template<typename Derived > | |
cmat | expm (const Eigen::MatrixBase< Derived > &A) |
Matrix exponential. More... | |
template<typename Derived > | |
cmat | logm (const Eigen::MatrixBase< Derived > &A) |
Matrix logarithm. More... | |
template<typename Derived > | |
cmat | sinm (const Eigen::MatrixBase< Derived > &A) |
Matrix sin. More... | |
template<typename Derived > | |
cmat | cosm (const Eigen::MatrixBase< Derived > &A) |
Matrix cos. More... | |
template<typename Derived > | |
cmat | spectralpowm (const Eigen::MatrixBase< Derived > &A, const cplx z) |
Matrix power. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | powm (const Eigen::MatrixBase< Derived > &A, idx n) |
Fast matrix power based on the SQUARE-AND-MULTIPLY algorithm. More... | |
template<typename Derived > | |
double | schatten (const Eigen::MatrixBase< Derived > &A, double p) |
Schatten matrix norm. More... | |
template<typename OutputScalar , typename Derived > | |
dyn_mat< OutputScalar > | cwise (const Eigen::MatrixBase< Derived > &A, OutputScalar(*f)(const typename Derived::Scalar &)) |
Functor. More... | |
template<typename T > | |
dyn_mat< typename T::Scalar > | kron (const T &head) |
Kronecker product. More... | |
template<typename T , typename... Args> | |
dyn_mat< typename T::Scalar > | kron (const T &head, const Args &... tail) |
Kronecker product. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | kron (const std::vector< Derived > &As) |
Kronecker product. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | kron (const std::initializer_list< Derived > &As) |
Kronecker product. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | kronpow (const Eigen::MatrixBase< Derived > &A, idx n) |
Kronecker power. More... | |
template<typename T > | |
dyn_mat< typename T::Scalar > | dirsum (const T &head) |
Direct sum. More... | |
template<typename T , typename... Args> | |
dyn_mat< typename T::Scalar > | dirsum (const T &head, const Args &... tail) |
Direct sum. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | dirsum (const std::vector< Derived > &As) |
Direct sum. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | dirsum (const std::initializer_list< Derived > &As) |
Direct sum. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | dirsumpow (const Eigen::MatrixBase< Derived > &A, idx n) |
Direct sum power. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | reshape (const Eigen::MatrixBase< Derived > &A, idx rows, idx cols) |
Reshape. More... | |
template<typename Derived1 , typename Derived2 > | |
dyn_mat< typename Derived1::Scalar > | comm (const Eigen::MatrixBase< Derived1 > &A, const Eigen::MatrixBase< Derived2 > &B) |
Commutator. More... | |
template<typename Derived1 , typename Derived2 > | |
dyn_mat< typename Derived1::Scalar > | anticomm (const Eigen::MatrixBase< Derived1 > &A, const Eigen::MatrixBase< Derived2 > &B) |
Anti-commutator. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | prj (const Eigen::MatrixBase< Derived > &A) |
Projector. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | grams (const std::vector< Derived > &As) |
Gram-Schmidt orthogonalization. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | grams (const std::initializer_list< Derived > &As) |
Gram-Schmidt orthogonalization. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | grams (const Eigen::MatrixBase< Derived > &A) |
Gram-Schmidt orthogonalization. More... | |
std::vector< idx > | n2multiidx (idx n, const std::vector< idx > &dims) |
Non-negative integer index to multi-index. More... | |
idx | multiidx2n (const std::vector< idx > &midx, const std::vector< idx > &dims) |
Multi-index to non-negative integer index. More... | |
ket | mket (const std::vector< idx > &mask, const std::vector< idx > &dims) |
Multi-partite qudit ket. More... | |
ket | mket (const std::vector< idx > &mask, idx d=2) |
Multi-partite qudit ket. More... | |
cmat | mprj (const std::vector< idx > &mask, const std::vector< idx > &dims) |
Projector onto multi-partite qudit ket. More... | |
cmat | mprj (const std::vector< idx > &mask, idx d=2) |
Projector onto multi-partite qudit ket. More... | |
template<typename InputIterator > | |
std::vector< double > | abssq (InputIterator first, InputIterator last) |
Computes the absolute values squared of an STL-like range of complex numbers. More... | |
template<typename Container > | |
std::vector< double > | abssq (const Container &c, typename std::enable_if< is_iterable< Container >::value >::type *=nullptr) |
Computes the absolute values squared of an STL-like container. More... | |
template<typename Derived > | |
std::vector< double > | abssq (const Eigen::MatrixBase< Derived > &A) |
Computes the absolute values squared of an Eigen expression. More... | |
template<typename InputIterator > | |
std::iterator_traits< InputIterator >::value_type | sum (InputIterator first, InputIterator last) |
Element-wise sum of an STL-like range. More... | |
template<typename Container > | |
Container::value_type | sum (const Container &c, typename std::enable_if< is_iterable< Container >::value >::type *=nullptr) |
Element-wise sum of the elements of an STL-like container. More... | |
template<typename InputIterator > | |
std::iterator_traits< InputIterator >::value_type | prod (InputIterator first, InputIterator last) |
Element-wise product of an STL-like range. More... | |
template<typename Container > | |
Container::value_type | prod (const Container &c, typename std::enable_if< is_iterable< Container >::value >::type *=nullptr) |
Element-wise product of the elements of an STL-like container. More... | |
template<typename Derived > | |
dyn_col_vect< typename Derived::Scalar > | rho2pure (const Eigen::MatrixBase< Derived > &A) |
Finds the pure state representation of a matrix proportional to a projector onto a pure state. More... | |
template<typename T > | |
std::vector< T > | complement (std::vector< T > subsys, idx N) |
Constructs the complement of a subsystem vector. More... | |
template<typename Derived > | |
std::vector< double > | rho2bloch (const Eigen::MatrixBase< Derived > &A) |
Computes the 3-dimensional real Bloch vector corresponding to the qubit density matrix A. More... | |
cmat | bloch2rho (const std::vector< double > &r) |
Computes the density matrix corresponding to the 3-dimensional real Bloch vector r. More... | |
template<typename Derived > | |
internal::IOManipEigen | disp (const Eigen::MatrixBase< Derived > &A, double chop=qpp::chop) |
Eigen expression ostream manipulator. More... | |
internal::IOManipEigen | disp (cplx z, double chop=qpp::chop) |
Complex number ostream manipulator. More... | |
template<typename InputIterator > | |
internal::IOManipRange< InputIterator > | disp (InputIterator first, InputIterator last, const std::string &separator, const std::string &start="[", const std::string &end="]") |
Range ostream manipulator. More... | |
template<typename Container > | |
internal::IOManipRange< typename Container::const_iterator > | disp (const Container &c, const std::string &separator, const std::string &start="[", const std::string &end="]", typename std::enable_if< is_iterable< Container >::value >::type *=nullptr) |
Standard container ostream manipulator. The container must support std::begin(), std::end() and forward iteration. More... | |
template<typename PointerType > | |
internal::IOManipPointer< PointerType > | disp (const PointerType *p, idx N, const std::string &separator, const std::string &start="[", const std::string &end="]") |
C-style pointer ostream manipulator. More... | |
template<typename Derived > | |
void | save (const Eigen::MatrixBase< Derived > &A, const std::string &fname) |
Saves Eigen expression to a binary file (internal format) in double precision. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | load (const std::string &fname) |
Loads Eigen matrix from a binary file (internal format) in double precision. More... | |
template<typename Derived > | |
dyn_col_vect< typename Derived::Scalar > | ip (const Eigen::MatrixBase< Derived > &phi, const Eigen::MatrixBase< Derived > &psi, const std::vector< idx > &subsys, const std::vector< idx > &dims) |
Generalized inner product. More... | |
template<typename Derived > | |
dyn_col_vect< typename Derived::Scalar > | ip (const Eigen::MatrixBase< Derived > &phi, const Eigen::MatrixBase< Derived > &psi, const std::vector< idx > &subsys, idx d=2) |
Generalized inner product. More... | |
template<typename Derived > | |
std::tuple< idx, std::vector< double >, std::vector< cmat > > | measure (const Eigen::MatrixBase< Derived > &A, const std::vector< cmat > &Ks) |
Measures the state A using the set of Kraus operators Ks. More... | |
template<typename Derived > | |
std::tuple< idx, std::vector< double >, std::vector< cmat > > | measure (const Eigen::MatrixBase< Derived > &A, const std::initializer_list< cmat > &Ks) |
Measures the state A using the set of Kraus operators Ks. More... | |
template<typename Derived > | |
std::tuple< idx, std::vector< double >, std::vector< cmat > > | measure (const Eigen::MatrixBase< Derived > &A, const cmat &U) |
Measures the state A in the orthonormal basis specified by the unitary matrix U. More... | |
template<typename Derived > | |
std::tuple< idx, std::vector< double >, std::vector< cmat > > | measure (const Eigen::MatrixBase< Derived > &A, const std::vector< cmat > &Ks, const std::vector< idx > &subsys, const std::vector< idx > &dims) |
Measures the part subsys of the multi-partite state vector or density matrix A using the set of Kraus operators Ks. More... | |
template<typename Derived > | |
std::tuple< idx, std::vector< double >, std::vector< cmat > > | measure (const Eigen::MatrixBase< Derived > &A, const std::initializer_list< cmat > &Ks, const std::vector< idx > &subsys, const std::vector< idx > &dims) |
Measures the part subsys of the multi-partite state vector or density matrix A using the set of Kraus operators Ks. More... | |
template<typename Derived > | |
std::tuple< idx, std::vector< double >, std::vector< cmat > > | measure (const Eigen::MatrixBase< Derived > &A, const std::vector< cmat > &Ks, const std::vector< idx > &subsys, idx d=2) |
Measures the part subsys of the multi-partite state vector or density matrix A using the set of Kraus operators Ks. More... | |
template<typename Derived > | |
std::tuple< idx, std::vector< double >, std::vector< cmat > > | measure (const Eigen::MatrixBase< Derived > &A, const std::initializer_list< cmat > &Ks, const std::vector< idx > &subsys, idx d=2) |
Measures the part subsys of the multi-partite state vector or density matrix A using the set of Kraus operators Ks. More... | |
template<typename Derived > | |
std::tuple< idx, std::vector< double >, std::vector< cmat > > | measure (const Eigen::MatrixBase< Derived > &A, const cmat &V, const std::vector< idx > &subsys, const std::vector< idx > &dims) |
Measures the part subsys of the multi-partite state vector or density matrix A in the orthonormal basis or rank-1 POVM specified by the matrix V. More... | |
template<typename Derived > | |
std::tuple< idx, std::vector< double >, std::vector< cmat > > | measure (const Eigen::MatrixBase< Derived > &A, const cmat &V, const std::vector< idx > &subsys, idx d=2) |
Measures the part subsys of the multi-partite state vector or density matrix A in the orthonormal basis or rank-1 POVM specified by the matrix V. More... | |
template<typename Derived > | |
std::tuple< std::vector< idx >, double, cmat > | measure_seq (const Eigen::MatrixBase< Derived > &A, std::vector< idx > subsys, std::vector< idx > dims) |
Sequentially measures the part subsys of the multi-partite state vector or density matrix A in the computational basis. More... | |
template<typename Derived > | |
std::tuple< std::vector< idx >, double, cmat > | measure_seq (const Eigen::MatrixBase< Derived > &A, std::vector< idx > subsys, idx d=2) |
Sequentially measures the part subsys of the multi-partite state vector or density matrix A in the computational basis. More... | |
template<typename Derived > | |
std::enable_if< std::is_same< typename Derived::Scalar, cplx >::value, dyn_mat< cplx > >::type | loadMATLAB (const std::string &mat_file, const std::string &var_name) |
Loads a complex Eigen dynamic matrix from a MATLAB .mat file,. More... | |
template<typename Derived > | |
std::enable_if<!std::is_same< typename Derived::Scalar, cplx >::value, dyn_mat< typename Derived::Scalar > >::type | loadMATLAB (const std::string &mat_file, const std::string &var_name) |
Loads a non-complex Eigen dynamic matrix from a MATLAB .mat file,. More... | |
template<typename Derived > | |
std::enable_if< std::is_same< typename Derived::Scalar, cplx >::value >::type | saveMATLAB (const Eigen::MatrixBase< Derived > &A, const std::string &mat_file, const std::string &var_name, const std::string &mode) |
Saves a complex Eigen dynamic matrix to a MATLAB .mat file,. More... | |
template<typename Derived > | |
std::enable_if< !std::is_same< typename Derived::Scalar, cplx >::value >::type | saveMATLAB (const Eigen::MatrixBase< Derived > &A, const std::string &mat_file, const std::string &var_name, const std::string &mode) |
Saves a non-complex Eigen dynamic matrix to a MATLAB .mat file,. More... | |
std::vector< int > | x2contfrac (double x, idx N, idx cut=1e5) |
Simple continued fraction expansion. More... | |
double | contfrac2x (const std::vector< int > &cf, idx N=idx(-1)) |
Real representation of a simple continued fraction. More... | |
bigint | gcd (bigint a, bigint b) |
Greatest common divisor of two integers. More... | |
bigint | gcd (const std::vector< bigint > &as) |
Greatest common divisor of a list of integers. More... | |
bigint | lcm (bigint a, bigint b) |
Least common multiple of two integers. More... | |
bigint | lcm (const std::vector< bigint > &as) |
Least common multiple of a list of integers. More... | |
std::vector< idx > | invperm (const std::vector< idx > &perm) |
Inverse permutation. More... | |
std::vector< idx > | compperm (const std::vector< idx > &perm, const std::vector< idx > &sigma) |
Compose permutations. More... | |
std::vector< bigint > | factors (bigint a) |
Prime factor decomposition. More... | |
bigint | modmul (bigint a, bigint b, bigint p) |
Modular multiplication without overflow. More... | |
bigint | modpow (bigint a, bigint n, bigint p) |
Fast integer power modulo p based on the SQUARE-AND-MULTIPLY algorithm. More... | |
std::tuple< bigint, bigint, bigint > | egcd (bigint a, bigint b) |
Extended greatest common divisor of two integers. More... | |
bigint | modinv (bigint a, bigint p) |
Modular inverse of a mod p. More... | |
bool | isprime (bigint p, idx k=80) |
Primality test based on the Miller-Rabin's algorithm. More... | |
bigint | randprime (bigint a, bigint b, idx N=1000) |
Generates a random big prime uniformly distributed in the interval [a, b]. More... | |
template<typename Derived1 , typename Derived2 > | |
dyn_mat< typename Derived1::Scalar > | applyCTRL (const Eigen::MatrixBase< Derived1 > &state, const Eigen::MatrixBase< Derived2 > &A, const std::vector< idx > &ctrl, const std::vector< idx > &subsys, const std::vector< idx > &dims) |
Applies the controlled-gate A to the part subsys of the multi-partite state vector or density matrix state. More... | |
template<typename Derived1 , typename Derived2 > | |
dyn_mat< typename Derived1::Scalar > | applyCTRL (const Eigen::MatrixBase< Derived1 > &state, const Eigen::MatrixBase< Derived2 > &A, const std::vector< idx > &ctrl, const std::vector< idx > &subsys, idx d=2) |
Applies the controlled-gate A to the part subsys of the multi-partite state vector or density matrix state. More... | |
template<typename Derived1 , typename Derived2 > | |
dyn_mat< typename Derived1::Scalar > | apply (const Eigen::MatrixBase< Derived1 > &state, const Eigen::MatrixBase< Derived2 > &A, const std::vector< idx > &subsys, const std::vector< idx > &dims) |
Applies the gate A to the part subsys of the multi-partite state vector or density matrix state. More... | |
template<typename Derived1 , typename Derived2 > | |
dyn_mat< typename Derived1::Scalar > | apply (const Eigen::MatrixBase< Derived1 > &state, const Eigen::MatrixBase< Derived2 > &A, const std::vector< idx > &subsys, idx d=2) |
Applies the gate A to the part subsys of the multi-partite state vector or density matrix state. More... | |
template<typename Derived > | |
cmat | apply (const Eigen::MatrixBase< Derived > &A, const std::vector< cmat > &Ks) |
Applies the channel specified by the set of Kraus operators Ks to the density matrix A. More... | |
template<typename Derived > | |
cmat | apply (const Eigen::MatrixBase< Derived > &A, const std::vector< cmat > &Ks, const std::vector< idx > &subsys, const std::vector< idx > &dims) |
Applies the channel specified by the set of Kraus operators Ks to the part subsys of the multi-partite density matrix A. More... | |
template<typename Derived > | |
cmat | apply (const Eigen::MatrixBase< Derived > &A, const std::vector< cmat > &Ks, const std::vector< idx > &subsys, idx d=2) |
Applies the channel specified by the set of Kraus operators Ks to the part subsys of the multi-partite density matrix A. More... | |
cmat | kraus2super (const std::vector< cmat > &Ks) |
Superoperator matrix. More... | |
cmat | kraus2choi (const std::vector< cmat > &Ks) |
Choi matrix. More... | |
std::vector< cmat > | choi2kraus (const cmat &A) |
Orthogonal Kraus operators from Choi matrix. More... | |
cmat | choi2super (const cmat &A) |
Converts Choi matrix to superoperator matrix. More... | |
cmat | super2choi (const cmat &A) |
Converts superoperator matrix to Choi matrix. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | ptrace1 (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims) |
Partial trace. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | ptrace1 (const Eigen::MatrixBase< Derived > &A, idx d=2) |
Partial trace. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | ptrace2 (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &dims) |
Partial trace. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | ptrace2 (const Eigen::MatrixBase< Derived > &A, idx d=2) |
Partial trace. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | ptrace (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &subsys, const std::vector< idx > &dims) |
Partial trace. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | ptrace (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &subsys, idx d=2) |
Partial trace. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | ptranspose (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &subsys, const std::vector< idx > &dims) |
Partial transpose. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | ptranspose (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &subsys, idx d=2) |
Partial transpose. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | syspermute (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &perm, const std::vector< idx > &dims) |
Subsystem permutation. More... | |
template<typename Derived > | |
dyn_mat< typename Derived::Scalar > | syspermute (const Eigen::MatrixBase< Derived > &A, const std::vector< idx > &perm, idx d=2) |
Subsystem permutation. More... | |
double | rand (double a, double b) |
Generates a random real number uniformly distributed in the interval [a, b) More... | |
bigint | rand (bigint a, bigint b) |
Generates a random big integer uniformly distributed in the interval [a, b]. More... | |
idx | randidx (idx a=std::numeric_limits< idx >::min(), idx b=std::numeric_limits< idx >::max()) |
Generates a random index (idx) uniformly distributed in the interval [a, b]. More... | |
template<typename Derived > | |
Derived | rand (idx rows, idx cols, double a=0, double b=1) |
Generates a random matrix with entries uniformly distributed in the interval [a, b) More... | |
template<> | |
dmat | rand (idx rows, idx cols, double a, double b) |
Generates a random real matrix with entries uniformly distributed in the interval [a, b), specialization for double matrices (qpp::dmat) More... | |
template<> | |
cmat | rand (idx rows, idx cols, double a, double b) |
Generates a random complex matrix with entries (both real and imaginary) uniformly distributed in the interval [a, b), specialization for complex matrices (qpp::cmat) More... | |
template<typename Derived > | |
Derived | randn (idx rows, idx cols, double mean=0, double sigma=1) |
Generates a random matrix with entries normally distributed in N(mean, sigma) More... | |
template<> | |
dmat | randn (idx rows, idx cols, double mean, double sigma) |
Generates a random real matrix with entries normally distributed in N(mean, sigma), specialization for double matrices (qpp::dmat) More... | |
template<> | |
cmat | randn (idx rows, idx cols, double mean, double sigma) |
Generates a random complex matrix with entries (both real and imaginary) normally distributed in N(mean, sigma), specialization for complex matrices (qpp::cmat) More... | |
double | randn (double mean=0, double sigma=1) |
Generates a random real number (double) normally distributed in N(mean, sigma) More... | |
cmat | randU (idx D=2) |
Generates a random unitary matrix. More... | |
cmat | randV (idx Din, idx Dout) |
Generates a random isometry matrix. More... | |
std::vector< cmat > | randkraus (idx N, idx D=2) |
Generates a set of random Kraus operators. More... | |
cmat | randH (idx D=2) |
Generates a random Hermitian matrix. More... | |
ket | randket (idx D=2) |
Generates a random normalized ket (pure state vector) More... | |
cmat | randrho (idx D=2) |
Generates a random density matrix. More... | |
std::vector< idx > | randperm (idx N) |
Generates a random uniformly distributed permutation. More... | |
std::vector< double > | randprob (idx N) |
Generates a random probability vector uniformly distributed over the probability simplex. More... | |
std::vector< double > | uniform (idx N) |
Uniform probability distribution vector. More... | |
std::vector< double > | marginalX (const dmat &probXY) |
Marginal distribution. More... | |
std::vector< double > | marginalY (const dmat &probXY) |
Marginal distribution. More... | |
template<typename Container > | |
double | avg (const std::vector< double > &prob, const Container &X, typename std::enable_if< is_iterable< Container >::value >::type *=nullptr) |
Average. More... | |
template<typename Container > | |
double | cov (const dmat &probXY, const Container &X, const Container &Y, typename std::enable_if< is_iterable< Container >::value >::type *=nullptr) |
Covariance. More... | |
template<typename Container > | |
double | var (const std::vector< double > &prob, const Container &X, typename std::enable_if< is_iterable< Container >::value >::type *=nullptr) |
Variance. More... | |
template<typename Container > | |
double | sigma (const std::vector< double > &prob, const Container &X, typename std::enable_if< is_iterable< Container >::value >::type *=nullptr) |
Standard deviation. More... | |
template<typename Container > | |
double | cor (const dmat &probXY, const Container &X, const Container &Y, typename std::enable_if< is_iterable< Container >::value >::type *=nullptr) |
Correlation. More... | |
Variables | |
constexpr double | chop = 1e-10 |
Used in qpp::disp() for setting to zero numbers that have their absolute value smaller than qpp::chop. More... | |
constexpr double | eps = 1e-12 |
Used to decide whether a number or expression in double precision is zero or not. More... | |
constexpr idx | maxn = 64 |
Maximum number of allowed qubits/qudits (subsystems) More... | |
constexpr double | pi = 3.141592653589793238462643383279502884 |
![]() | |
constexpr double | ee = 2.718281828459045235360287471352662497 |
Base of natural logarithm, ![]() | |
constexpr double | infty = std::numeric_limits<double>::max() |
Used to denote infinity in double precision. More... | |
Quantum++ main namespace.
using qpp::bigint = typedef long long int |
Big integer.
using qpp::bra = typedef Eigen::RowVectorXcd |
Complex (double precision) dynamic Eigen row vector.
using qpp::cmat = typedef Eigen::MatrixXcd |
Complex (double precision) dynamic Eigen matrix.
using qpp::cplx = typedef std::complex<double> |
Complex number in double precision.
using qpp::dmat = typedef Eigen::MatrixXd |
Real (double precision) dynamic Eigen matrix.
using qpp::dyn_col_vect = typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> |
Dynamic Eigen column vector over the field specified by Scalar.
Example:
using qpp::dyn_mat = typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> |
Dynamic Eigen matrix over the field specified by Scalar.
Example:
using qpp::dyn_row_vect = typedef Eigen::Matrix<Scalar, 1, Eigen::Dynamic> |
Dynamic Eigen row vector over the field specified by Scalar.
Example:
using qpp::idx = typedef std::size_t |
Non-negative integer index.
using qpp::ket = typedef Eigen::VectorXcd |
Complex (double precision) dynamic Eigen column vector.
using qpp::to_void = typedef typename make_void<Ts...>::type |
Alias template that implements the proposal for void_t.
cmat qpp::absm | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Matrix absolute value.
A | Eigen expression |
std::vector<double> qpp::abssq | ( | InputIterator | first, |
InputIterator | last | ||
) |
Computes the absolute values squared of an STL-like range of complex numbers.
first | Iterator to the first element of the range |
last | Iterator to the last element of the range |
std::vector<double> qpp::abssq | ( | const Container & | c, |
typename std::enable_if< is_iterable< Container >::value >::type * | = nullptr |
||
) |
Computes the absolute values squared of an STL-like container.
c | STL-like container |
std::vector<double> qpp::abssq | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Computes the absolute values squared of an Eigen expression.
A | Eigen expression |
dyn_mat<typename Derived::Scalar> qpp::adjoint | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Adjoint.
A | Eigen expression |
dyn_mat<typename Derived1::Scalar> qpp::anticomm | ( | const Eigen::MatrixBase< Derived1 > & | A, |
const Eigen::MatrixBase< Derived2 > & | B | ||
) |
Anti-commutator.
Anti-commutator . Both A and B must be Eigen expressions over the same scalar field.
A | Eigen expression |
B | Eigen expression |
dyn_mat<typename Derived1::Scalar> qpp::apply | ( | const Eigen::MatrixBase< Derived1 > & | state, |
const Eigen::MatrixBase< Derived2 > & | A, | ||
const std::vector< idx > & | subsys, | ||
const std::vector< idx > & | dims | ||
) |
Applies the gate A to the part subsys of the multi-partite state vector or density matrix state.
state | Eigen expression |
A | Eigen expression |
subsys | Subsystem indexes where the gate A is applied |
dims | Dimensions of the multi-partite system |
dyn_mat<typename Derived1::Scalar> qpp::apply | ( | const Eigen::MatrixBase< Derived1 > & | state, |
const Eigen::MatrixBase< Derived2 > & | A, | ||
const std::vector< idx > & | subsys, | ||
idx | d = 2 |
||
) |
Applies the gate A to the part subsys of the multi-partite state vector or density matrix state.
state | Eigen expression |
A | Eigen expression |
subsys | Subsystem indexes where the gate A is applied |
d | Subsystem dimensions |
cmat qpp::apply | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< cmat > & | Ks | ||
) |
Applies the channel specified by the set of Kraus operators Ks to the density matrix A.
A | Eigen expression |
Ks | Set of Kraus operators |
cmat qpp::apply | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< cmat > & | Ks, | ||
const std::vector< idx > & | subsys, | ||
const std::vector< idx > & | dims | ||
) |
Applies the channel specified by the set of Kraus operators Ks to the part subsys of the multi-partite density matrix A.
A | Eigen expression |
Ks | Set of Kraus operators |
subsys | Subsystem indexes where the Kraus operators Ks are applied |
dims | Dimensions of the multi-partite system |
cmat qpp::apply | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< cmat > & | Ks, | ||
const std::vector< idx > & | subsys, | ||
idx | d = 2 |
||
) |
Applies the channel specified by the set of Kraus operators Ks to the part subsys of the multi-partite density matrix A.
A | Eigen expression |
Ks | Set of Kraus operators |
subsys | Subsystem indexes where the Kraus operators Ks are applied |
d | Subsystem dimensions |
dyn_mat<typename Derived1::Scalar> qpp::applyCTRL | ( | const Eigen::MatrixBase< Derived1 > & | state, |
const Eigen::MatrixBase< Derived2 > & | A, | ||
const std::vector< idx > & | ctrl, | ||
const std::vector< idx > & | subsys, | ||
const std::vector< idx > & | dims | ||
) |
Applies the controlled-gate A to the part subsys of the multi-partite state vector or density matrix state.
state | Eigen expression |
A | Eigen expression |
ctrl | Control subsystem indexes |
subsys | Subsystem indexes where the gate A is applied |
dims | Dimensions of the multi-partite system |
dyn_mat<typename Derived1::Scalar> qpp::applyCTRL | ( | const Eigen::MatrixBase< Derived1 > & | state, |
const Eigen::MatrixBase< Derived2 > & | A, | ||
const std::vector< idx > & | ctrl, | ||
const std::vector< idx > & | subsys, | ||
idx | d = 2 |
||
) |
Applies the controlled-gate A to the part subsys of the multi-partite state vector or density matrix state.
state | Eigen expression |
A | Eigen expression |
ctrl | Control subsystem indexes |
subsys | Subsystem indexes where the gate A is applied |
d | Subsystem dimensions |
double qpp::avg | ( | const std::vector< double > & | prob, |
const Container & | X, | ||
typename std::enable_if< is_iterable< Container >::value >::type * | = nullptr |
||
) |
Average.
prob | Real probability vector representing the probability distribution of X |
X | Real random variable values represented by an STL-like container |
|
inline |
Computes the density matrix corresponding to the 3-dimensional real Bloch vector r.
r | 3-dimensional real vector |
Orthogonal Kraus operators from Choi matrix.
Extracts a set of orthogonal (under Hilbert-Schmidt operator norm) Kraus operators from the Choi matrix A
A | Choi matrix |
Converts Choi matrix to superoperator matrix.
A | Choi matrix |
dyn_mat<typename Derived1::Scalar> qpp::comm | ( | const Eigen::MatrixBase< Derived1 > & | A, |
const Eigen::MatrixBase< Derived2 > & | B | ||
) |
Commutator.
Commutator . Both A and B must be Eigen expressions over the same scalar field.
A | Eigen expression |
B | Eigen expression |
std::vector<T> qpp::complement | ( | std::vector< T > | subsys, |
idx | N | ||
) |
Constructs the complement of a subsystem vector.
subsys | Subsystem vector |
N | Total number of systems |
|
inline |
Compose permutations.
perm | Permutation |
sigma | Permutation |
double qpp::concurrence | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Wootters concurrence of the bi-partite qubit mixed state A.
A | Eigen expression |
dyn_mat<typename Derived::Scalar> qpp::conjugate | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Complex conjugate.
A | Eigen expression |
Real representation of a simple continued fraction.
cf | Integer vector containing the simple continued fraction expansion |
N | Number of terms considered in the continued fraction expansion. |
double qpp::cor | ( | const dmat & | probXY, |
const Container & | X, | ||
const Container & | Y, | ||
typename std::enable_if< is_iterable< Container >::value >::type * | = nullptr |
||
) |
Correlation.
probXY | Real matrix representing the joint probability distribution of X and Y in lexicographical order (X labels the rows, Y labels the columns) |
X | Real random variable values represented by an STL-like container |
Y | Real random variable values represented by an STL-like container |
cmat qpp::cosm | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Matrix cos.
A | Eigen expression |
double qpp::cov | ( | const dmat & | probXY, |
const Container & | X, | ||
const Container & | Y, | ||
typename std::enable_if< is_iterable< Container >::value >::type * | = nullptr |
||
) |
Covariance.
probXY | Real matrix representing the joint probability distribution of X and Y in lexicographical order (X labels the rows, Y labels the columns) |
X | Real random variable values represented by an STL-like container |
Y | Real random variable values represented by an STL-like container |
dyn_mat<OutputScalar> qpp::cwise | ( | const Eigen::MatrixBase< Derived > & | A, |
OutputScalar(*)(const typename Derived::Scalar &) | f | ||
) |
Functor.
A | Eigen expression |
f | Pointer-to-function from scalars of A to OutputScalar |
Derived::Scalar qpp::det | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Determinant.
A | Eigen expression |
dyn_mat<typename T::Scalar> qpp::dirsum | ( | const T & | head | ) |
Direct sum.
Used to stop the recursion for the variadic template version of qpp::dirsum()
head | Eigen expression |
dyn_mat<typename T::Scalar> qpp::dirsum | ( | const T & | head, |
const Args &... | tail | ||
) |
Direct sum.
head | Eigen expression |
tail | Variadic Eigen expression (zero or more parameters) |
dyn_mat<typename Derived::Scalar> qpp::dirsum | ( | const std::vector< Derived > & | As | ) |
Direct sum.
As | std::vector of Eigen expressions |
dyn_mat<typename Derived::Scalar> qpp::dirsum | ( | const std::initializer_list< Derived > & | As | ) |
Direct sum.
As | std::initializer_list of Eigen expressions, such as {A1, A2, ... ,Ak} |
dyn_mat<typename Derived::Scalar> qpp::dirsumpow | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | n | ||
) |
Direct sum power.
A | Eigen expression |
n | Non-negative integer |
internal::IOManipEigen qpp::disp | ( | const Eigen::MatrixBase< Derived > & | A, |
double | chop = qpp::chop |
||
) |
Eigen expression ostream manipulator.
A | Eigen expression |
chop | Set to zero the elements smaller in absolute value than chop |
|
inline |
Complex number ostream manipulator.
z | Complex number (or any other type implicitly cast-able to std::complex<double>) |
chop | Set to zero the elements smaller in absolute value than chop |
internal::IOManipRange<InputIterator> qpp::disp | ( | InputIterator | first, |
InputIterator | last, | ||
const std::string & | separator, | ||
const std::string & | start = "[" , |
||
const std::string & | end = "]" |
||
) |
Range ostream manipulator.
first | Iterator to the first element of the range |
last | Iterator to the last element of the range |
separator | Separator |
start | Left marking |
end | Right marking |
internal::IOManipRange<typename Container::const_iterator> qpp::disp | ( | const Container & | c, |
const std::string & | separator, | ||
const std::string & | start = "[" , |
||
const std::string & | end = "]" , |
||
typename std::enable_if< is_iterable< Container >::value >::type * | = nullptr |
||
) |
Standard container ostream manipulator. The container must support std::begin(), std::end() and forward iteration.
c | Container |
separator | Separator |
start | Left marking |
end | Right marking |
internal::IOManipPointer<PointerType> qpp::disp | ( | const PointerType * | p, |
idx | N, | ||
const std::string & | separator, | ||
const std::string & | start = "[" , |
||
const std::string & | end = "]" |
||
) |
C-style pointer ostream manipulator.
p | Pointer to the first element |
N | Number of elements to be displayed |
separator | Separator |
start | Left marking |
end | Right marking |
Extended greatest common divisor of two integers.
a | Integer |
b | Integer |
std::pair<dyn_col_vect<cplx>, cmat> qpp::eig | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Full eigen decomposition.
A | Eigen expression |
double qpp::entanglement | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | dims | ||
) |
Entanglement of the bi-partite pure state A.
Defined as the von-Neumann entropy of the reduced density matrix of one of the subsystems
A | Eigen expression |
dims | Dimensions of the bi-partite system |
double qpp::entanglement | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | d = 2 |
||
) |
Entanglement of the bi-partite pure state A.
Defined as the von-Neumann entropy of the reduced density matrix of one of the subsystems
A | Eigen expression |
d | Subsystem dimensions |
double qpp::entropy | ( | const Eigen::MatrixBase< Derived > & | A | ) |
von-Neumann entropy of the density matrix A
A | Eigen expression |
|
inline |
Shannon entropy of the probability distribution prob.
prob | Real probability vector |
dyn_col_vect<cplx> qpp::evals | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Eigenvalues.
A | Eigen expression |
cmat qpp::evects | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Eigenvectors.
A | Eigen expression |
cmat qpp::expm | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Matrix exponential.
A | Eigen expression |
Prime factor decomposition.
a | Integer different from 0, 1 or -1 |
cmat qpp::funm | ( | const Eigen::MatrixBase< Derived > & | A, |
cplx(*)(const cplx &) | f | ||
) |
Functional calculus f(A)
A | Eigen expression |
f | Pointer-to-function from complex to complex |
Greatest common divisor of two integers.
a | Integer |
b | Integer |
Greatest common divisor of a list of integers.
as | List of integers |
double qpp::gconcurrence | ( | const Eigen::MatrixBase< Derived > & | A | ) |
G-concurrence of the bi-partite pure state A.
Uses qpp::logdet() to avoid overflows
A | Eigen expression |
dyn_mat<typename Derived::Scalar> qpp::grams | ( | const std::vector< Derived > & | As | ) |
Gram-Schmidt orthogonalization.
As | std::vector of Eigen expressions as column vectors |
dyn_mat<typename Derived::Scalar> qpp::grams | ( | const std::initializer_list< Derived > & | As | ) |
Gram-Schmidt orthogonalization.
As | std::initializer_list of Eigen expressions as column vectors |
dyn_mat<typename Derived::Scalar> qpp::grams | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Gram-Schmidt orthogonalization.
A | Eigen expression, the input vectors are the columns of A |
std::pair<dyn_col_vect<double>, cmat> qpp::heig | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Full eigen decomposition of Hermitian expression.
A | Eigen expression |
dyn_col_vect<double> qpp::hevals | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Hermitian eigenvalues.
A | Eigen expression |
cmat qpp::hevects | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Hermitian eigenvectors.
A | Eigen expression |
dyn_mat<typename Derived::Scalar> qpp::inverse | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Inverse.
A | Eigen expression |
Inverse permutation.
perm | Permutation |
dyn_col_vect<typename Derived::Scalar> qpp::ip | ( | const Eigen::MatrixBase< Derived > & | phi, |
const Eigen::MatrixBase< Derived > & | psi, | ||
const std::vector< idx > & | subsys, | ||
const std::vector< idx > & | dims | ||
) |
Generalized inner product.
phi | Column vector Eigen expression |
psi | Column vector Eigen expression |
subsys | Subsystem indexes over which phi is defined |
dims | Dimensions of the multi-partite system |
dyn_col_vect<typename Derived::Scalar> qpp::ip | ( | const Eigen::MatrixBase< Derived > & | phi, |
const Eigen::MatrixBase< Derived > & | psi, | ||
const std::vector< idx > & | subsys, | ||
idx | d = 2 |
||
) |
Generalized inner product.
phi | Column vector Eigen expression |
psi | Column vector Eigen expression |
subsys | Subsystem indexes over which phi is defined |
d | Subsystem dimensions |
Primality test based on the Miller-Rabin's algorithm.
p | Integer different from 0, 1 or -1 |
k | Number of iterations. The probability of a false positive is ![]() |
Choi matrix.
Constructs the Choi matrix of the channel specified by the set of Kraus operators Ks in the standard operator basis ordered in lexicographical order, i.e.
,
etc.
Ks | Set of Kraus operators |
Superoperator matrix.
Constructs the superoperator matrix of the channel specified by the set of Kraus operators Ks in the standard operator basis ordered in lexicographical order, i.e.
,
etc.
Ks | Set of Kraus operators |
dyn_mat<typename T::Scalar> qpp::kron | ( | const T & | head | ) |
Kronecker product.
Used to stop the recursion for the variadic template version of qpp::kron()
head | Eigen expression |
dyn_mat<typename T::Scalar> qpp::kron | ( | const T & | head, |
const Args &... | tail | ||
) |
Kronecker product.
head | Eigen expression |
tail | Variadic Eigen expression (zero or more parameters) |
dyn_mat<typename Derived::Scalar> qpp::kron | ( | const std::vector< Derived > & | As | ) |
Kronecker product.
As | std::vector of Eigen expressions |
dyn_mat<typename Derived::Scalar> qpp::kron | ( | const std::initializer_list< Derived > & | As | ) |
Kronecker product.
As | std::initializer_list of Eigen expressions, such as {A1, A2, ... ,Ak} |
dyn_mat<typename Derived::Scalar> qpp::kronpow | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | n | ||
) |
Kronecker power.
A | Eigen expression |
n | Non-negative integer |
Least common multiple of two integers.
a | Integer |
b | Integer |
Least common multiple of a list of integers.
as | List of integers |
dyn_mat<typename Derived::Scalar> qpp::load | ( | const std::string & | fname | ) |
Loads Eigen matrix from a binary file (internal format) in double precision.
The template parameter cannot be automatically deduced and must be explicitly provided, depending on the scalar field of the matrix that is being loaded.
Example:
fname | Output file name |
std::enable_if<std::is_same<typename Derived::Scalar, cplx>::value, dyn_mat<cplx> >::type qpp::loadMATLAB | ( | const std::string & | mat_file, |
const std::string & | var_name | ||
) |
Loads a complex Eigen dynamic matrix from a MATLAB .mat file,.
The template parameter cannot be automatically deduced and must be explicitly provided
Example:
Derived | Complex Eigen type |
mat_file | MATALB .mat file |
var_name | Variable name in the .mat file representing the matrix to be loaded |
std::enable_if<!std::is_same<typename Derived::Scalar, cplx>::value, dyn_mat<typename Derived::Scalar> >::type qpp::loadMATLAB | ( | const std::string & | mat_file, |
const std::string & | var_name | ||
) |
Loads a non-complex Eigen dynamic matrix from a MATLAB .mat file,.
The template parameter cannot be automatically deduced and must be explicitly provided
Example:
Derived | Non-complex Eigen type |
mat_file | MATALB .mat file |
var_name | Variable name in the .mat file representing the matrix to be loaded |
Derived::Scalar qpp::logdet | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Logarithm of the determinant.
Useful when the determinant overflows/underflows
A | Eigen expression |
cmat qpp::logm | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Matrix logarithm.
A | Eigen expression |
double qpp::lognegativity | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | dims | ||
) |
Logarithmic negativity of the bi-partite mixed state A.
A | Eigen expression |
dims | Dimensions of the bi-partite system |
double qpp::lognegativity | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | d = 2 |
||
) |
Logarithmic negativity of the bi-partite mixed state A.
A | Eigen expression |
d | Subsystem dimensions |
|
inline |
Marginal distribution.
probXY | Real matrix representing the joint probability distribution of X and Y in lexicographical order (X labels the rows, Y labels the columns) |
|
inline |
Marginal distribution.
probXY | Real matrix representing the joint probability distribution of X and Y in lexicographical order (X labels the rows, Y labels the columns) |
std::tuple<idx, std::vector<double>, std::vector<cmat> > qpp::measure | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< cmat > & | Ks | ||
) |
Measures the state A using the set of Kraus operators Ks.
A | Eigen expression |
Ks | Set of Kraus operators |
std::tuple<idx, std::vector<double>, std::vector<cmat> > qpp::measure | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::initializer_list< cmat > & | Ks | ||
) |
Measures the state A using the set of Kraus operators Ks.
A | Eigen expression |
Ks | Set of Kraus operators |
std::tuple<idx, std::vector<double>, std::vector<cmat> > qpp::measure | ( | const Eigen::MatrixBase< Derived > & | A, |
const cmat & | U | ||
) |
Measures the state A in the orthonormal basis specified by the unitary matrix U.
A | Eigen expression |
U | Unitary matrix whose columns represent the measurement basis vectors |
std::tuple<idx, std::vector<double>, std::vector<cmat> > qpp::measure | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< cmat > & | Ks, | ||
const std::vector< idx > & | subsys, | ||
const std::vector< idx > & | dims | ||
) |
Measures the part subsys of the multi-partite state vector or density matrix A using the set of Kraus operators Ks.
A | Eigen expression |
Ks | Set of Kraus operators |
subsys | Subsystem indexes that are measured |
dims | Dimensions of the multi-partite system |
std::tuple<idx, std::vector<double>, std::vector<cmat> > qpp::measure | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::initializer_list< cmat > & | Ks, | ||
const std::vector< idx > & | subsys, | ||
const std::vector< idx > & | dims | ||
) |
Measures the part subsys of the multi-partite state vector or density matrix A using the set of Kraus operators Ks.
A | Eigen expression |
Ks | Set of Kraus operators |
subsys | Subsystem indexes that are measured |
dims | Dimensions of the multi-partite system |
std::tuple<idx, std::vector<double>, std::vector<cmat> > qpp::measure | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< cmat > & | Ks, | ||
const std::vector< idx > & | subsys, | ||
idx | d = 2 |
||
) |
Measures the part subsys of the multi-partite state vector or density matrix A using the set of Kraus operators Ks.
A | Eigen expression |
Ks | Set of Kraus operators |
subsys | Subsystem indexes that are measured |
d | Subsystem dimensions |
std::tuple<idx, std::vector<double>, std::vector<cmat> > qpp::measure | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::initializer_list< cmat > & | Ks, | ||
const std::vector< idx > & | subsys, | ||
idx | d = 2 |
||
) |
Measures the part subsys of the multi-partite state vector or density matrix A using the set of Kraus operators Ks.
A | Eigen expression |
Ks | Set of Kraus operators |
subsys | Subsystem indexes that are measured |
d | Subsystem dimensions |
std::tuple<idx, std::vector<double>, std::vector<cmat> > qpp::measure | ( | const Eigen::MatrixBase< Derived > & | A, |
const cmat & | V, | ||
const std::vector< idx > & | subsys, | ||
const std::vector< idx > & | dims | ||
) |
Measures the part subsys of the multi-partite state vector or density matrix A in the orthonormal basis or rank-1 POVM specified by the matrix V.
A | Eigen expression |
V | Matrix whose columns represent the measurement basis vectors or the bra parts of the rank-1 POVM |
subsys | Subsystem indexes that are measured |
dims | Dimensions of the multi-partite system |
std::tuple<idx, std::vector<double>, std::vector<cmat> > qpp::measure | ( | const Eigen::MatrixBase< Derived > & | A, |
const cmat & | V, | ||
const std::vector< idx > & | subsys, | ||
idx | d = 2 |
||
) |
Measures the part subsys of the multi-partite state vector or density matrix A in the orthonormal basis or rank-1 POVM specified by the matrix V.
A | Eigen expression |
V | Matrix whose columns represent the measurement basis vectors or the bra parts of the rank-1 POVM |
subsys | Subsystem indexes that are measured |
d | Subsystem dimensions |
std::tuple<std::vector<idx>, double, cmat> qpp::measure_seq | ( | const Eigen::MatrixBase< Derived > & | A, |
std::vector< idx > | subsys, | ||
std::vector< idx > | dims | ||
) |
Sequentially measures the part subsys of the multi-partite state vector or density matrix A in the computational basis.
A | Eigen expression |
subsys | Subsystem indexes that are measured |
dims | Dimensions of the multi-partite system |
std::tuple<std::vector<idx>, double, cmat> qpp::measure_seq | ( | const Eigen::MatrixBase< Derived > & | A, |
std::vector< idx > | subsys, | ||
idx | d = 2 |
||
) |
Sequentially measures the part subsys of the multi-partite state vector or density matrix A in the computational basis.
A | Eigen expression |
subsys | Subsystem indexes that are measured |
d | Subsystem dimensions |
Multi-partite qudit ket.
Constructs the multi-partite qudit ket , where mask is a std::vector of non-negative integers. Each element in mask has to be smaller than the corresponding element in dims.
mask | std::vector of non-negative integers |
dims | Dimensions of the multi-partite system |
Multi-partite qudit ket.
Constructs the multi-partite qudit ket , all subsystem having equal dimension d. mask is a std::vector of non-negative integers, and each element in mask has to be strictly smaller than d.
mask | std::vector of non-negative integers |
d | Subsystem dimensions |
Modular inverse of a mod p.
a | Non-negative integer |
p | Non-negative integer |
Modular multiplication without overflow.
Computes
without overflow
a | Integer |
b | Integer |
p | Positive integer |
Fast integer power modulo p based on the SQUARE-AND-MULTIPLY algorithm.
Computes
a | Non-negative integer |
n | Non-negative integer |
p | Strictly positive integer |
Projector onto multi-partite qudit ket.
Constructs the projector onto the multi-partite qudit ket , where mask is a std::vector of non-negative integers. Each element in mask has to be smaller than the corresponding element in dims.
mask | std::vector of non-negative integers |
dims | Dimensions of the multi-partite system |
Projector onto multi-partite qudit ket.
Constructs the projector onto the multi-partite qudit ket , all subsystem having equal dimension d. mask is a std::vector of non-negative integers, and each element in mask has to be strictly smaller than d.
mask | std::vector of non-negative integers |
d | Subsystem dimensions |
Multi-index to non-negative integer index.
Uses standard lexicographical order, i.e. 00...0, 00...1 etc.
midx | Multi-index |
dims | Dimensions of the multi-partite system |
Non-negative integer index to multi-index.
Uses standard lexicographical order, i.e. 00...0, 00...1 etc.
n | Non-negative integer index |
dims | Dimensions of the multi-partite system |
double qpp::negativity | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | dims | ||
) |
Negativity of the bi-partite mixed state A.
A | Eigen expression |
dims | Dimensions of the bi-partite system |
double qpp::negativity | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | d = 2 |
||
) |
Negativity of the bi-partite mixed state A.
A | Eigen expression |
d | Subsystem dimensions |
double qpp::norm | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Frobenius norm.
A | Eigen expression |
D-th root of unity.
D | Non-negative integer |
|
inlinenoexcept |
User-defined literal for complex (real overload)
Example:
dyn_mat<typename Derived::Scalar> qpp::powm | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | n | ||
) |
Fast matrix power based on the SQUARE-AND-MULTIPLY algorithm.
Explicitly multiplies the matrix A with itself n times. By convention .
A | Eigen expression |
n | Non-negative integer |
dyn_mat<typename Derived::Scalar> qpp::prj | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Projector.
Normalized projector onto state vector
A | Eigen expression |
Derived::Scalar qpp::prod | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Element-wise product of A.
A | Eigen expression |
std::iterator_traits<InputIterator>::value_type qpp::prod | ( | InputIterator | first, |
InputIterator | last | ||
) |
Element-wise product of an STL-like range.
first | Iterator to the first element of the range |
last | Iterator to the last element of the range |
Container::value_type qpp::prod | ( | const Container & | c, |
typename std::enable_if< is_iterable< Container >::value >::type * | = nullptr |
||
) |
Element-wise product of the elements of an STL-like container.
c | STL-like container |
dyn_mat<typename Derived::Scalar> qpp::ptrace | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | subsys, | ||
const std::vector< idx > & | dims | ||
) |
Partial trace.
Partial trace of the multi-partite state vector or density matrix over a list of subsystems
A | Eigen expression |
subsys | Subsystem indexes |
dims | Dimensions of the multi-partite system |
dyn_mat<typename Derived::Scalar> qpp::ptrace | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | subsys, | ||
idx | d = 2 |
||
) |
Partial trace.
Partial trace of the multi-partite state vector or density matrix over a list of subsystems
A | Eigen expression |
subsys | Subsystem indexes |
d | Subsystem dimensions |
dyn_mat<typename Derived::Scalar> qpp::ptrace1 | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | dims | ||
) |
Partial trace.
Partial trace over the first subsystem of bi-partite state vector or density matrix
A | Eigen expression |
dims | Dimensions of the bi-partite system |
dyn_mat<typename Derived::Scalar> qpp::ptrace1 | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | d = 2 |
||
) |
Partial trace.
Partial trace over the first subsystem of bi-partite state vector or density matrix
A | Eigen expression |
d | Subsystem dimensions |
dyn_mat<typename Derived::Scalar> qpp::ptrace2 | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | dims | ||
) |
Partial trace.
Partial trace over the second subsystem of bi-partite state vector or density matrix
A | Eigen expression |
dims | Dimensions of the bi-partite system |
dyn_mat<typename Derived::Scalar> qpp::ptrace2 | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | d = 2 |
||
) |
Partial trace.
Partial trace over the second subsystem of bi-partite state vector or density matrix
A | Eigen expression |
d | Subsystem dimensions |
dyn_mat<typename Derived::Scalar> qpp::ptranspose | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | subsys, | ||
const std::vector< idx > & | dims | ||
) |
Partial transpose.
Partial transpose of the multi-partite state vector or density matrix over a list of subsystems
A | Eigen expression |
subsys | Subsystem indexes |
dims | Dimensions of the multi-partite system |
dyn_mat<typename Derived::Scalar> qpp::ptranspose | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | subsys, | ||
idx | d = 2 |
||
) |
Partial transpose.
Partial transpose of the multi-partite state vector or density matrix over a list of subsystems
A | Eigen expression |
subsys | Subsystem indexes |
d | Subsystem dimensions |
double qpp::qmutualinfo | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | subsysA, | ||
const std::vector< idx > & | subsysB, | ||
const std::vector< idx > & | dims | ||
) |
Quantum mutual information between 2 subsystems of a composite system.
A | Eigen expression |
subsysA | Indexes of the first subsystem |
subsysB | Indexes of the second subsystem |
dims | Dimensions of the multi-partite system |
double qpp::qmutualinfo | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | subsysA, | ||
const std::vector< idx > & | subsysB, | ||
idx | d = 2 |
||
) |
Quantum mutual information between 2 subsystems of a composite system.
A | Eigen expression |
subsysA | Indexes of the first subsystem |
subsysB | Indexes of the second subsystem |
d | Subsystem dimensions |
|
inline |
Generates a random real number uniformly distributed in the interval [a, b)
a | Beginning of the interval, belongs to it |
b | End of the interval, does not belong to it |
Generates a random big integer uniformly distributed in the interval [a, b].
a | Beginning of the interval, belongs to it |
b | End of the interval, belongs to it |
Generates a random matrix with entries uniformly distributed in the interval [a, b)
If complex, then both real and imaginary parts are uniformly distributed in [a, b)
This is the generic version that always throws qpp::Exception::Type::UNDEFINED_TYPE. It is specialized only for qpp::dmat and qpp::cmat
Generates a random real matrix with entries uniformly distributed in the interval [a, b), specialization for double matrices (qpp::dmat)
The template parameter cannot be automatically deduced and must be explicitly provided
Example:
rows | Number of rows of the random generated matrix |
cols | Number of columns of the random generated matrix |
a | Beginning of the interval, belongs to it |
b | End of the interval, does not belong to it |
Generates a random complex matrix with entries (both real and imaginary) uniformly distributed in the interval [a, b), specialization for complex matrices (qpp::cmat)
The template parameter cannot be automatically deduced and must be explicitly provided
Example:
rows | Number of rows of the random generated matrix |
cols | Number of columns of the random generated matrix |
a | Beginning of the interval, belongs to it |
b | End of the interval, does not belong to it |
Generates a random Hermitian matrix.
D | Dimension of the Hilbert space |
|
inline |
Generates a random index (idx) uniformly distributed in the interval [a, b].
a | Beginning of the interval, belongs to it |
b | End of the interval, belongs to it |
Generates a random normalized ket (pure state vector)
D | Dimension of the Hilbert space |
Generates a set of random Kraus operators.
N | Number of Kraus operators |
D | Dimension of the Hilbert space |
Derived qpp::randn | ( | idx | rows, |
idx | cols, | ||
double | mean = 0 , |
||
double | sigma = 1 |
||
) |
Generates a random matrix with entries normally distributed in N(mean, sigma)
If complex, then both real and imaginary parts are normally distributed in N(mean, sigma)
This is the generic version that always throws qpp::Exception::Type::UNDEFINED_TYPE. It is specialized only for qpp::dmat and qpp::cmat
Generates a random real matrix with entries normally distributed in N(mean, sigma), specialization for double matrices (qpp::dmat)
The template parameter cannot be automatically deduced and must be explicitly provided
Example:
rows | Number of rows of the random generated matrix |
cols | Number of columns of the random generated matrix |
mean | Mean |
sigma | Standard deviation |
Generates a random complex matrix with entries (both real and imaginary) normally distributed in N(mean, sigma), specialization for complex matrices (qpp::cmat)
The template parameter cannot be automatically deduced and must be explicitly provided
Example:
rows | Number of rows of the random generated matrix |
cols | Number of columns of the random generated matrix |
mean | Mean |
sigma | Standard deviation |
|
inline |
Generates a random real number (double) normally distributed in N(mean, sigma)
mean | Mean |
sigma | Standard deviation |
Generates a random uniformly distributed permutation.
Uses Knuth shuffle method (as implemented by std::shuffle), so that all permutations are equally probable
N | Size of the permutation |
Generates a random big prime uniformly distributed in the interval [a, b].
a | Beginning of the interval, belongs to it |
b | End of the interval, belongs to it |
N | Maximum number of candidates |
|
inline |
Generates a random probability vector uniformly distributed over the probability simplex.
N | Size of the probability vector |
Generates a random density matrix.
D | Dimension of the Hilbert space |
Generates a random unitary matrix.
D | Dimension of the Hilbert space |
Generates a random isometry matrix.
Din | Size of the input Hilbert space |
Dout | Size of the output Hilbert space |
double qpp::renyi | ( | const Eigen::MatrixBase< Derived > & | A, |
double | alpha | ||
) |
Renyi- entropy of the density matrix A, for
.
A | Eigen expression |
alpha | Non-negative real number, use qpp::infty for ![]() |
|
inline |
Renyi- entropy of the probability distribution prob, for
.
prob | Real probability vector |
alpha | Non-negative real number, use qpp::infty for ![]() |
dyn_mat<typename Derived::Scalar> qpp::reshape | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | rows, | ||
idx | cols | ||
) |
Reshape.
Uses column-major order when reshaping (same as MATLAB)
A | Eigen expression |
rows | Number of rows of the reshaped matrix |
cols | Number of columns of the reshaped matrix |
std::vector<double> qpp::rho2bloch | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Computes the 3-dimensional real Bloch vector corresponding to the qubit density matrix A.
A | Eigen expression |
dyn_col_vect<typename Derived::Scalar> qpp::rho2pure | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Finds the pure state representation of a matrix proportional to a projector onto a pure state.
A | Eigen expression, assumed to be proportional to a projector onto a pure state, i.e. A is assumed to have rank one |
void qpp::save | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::string & | fname | ||
) |
Saves Eigen expression to a binary file (internal format) in double precision.
A | Eigen expression |
fname | Output file name |
std::enable_if< std::is_same<typename Derived::Scalar, cplx>::value>::type qpp::saveMATLAB | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::string & | mat_file, | ||
const std::string & | var_name, | ||
const std::string & | mode | ||
) |
Saves a complex Eigen dynamic matrix to a MATLAB .mat file,.
Complex | Eigen type |
A | Eigen expression over the complex field |
mat_file | MATALB .mat file |
var_name | Variable name in the .mat file representing the matrix to be saved |
mode | Saving mode (append, overwrite etc.), see MATLAB matOpen() documentation for details |
std::enable_if< !std::is_same<typename Derived::Scalar, cplx>::value>::type qpp::saveMATLAB | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::string & | mat_file, | ||
const std::string & | var_name, | ||
const std::string & | mode | ||
) |
Saves a non-complex Eigen dynamic matrix to a MATLAB .mat file,.
Npn-complex | Eigen type |
A | Non-complex Eigen expression |
mat_file | MATALB .mat file |
var_name | Variable name in the .mat file representing the matrix to be saved |
mode | Saving mode (append, overwrite etc.), see MATLAB matOpen() documentation for details |
double qpp::schatten | ( | const Eigen::MatrixBase< Derived > & | A, |
double | p | ||
) |
Schatten matrix norm.
A | Eigen expression |
p | Real number, greater or equal to 1, use qpp::infty for ![]() |
cmat qpp::schmidtA | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | dims | ||
) |
Schmidt basis on Alice side.
A | Eigen expression |
dims | Dimensions of the bi-partite system |
cmat qpp::schmidtA | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | d = 2 |
||
) |
Schmidt basis on Alice side.
A | Eigen expression |
d | Subsystem dimensions |
cmat qpp::schmidtB | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | dims | ||
) |
Schmidt basis on Bob side.
A | Eigen expression |
dims | Dimensions of the bi-partite system |
cmat qpp::schmidtB | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | d = 2 |
||
) |
Schmidt basis on Bob side.
A | Eigen expression |
d | Subsystem dimensions |
dyn_col_vect<double> qpp::schmidtcoeffs | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | dims | ||
) |
Schmidt coefficients of the bi-partite pure state A.
A | Eigen expression |
dims | Dimensions of the bi-partite system |
dyn_col_vect<double> qpp::schmidtcoeffs | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | d = 2 |
||
) |
Schmidt coefficients of the bi-partite pure state A.
A | Eigen expression |
d | Subsystem dimensions |
std::vector<double> qpp::schmidtprobs | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | dims | ||
) |
Schmidt probabilities of the bi-partite pure state A.
Defined as the squares of the Schmidt coefficients. The sum of the Schmidt probabilities equals 1.
A | Eigen expression |
dims | Dimensions of the bi-partite system |
std::vector<double> qpp::schmidtprobs | ( | const Eigen::MatrixBase< Derived > & | A, |
idx | d = 2 |
||
) |
Schmidt probabilities of the bi-partite pure state A.
Defined as the squares of the Schmidt coefficients. The sum of the Schmidt probabilities equals 1.
A | Eigen expression |
d | Subsystem dimensions |
double qpp::sigma | ( | const std::vector< double > & | prob, |
const Container & | X, | ||
typename std::enable_if< is_iterable< Container >::value >::type * | = nullptr |
||
) |
Standard deviation.
prob | Real probability vector representing the probability distribution of X |
X | Real random variable values represented by an STL-like container |
cmat qpp::sinm | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Matrix sin.
A | Eigen expression |
cmat qpp::spectralpowm | ( | const Eigen::MatrixBase< Derived > & | A, |
const cplx | z | ||
) |
Matrix power.
Uses the spectral decomposition of A to compute the matrix power. By convention .
A | Eigen expression |
z | Complex number |
cmat qpp::sqrtm | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Matrix square root.
A | Eigen expression |
Derived::Scalar qpp::sum | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Element-wise sum of A.
A | Eigen expression |
std::iterator_traits<InputIterator>::value_type qpp::sum | ( | InputIterator | first, |
InputIterator | last | ||
) |
Element-wise sum of an STL-like range.
first | Iterator to the first element of the range |
last | Iterator to the last element of the range |
Container::value_type qpp::sum | ( | const Container & | c, |
typename std::enable_if< is_iterable< Container >::value >::type * | = nullptr |
||
) |
Element-wise sum of the elements of an STL-like container.
c | STL-like container |
Converts superoperator matrix to Choi matrix.
A | Superoperator matrix |
dyn_col_vect<double> qpp::svals | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Singular values.
A | Eigen expression |
std::tuple<cmat, dyn_col_vect<double>, cmat> qpp::svd | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Full singular value decomposition.
A | Eigen expression |
cmat qpp::svdU | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Left singular vectors.
A | Eigen expression |
cmat qpp::svdV | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Right singular vectors.
A | Eigen expression |
dyn_mat<typename Derived::Scalar> qpp::syspermute | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | perm, | ||
const std::vector< idx > & | dims | ||
) |
Subsystem permutation.
Permutes the subsystems of a state vector or density matrix. The qubit perm[i] is permuted to the location i.
A | Eigen expression |
perm | Permutation |
dims | Dimensions of the multi-partite system |
dyn_mat<typename Derived::Scalar> qpp::syspermute | ( | const Eigen::MatrixBase< Derived > & | A, |
const std::vector< idx > & | perm, | ||
idx | d = 2 |
||
) |
Subsystem permutation.
Permutes the subsystems of a state vector or density matrix. The qubit perm[i] is permuted to the location i.
A | Eigen expression |
perm | Permutation |
d | Subsystem dimensions |
Derived::Scalar qpp::trace | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Trace.
A | Eigen expression |
dyn_mat<typename Derived::Scalar> qpp::transpose | ( | const Eigen::MatrixBase< Derived > & | A | ) |
Transpose.
A | Eigen expression |
double qpp::tsallis | ( | const Eigen::MatrixBase< Derived > & | A, |
double | q | ||
) |
Tsallis- entropy of the density matrix A, for
.
A | Eigen expression |
q | Non-negative real number |
|
inline |
Tsallis- entropy of the probability distribution prob, for
.
prob | Real probability vector |
q | Non-negative real number |
|
inline |
Uniform probability distribution vector.
N | Size of the alphabet |
double qpp::var | ( | const std::vector< double > & | prob, |
const Container & | X, | ||
typename std::enable_if< is_iterable< Container >::value >::type * | = nullptr |
||
) |
Variance.
prob | Real probability vector representing the probability distribution of X |
X | Real random variable values represented by an STL-like container |
Simple continued fraction expansion.
x | Real number |
N | Maximum number of terms in the expansion |
cut | Stop the expansion when the next term is greater than cut |
constexpr double qpp::chop = 1e-10 |
Used in qpp::disp() for setting to zero numbers that have their absolute value smaller than qpp::chop.
constexpr double qpp::ee = 2.718281828459045235360287471352662497 |
Base of natural logarithm, .
constexpr double qpp::eps = 1e-12 |
Used to decide whether a number or expression in double precision is zero or not.
Example:
constexpr double qpp::infty = std::numeric_limits<double>::max() |
Used to denote infinity in double precision.
constexpr idx qpp::maxn = 64 |
Maximum number of allowed qubits/qudits (subsystems)
Used internally to allocate arrays on the stack (for performance reasons):
constexpr double qpp::pi = 3.141592653589793238462643383279502884 |