API Reference for QIClib 1.0

Preamble

Overview

[top] Classes and constants
Init Class for library initialization
SPM<POD_TYPE>, spm, spmf Several predefined constant special matrices like basis states, projectors and operators
GATES<POD_TYPE>, gates, gatesf Several predefined constant quantum gates and generators of quantum gate
Func<POD_TYPE>, func, funcf Several predefined functions to be used with funcm_sym or funcm_gen
RandomDevices, rdevs Predefined random number engines/generators, used in functions like randU etc.

Functions
is_Hermitian Hermiticity check
is_Unitary Unitarity check
is_Normal To check whether the the matrix is normal or not
is_pure To check purity of a density matrix
is_valid_state To check whether the matrix represents a valid quantum state
is_diagonalizable To check whether the matrix is diagonalizable or not
is_equal To check whether two matrices are equal
dense_to_sparse To convert a dense matrix (Mat) to a sparse (SpMat) matrix
sparse_to_dense To convert a sparse matrix (SpMat) to a dense (Mat) matrix
range Similar to Python's range() function. Useful in range-based for loops
TrX Partial trace
Tx Partial transpose
sysperm Permute subsystems of a quantum state
sqrtm_sym Principal square root of real symmetric or Hermitian matrices
sqrtm_gen Principal square root of general square matrices
powm_sym Matrix power for real symmetric or Hermitian matrices
powm_gen Matrix power for general square matrices
expm_sym Matrix exponential for real symmetric or Hermitian matrices
expm_gen Matrix exponential for general square matrices
funcm_sym Matrix function for real symmetric or Hermitian matrices
funcm_gen Matrix function for general square matrices
tensor Tensor product of arbitrary no. of matrices
tensor_pow Tensor product power
dsum Direct sum of arbitrary no. of matrices
dsum_pow Direct sum power
absm Matrix absolute value of a square matrix
schatten Schatten p-norm of a matrix
purify Minimal purification of a density matrix
gram_schmidt Modified Gram-Schmidt orthogonalization
conv_to_pure To convert density matrix of a pure state to a column vector
std_to_HS To convert 2-qubit density matrix from the standard basis to the Hilbert-Schmidt basis
HS_to_std To convert 2-qubit density matrix from the Hilbert-Schmidt basis back to the standard basis
mket To generate multipartite qudit pure state
mproj To genearte multipartite qudit projector
randU To generate object with random values (uniform distribution)
randN To generate object with random values (normal distribution)
randI To generate object with random integers
randHermitian To generate random Hermitian matrix
randUnitary To generate random unitary matrix
randPsi To generate random pure states
randRho To generate random mixed states
randPerm To generate random permutation of unsigned integers
entropy von Neumann entropy of a quantum state
shannon Shannon entropy of a probability distribution
renyi Renyi entropy of a quantum state
renyi_prob Renyi entropy of a probability distribution
tsallis Tsallis entropy of a quantum state
tsallis_prob Tsallis entropy of a probability distribution
mutual_info Quantum mutual information between 2 subsystems of a quantum state
rel_entropy Relative entropy between two quantum states
rel_entropy_prob Relative entropy between two probability distributions
entanglement Entanglement entropy of a pure quantum state
neg Negativity of a quantum state
log_neg Logarithmic negativity of a quantum state
concurrence Concurrence of a two-qubit quantum state
EoF Entanglement of formation of a two-qubit quantum state
ent_check_CMC To check if a bipartite state is entangled or not (based on covariant matrix criteria, can be used to detect bound entangled states)
schmidt, schmidt_full Schmidt decomposition of a bipartite pure state
schmidtA, schmidtB, schmidtAB, schmidtA_full, schmidtB_full, schmidtAB_full Schmidt vectors of a bipartite pure state
l1_coh l1-norm coherence of a quantum state
rel_entropy_coh Relative entropy of coherence of a quantum state
HS_dist Hilbert-Schmidt distance between two density matrices
tr_dist Trace distance between two density matrices
Bures_dist Bures distance between two density matrices
fidelity Fidelity between two density matrices
apply To apply a quantum gate to a quantum state
apply_ctrl To apply a quantum gate or a set of Kraus operators to a quantum state as a controlled gate
make_ctrl To convert a quantum gate into a controlled quantum gate
measure To measure a quantum state using a set of Kraus or projection operators
measure_comp To measure a quantum state in the computational basis
Go to top

