Skip to content

CHA model

Convex Hull Approximation (CHA)

Accessible in both numqi.entangle (recommended) and numqi.entangle.cha

numqi.entangle.CHABoundaryBagging

Convex Hull Approximation with Bagging

Separability-entanglement classifier via machine learning doi-link

__init__(dim, num_state=None, solver=None)

initialize the model

Parameters:

Name Type Description Default
dim tuple[int]

dimension of the bipartite system, len(dim) must be 2

required
num_state int

number of states in the convex hull, default to 2(dim[0]dim[1])**2

None

solve(dm, maxiter=150, norm2_init=1, decay_rate=0.97, threshold=1e-07, num_init_retry=10, use_tqdm=False, return_info=False, seed=None)

solve the convex hull approximation

Parameters:

Name Type Description Default
dm ndarray

target density matrix

required
maxiter int

maximum number of iterations, default to 150

150
norm2_init float

initial norm2 bound, default to 1

1
decay_rate float

decay rate of the norm2 bound, default to 0.97

0.97
threshold float

threshold for the probability, default to 1e-7. if solver=MOSEK, then a more precise threshold is required, otherwise the solver will fail sometimes

1e-07
num_init_retry int

number of retries for the initial state, default to 10

10
use_tqdm bool

use tqdm, default to False

False
return_info bool

return the information of the optimization, default to False

False
seed int

random seed, default to None

None

Returns:

Name Type Description
beta float

the optimal beta, boundary length

info tuple[ndarray, ndarray, ndarray, ndarray]

the information of the optimization

numqi.entangle.AutodiffCHAREE

Bases: Module

Gradient descent model for convex hull approximation to separable states

__init__(dim, num_state=None, distance_kind='ree')

initialize the model

Parameters:

Name Type Description Default
dim tuple[int]

dimension of the bipartite system, len(dim) must be 2

required
num_state int

number of states in the convex hull, default to 2dim0dim1 (seems to work well)

None
distance_kind str

'gellmann' or 'ree', default to 'ree'

'ree'

get_boundary(dm0, xtol=0.0001, converge_tol=1e-10, threshold=1e-07, num_repeat=1, use_tqdm=True, return_info=False, seed=None)

get the boundary of the convex hull approximation

Parameters:

Name Type Description Default
dm0 ndarray

initial density matrix

required
xtol float

tolerance for the bisection, default to 1e-4

0.0001
converge_tol float

tolerance for the optimization, default to 1e-10

1e-10
threshold float

threshold for the probability, default to 1e-7

1e-07
num_repeat int

number of repeats for the optimization, default to 1

1
use_tqdm bool

use tqdm, default to True

True
return_info bool

return the information of the optimization, default to False

False
seed int

random seed, default to None

None

Returns:

Name Type Description
beta float

the optimal beta, boundary length

info ndarray

the information of the optimization

get_numerical_range(op0, op1, num_theta=400, converge_tol=1e-05, num_repeat=1, use_tqdm=True, seed=None)

get the numerical range of the two Hermitian operators

Parameters:

Name Type Description Default
op0 ndarray

the first Hermitian operator

required
op1 ndarray

the second Hermitian operator

required
num_theta int

number of theta, default to 400

400
converge_tol float

tolerance for the optimization, default to 1e-5

1e-05
num_repeat int

number of repeats for the optimization, default to 1

1
use_tqdm bool

use tqdm, default to True

True
seed int

random seed, default to None

None

Returns:

Name Type Description
ret ndarray

the numerical range of the two Hermitian operators, shape=(num_theta,2)

set_dm_target(rho)

set the target density matrix

Parameters:

Name Type Description Default
rho ndarray

target density matrix

required

set_expectation_op(op)

set the expectation operator

Parameters:

Name Type Description Default
op ndarray

the expectation operator

required