Skip to content

magic

Accessible in numqi.magic

numqi.magic.get_Weyl_H(dim)

get the Weyl-Heisenberg operator H, same as same as numqi.gate.get_quditH

Weyl-Heisenberg matrices wiki-link

Parameters:

Name Type Description Default
dim int

the dimension

required

Returns:

Name Type Description
ret ndarray

the Weyl-Heisenberg operator H of shape (dim,dim)

numqi.magic.get_Weyl_Z(dim)

get the Weyl-Heisenberg operator Z, same as same as numqi.gate.get_quditZ

Weyl-Heisenberg matrices wiki-link

Parameters:

Name Type Description Default
dim int

the dimension

required

Returns:

Name Type Description
ret ndarray

the Weyl-Heisenberg operator Z of shape (dim,dim)

numqi.magic.get_Weyl_X(dim)

get the Weyl-Heisenberg operator X

Weyl-Heisenberg matrices wiki-link

Parameters:

Name Type Description Default
dim int

the dimension

required

Returns:

Name Type Description
ret ndarray

the Weyl-Heisenberg operator X of shape (dim,dim)

numqi.magic.get_Heisenberg_Weyl_operator(dim)

get the Heisenberg-Weyl operator of prime dimension

Parameters:

Name Type Description Default
dim int

the prime dimension

required

Returns:

Name Type Description
T_list ndarray

the list of Heisenberg-Weyl operator \(T_u\) of shape (dim,dim,dim,dim)

A_list ndarray

the list of Heisenberg-Weyl operator \(A_u\) in matrix form of shape (dim,dim,dim,dim)

numqi.magic.get_qutrit_nonstabilizer_state(key)

get the non-stabilizer state of qutrit

reference: The resource theory of stabilizer quantum computation doi-link

Parameters:

Name Type Description Default
key str

the key of the non-stabilizer state, can be {'Hplus', 'Hminus', 'Hi', 'T', 'Strange', 'Norrell'}

required

Returns:

Name Type Description
ret ndarray

the non-stabilizer state of shape (3,)

numqi.magic.plot_qubit_magic_state_3d()

plot the magic state set (octahedron) of qubit

Parameters:

Returns:

Name Type Description
fig Figure

the figure object

ax Axes3D

the axis object

numqi.magic.matrix_to_wigner_basis(np0, is_hermitian=False)

convert the matrix to Wigner basis

Parameters:

Name Type Description Default
np0 ndarray

the matrix of shape (...,dim,dim)

required
is_hermitian bool

whether the matrix is hermitian

False

Returns:

Name Type Description
ret ndarray

the Wigner basis of shape (...,dim*dim)

numqi.magic.wigner_basis_to_matrix(np0)

convert the Wigner basis to matrix

Parameters:

Name Type Description Default
np0 ndarray

the Wigner basis of shape (...,dim*dim)

required

Returns:

Name Type Description
ret ndarray

the matrix of shape (...,dim,dim)

numqi.magic.get_wigner_trace_norm(np0)

get the Wigner trace norm of matrix

Parameters:

Name Type Description Default
np0 ndarray

the matrix of shape (...,dim,dim)

required

Returns:

Name Type Description
ret ndarray

the Wigner trace norm of shape (...)

numqi.magic.get_magic_state_boundary_qubit(rho)

get the magic state boundary of qubit

Parameters:

Name Type Description Default
rho ndarray

density matrix of shape (2,2) or (batch_size, 2, 2)

required

Returns:

Name Type Description
ret ndarray

the magic state boundary of shape (batch_size,)

numqi.magic.get_thauma_sdp(rho, kind, use_tqdm=False, sqrt_order=3, pade_order=3)

get the thauma of quantum state using semi-definite programming (SDP)

reference: Efficiently Computable Bounds for Magic State Distillation doi-link

Parameters:

Name Type Description Default
rho ndarray

the quantum state(s) of shape (dim, dim) or (batch_size, dim, dim)

required
kind str

the kind of thauma, can be {'min', 'max', 'entropy'}

required
use_tqdm bool

whether to use tqdm for progress bar

False
sqrt_order int

the order of square root approximation

3
pade_order int

the order of Pade approximation

3

Returns:

Name Type Description
ret ndarray

the thauma of quantum state(s)

numqi.magic.get_thauma_boundary(rho, use_tqdm=False)

get the thauma boundary of quantum state using semi-definite programming (SDP)

Parameters:

Name Type Description Default
rho ndarray

the quantum state(s) of shape (dim, dim) or (batch_size, dim, dim)

required
use_tqdm bool

whether to use tqdm for progress bar

False

Returns:

Name Type Description
ret ndarray

the thauma boundary of quantum state(s)