Classes for discord like features
discord_space Computational space for calculating quantum discord (actual as well as constrained-regular) for quantum states when measurement is done over a qubit or qutrit system
deficit_space Computational space for calculating quantum work deficit (actual as well as constrained-regular) for quantum states when measurement is done over a qubit or qutrit system
Go to top



In this documentation the mat, cx_mat, vec, and cx_vec type is used for convenience. But every function should also work with float counterparts, like fmat, cx_fmat, fvec, and cx_fvec.

Classes and constants



Init
Go to top

SPM<POD_TYPE>
spm
spmf

Go to top

GATES<POD_TYPE>
gates
gatesf

Go to top

Func<type>
func
funcf

Go to top

RandomDevices
rdevs

Go to top

Functions



is_Hermitian(A)
is_Hermitian(A, atol, rtol)

Go to top

is_Unitary(A)
is_Unitary(A, atol, rtol)

Go to top

is_Normal(A)
is_Normal(A, atol, rtol)

Go to top

is_pure(A)
is_pure(A, check_norm = true)
is_pure(A, check_norm, tol)

Go to top

is_valid_state(A)
is_valid_state(A, tol)

Go to top

is_diagonalizable(A) Go to top

is_equal(A, B)
is_equal(A, B, typecheck = false)
is_equal(A, B, typecheck, atol, rtol)

Go to top

dense_to_sparse(A)
dense_to_sparse(A, tol)

Go to top

sparse_to_dense(A)
Go to top

range(stop)
range(start, stop)
range(start, stop, step)
Go to top

TrX(A, subsys)
TrX(A, subsys, dim)

Go to top

Tx(A, subsys)
Tx(A, subsys, dim)

Go to top

sysperm(A, perm)
sysperm(A, perm, dim)

Go to top

sqrtm_sym(A)
Go to top

sqrtm_gen(A) Go to top

powm_sym(A, n)
Go to top

powm_gen(A, n)
Go to top

expm_sym(A)
expm_sym(A, n)

Go to top

expm_gen(A)
Go to top

funcm_sym(A, function pointer)
funcm_sym(A, functor)
funcm_sym(A, lambda function)

Go to top

funcm_gen(A, function pointer)
funcm_gen(A, functor)
funcm_gen(A, lambda function)

Go to top

tensor(A, B, ...)
Go to top

tensor_pow(A, n)
Go to top

dsum(A, B, ...)
Go to top

dsum_pow(A, n)
Go to top

absm(A)
Go to top

schatten(A, p)
Go to top

purify(A)
purify(A, tol)

Go to top

gram_schmidt(A)
gram_schmidt(A, normalize = true)

Go to top

conv_to_pure(A)
Go to top

std_to_HS(A)
Go to top

HS_to_std(A)
Go to top

mket(mask)
mket<ELEM_TYPE>(mask)
mket(mask, dim)
mket<ELEM_TYPE>(mask, dim)

Go to top

mproj(mask)
mproj<ELEM_TYPE>(mask)
mproj(mask, dim)
mproj<ELEM_TYPE>(mask, dim)


Go to top

randU<ELEM_TYPE = double>(range = {0, 1})
randU<VEC_TYPE = vec>(n_elem, range = {0, 1})
randU<MAT_TYPE = mat>(n_rows, n_cols, range = {0, 1})

Go to top

randN<ELEM_TYPE = double>(mean_sd = {0, 1})
randN<VEC_TYPE = vec>(n_elem, mean_sd = {0, 1})
randN<MAT_TYPE = mat>(n_rows, n_cols, mean_sd = {0, 1})

Go to top

randI<ELEM_TYPE = sword>(range = {0, 1000})
randI<VEC_TYPE = ivec>(n_elem, range = {0, 1000})
randI<MAT_TYPE = imat>(n_rows, n_cols, range = {0, 1000})

Go to top

randHermitian<ELEM_TYPE = complex<double> >(dim)
Go to top

randUnitary<ELEM_TYPE = complex<double> >(dim)
Go to top

randPsi<ELEM_TYPE = complex<double> >(dim)
Go to top

randPerm(n, start = 0)
Go to top

entropy(A)
Go to top

shannon(V)
Go to top

renyi(A, a)
Go to top

renyi_prob(V, a)
Go to top

tsallis(A, a)
Go to top

tsallis_prob(V, a)
Go to top

mutual_info(A, dim)
mutual_info(A, subsys1, subsys2)
mutual_info(A, subsys1, subsys2, dim)

