entanglish.EntangCase module

class entanglish.EntangCase.EntangCase(num_row_axes, approx='eigen', num_bstrap_steps=1, verbose=False)[source]

Bases: object

This is an abstract class meant to be overridden. It is the parent class of classes PureStEnt and SquashedEnt, which calculate quantum entanglement for pure and mixed states using various methods. This class contains methods useful to all of its children. For example, it contains methods that construct an entanglement profile data structure and print it.

Variables:
  • approx (str) – approx used to calculate the (natural) log of a density matrix that appears in the definition of the von Neumann entropy. This parameter can be either ‘eigen’, ‘pade’, ‘pert’.
  • num_bstrap_steps (int) – number bootstrap steps used in perturbation theory. Only used if approx = ‘pert’
  • num_row_axes (int) – number of row axes, same as number of qudits, equal to len( row_shape) of a DenMat
  • verbose (bool) –
__init__(num_row_axes, approx='eigen', num_bstrap_steps=1, verbose=False)[source]

Constructor

Parameters:
  • num_row_axes (int) –
  • approx (str) –
  • num_bstrap_steps (int) –
  • verbose (bool) –
static check_max_entang_st(st)[source]

This method checks that the object st of class MaxEntangState does indeed carry maximal entanglement. The entanglement is calculated 3 different ways (von Neumann entropy of 2 partial traces of density matrix, and from known value) and the 3 values are checked to agree.

Parameters:st (MaxEntangState) –
Returns:
Return type:None
exp(dm, approx=None)[source]

This method is a simple wrapper for dm.exp() so that all usages inside the class utilize approx=self.approx if approx!=None.

Parameters:
  • dm (DenMat) –
  • approx (str) –
Returns:

Return type:

DenMat

get_entang(axes_subset)[source]

This is an abstract method that should be overridden by the children of the class.

Parameters:axes_subset (set[int]) – the entanglement is calculated for parts axes_subset and its complement
Returns:
Return type:float
get_entang_profile()[source]

This method constructs a dictionary that we call an entanglement profile. Given a state with num_row_axes qudits, this method calculates a (bipartite) entanglement for each possible bi-partition of range( num_row_axes). By a bi-partition we mean two nonempty disjoint subsets whose union is range(num_row_axes). An entanglement profile is a dictionary mapping bi-partition half-size to a dictionary that maps each bi-partition of that half-size to its entanglement.

Returns:
Return type:dict[int, dict[tuple[int], float]]
static get_max_entag(row_shape, x_axes, y_axes)[source]

This method returns the maximum possible entanglement with parts x_axes, y_axes. x_axes, y_axes give a bi-partition of range( len( row_shape)). If num_vals_min = min(num_vals_x, num_vals_y), then max-entang is the log of num_vals_min.

Parameters:
  • row_shape (tuple[int]) –
  • x_axes (list{int]) –
  • y_axes (list{int]) –
Returns:

Return type:

float

log(dm, approx=None, eps=None, clip_to_zero=False)[source]

This method is a simple wrapper for dm.log() so that all usages inside the class utilize approx=self.approx if approx!=None.

Parameters:
  • dm (DenMat) –
  • approx (str|None) –
  • eps (float | None) –
  • clip_to_zero (bool) –
Returns:

Return type:

DenMat

mirror(x)[source]

Given an element of the list range(self.num_row_axes), this method returns the mirror image of x with respect to the center of the list.

Parameters:x (int) –
Returns:
Return type:int
mirror_many(xx)[source]

This applies the method self.mirror() to each element of a list, set, tuple

Parameters:xx (tuple[int]|set[int]|list[int]) –
Returns:
Return type:tuple[int]|set[int]|list[int]
print_entang_profiles(profile_list, row_shape=None)[source]

This method takes as input a list of entanglement profiles. Each element of that list can be generated with the method get_entang_profile(). The method prints, side by side, all the entanglement profiles in the input profile list. If a row_shape is provided, the last column of the profile is the maximum entanglement.

Parameters:
  • profile_list (list[dict[int, dict[tuple[int], float]]]) –
  • row_shape (tuple[int]) –
Returns:

Return type:

None

sqrt(dm, approx=None)[source]

This method is a simple wrapper for dm.sqrt() so that all usages inside the class utilize approx=self.approx if approx!=None.

Parameters:
  • dm (DenMat) –
  • approx (str) –
Returns:

Return type:

DenMat