Skip to content

entangle

numqi.entangle

numqi.entangle.hf_interpolate_dm(rho, alpha=None, beta=None, dm_norm=None)

interpolate the density matrix between rho and the maximally mixed state

Parameters:

Name Type Description Default
rho ndarray

density matrix, ndim=2

required
alpha (float, None)

rho0*(1-alpha) + rho*alpha, return rho itself if alpha=1, and maximally mixed state if alpha=0, if None, then use beta

None
beta (float, None)

rho0 + beta*unit(rho0), beta reflects the vector length in Gell-Mann basis, if None, then use alpha

None
dm_norm (float, None)

norm of the density matrix. if None, then calculate it internally

None

Returns:

Name Type Description
ret ndarray

interpolated density matrix, ndim=2

WARNING: rename to numqi.utils.hf_interpolate_dm

numqi.entangle.get_dm_numerical_range(op0, op1, num_point=100)

return the joint algebra numerical range of two Hermitian operators (projection)

Parameters:

Name Type Description Default
op0 ndarray

Hermitian operator, ndim=2

required
op1 ndarray

Hermitian operator, ndim=2

required
num_point int

number of points to sample

100

Returns:

Name Type Description
ret ndarray

joint algebra numerical range, ndim=2, shape=(num_point,2)

numqi.entangle.get_negativity(rho, dim)

return the negativity of the density matrix wiki-link

Parameters:

Name Type Description Default
rho ndarray

density matrix, ndim=2

required
dim tuple[int]

dimension of the density matrix, (dimA,dimB)

required

Returns:

Name Type Description
ret float

negativity of the density matrix

numqi.entangle.check_reduction_witness(rho, dim, eps=-1e-07)

return whether the density matrix passes the reduction criterion quantiki-link

weaker than PPT

TODO, can positive linear map be parameterized

Parameters:

Name Type Description Default
rho ndarray

density matrix, ndim=2

required
dim tuple[int]

dimension of the density matrix, (dimA,dimB,dimC,...)

required
eps float

threshold for the reduction witness. if min(eig(X))>eps, then we say X is positive

-1e-07

Returns:

Name Type Description
ret bool

whether the density matrix passes the reduction criterion

numqi.entangle.check_swap_witness(rho, eps=-1e-07)

return whether the density matrix passes the swap witness criterion

Parameters:

Name Type Description Default
rho ndarray

density matrix, ndim=2

required
eps float

threshold for the swap witness

-1e-07

Returns:

Name Type Description
ret bool

whether the density matrix passes the swap witness criterion

numqi.entangle.get_density_matrix_plane(op0, op1)

return the plane spanned by two Hermitian operators

Parameters:

Name Type Description Default
op0 ndarray

Hermitian operator, ndim=2, no need to be unit trace

required
op1 ndarray

Hermitian operator, ndim=2, no need to be unit trace

required

Returns:

Name Type Description
theta1 float

angle between op0 and op1 in the Gell-Mann basis

hf0 function

function to generate the density matrix on the plane. function signature: hf0(theta_or_xy:float|tuple[float], norm:float=1) -> np.ndarray. if theta_or_xy is a float, then return the density matrix with the given angle and norm. if theta_or_xy is a tuple, then return the density matrix with the given x,y in the plane.

numqi.entangle.get_density_matrix_boundary(dm, dm_norm=None)

return the boundary of the density matrix

Parameters:

Name Type Description Default
dm ndarray

density matrix, 2d array (support batch)

required
dm_norm (float, NoneType)

norm of the density matrix. if None, then calculate it internally

None

Returns:

Name Type Description
beta_l float

minimum value of beta

beta_u float

maximum value of beta

numqi.entangle.get_dm_cross_section_moment(op0, op1, order=1, quad_epsrel=1e-08, dim=None, kind='dm')

return the moment of the cross section of the density matrix or PPT boundary spanned by two Hermitian operators

Parameters:

Name Type Description Default
op0 ndarray

traceless Hermitian operators, ndim=2

required
op1 ndarray

traceless Hermitian operators, ndim=2

required
order int

order of the moment, for dimension=3/4/5, order=1 is enough. larger order might be needed for larger dimension

1
quad_epsrel float

relative tolerance for the quadrature

1e-08
dim None | tuple[int]

dimension of the density matrix, (dimA,dimB), only used when kind='ppt'

None
kind str

'dm' for density matrix, 'ppt' for PPT boundary

'dm'

Returns:

Name Type Description
ret ndarray

moment of the cross section of the density matrix or PPT boundary, ndim=1

numqi.entangle.is_dm_cross_section_similar(moment0, moment1, zero_eps=0.001)

return whether two moments are similar

Parameters:

Name Type Description Default
moment0 ndarray

moment of the cross section of the density matrix, ndim=1

required
moment1 ndarray

moment of the cross section of the density matrix, ndim=1

required
zero_eps float

threshold for zero

0.001

Returns:

Name Type Description
ret bool

whether two moments are similar

numqi.entangle.group_dm_cross_section_moment(moment, zero_eps=0.0001)

group the moments of the cross section of the density matrix

Parameters:

Name Type Description Default
moment ndarray

moments of the cross section of the density matrix, ndim=2

required
zero_eps float

threshold for zero

0.0001

Returns:

Name Type Description
group_list list[list[int]]

list of groups of indices