Go to top

rel_entropy(A, B)
Go to top

rel_entropy_prob(V1, V2)
Go to top

entanglement(A, dim) Go to top

neg(A, subsys)
neg(A, subsys, dim)

Go to top

log_neg(A, subsys)
log_neg(A, subsys, dim)

Go to top

concurrence(A)
Go to top

EoF(A)
Go to top

ent_check_CMC(A, dim)
ent_check_CMC(A, dim1, dim2)


Go to top

vec S = schmidt(A, dim)
schmidt(A, dim, S, U, V)
schmidt_full(A, dim, S, U, V)

Go to top

schmidtA(A, dim)
schmidtA_full(A, dim)
schmidtB(A, dim)
schmidtB_full(A, dim)
schmidtAB(A, dim)
schmidtAB_full(A, dim)

Go to top

l1_coh(A)
l1_coh(A, U)

Go to top

rel_entropy_coh(A)
rel_entropy_coh(A, U)

Go to top

HS_dist(A, B)
Go to top

tr_dist(A, B)
Go to top

Bures_dist(A, B)
Go to top

fidelity(A, B)
Go to top

apply(A, U, subsys)
apply(A, U, subsys, dim)
apply(A, Ks, subsys, dim)
apply(A, Ks)

Go to top

apply_ctrl(A, U, ctrl, subsys)
apply_ctrl(A, U, ctrl, subsys, dim)

Go to top

make_ctrl(U, ctrl, subsys, n, dim = 2)
make_ctrl(U, ctrl, subsys, dim)

Go to top

std::tuple<uword, vec, field<MATRIX_TYPE> > result = measure(cx_mat A, Ks)
std::tuple<uword, vec, field<MATRIX_TYPE> > result = measure(mat A, Ks)
std::tuple<uword, vec, field<MATRIX_TYPE> > result = measure(cx_mat A, Ks, subsys, dim)
std::tuple<uword, vec, field<MATRIX_TYPE> > result = measure(mat A, Ks, subsys, dim)

Go to top

std::tuple<uword, vec> result = measure_comp(A)
std::tuple<uword, vec> result = measure_comp(A, subsys, dim)

Go to top

Classes for Quantum Discord like features




discord_space<MATRIX_TYPE>
deficit_space<MATRIX_TYPE>

Go to top

Frequently asked questions



Go to top

Helper preprocessor macros



QIClib can be configured by defining following macros before including QIClib header.

QICLIB_MAXQDIT_COUNT Maximum number of qudits that can be handled by QIClib. By default, it is 40.
QICLIB_FLOAT_PRECISION Precision for float. By default, it is 100.0 * std::numeric_limits<float>::epsilon().
QICLIB_DOUBLE_PRECISION Precision for double. By default, it is 100.0 * std::numeric_limits<double>::epsilon().
QICLIB_NO_INIT_MESSAGE Disable printing of messages by Init class.
QICLIB_NO_SPM Disable instantiation of SPM class.
QICLIB_NO_GATES Disable instantiation of GATES class.
QICLIB_DONT_USE_NLOPT QIClib will not use NLopt dependent features.
QICLIB_USE_OLD_DISCORD QIClib will use old discord syntaxes (before version 1.0.0).
QICLIB_USE_OPENMP QIClib will use multi-threaded algorithms for TrX, Tx, sysperm, apply, apply_ctrl, make_ctrl, measure, and measure_comp if OpenMP is enabled.
QICLIB_USE_OPENMP_TRX QIClib will use multi-threaded algorithm for TrX if OpenMP is enabled.
QICLIB_USE_OPENMP_TX QIClib will use multi-threaded algorithm for Tx if OpenMP is enabled.
QICLIB_USE_OPENMP_SYSPERM QIClib will use multi-threaded algorithm for sysperm if OpenMP is enabled.
QICLIB_USE_OPENMP_APPLY QIClib will use multi-threaded algorithms for apply and apply_ctrl if OpenMP is enabled.
QICLIB_USE_OPENMP_MAKE_CTRL QIClib will use multi-threaded algorithm for make_ctrl if OpenMP is enabled.
QICLIB_USE_OPENMP_MEASURE QIClib will use multi-threaded algorithms for measure and measure_comp if OpenMP is enabled.



API Additions



Version 1.0

Version 0.0.4

Go to top

Version 0.0.3

Go to top

Version 0.0.2

Go to top