entanglish.DenMatPertTheory module

class entanglish.DenMatPertTheory.DenMatPertTheory(dm0_eigen_sys, del_dm, verbose=False)[source]

Bases: object

DenMat, dm, den_mat all stand for density matrix.

This class performs operations associated with perturbation theory ( more precisely, second order, time-independent perturbation theory in quantum mechanics) of the eigenvalues and eigenvectors of a density matrix.

In quantum mechanics, such perturbation theory is used to approximate the eigenvalues and eigenvectors of a Hamiltonian H

H = H0 + V,

when the evas and evecs of H0 are known exactly. Pert theory only depends on the fact that H is Hermitian. Since a density matrix dm

dm = dm0 + del_dm

is Hermitian too, pert theory can be used for density matrices as well as for Hamiltonians. The question is, what to use for dm0? The constructor of this class (__init__) leaves that question unanswered. However, the static function DenMatPertTheory.new_with_separable_dm0() answers this question. It takes a density matrix dm as input, and returns an object of this class, i.e., DenMatPertTheory, assuming that dm0 equals the Kronecker product of the one-axis marginals of dm.

The marginals of a square array arr is defined as a list of partial traces of arr. The n’th item in the list of marginals is the partial trace of arr, traced over all qudits except the n’th. The Kronecker product of the marginals of arr is a “separable” density matrix, in the sense that there is no correlation among its qudits.

Each marginal is the density matrix of a qudit, so it is a d x d matrix, where d is the number of states of the qudit. If d is small for all the marginals, it is much easier to diagonalize every marginal than to diagonalize the whole density matrix dm. So it is reasonable to assume that the evas and evecs of dm0 can be calculated easily exactly. We wish to use those evas and evecs to approximate perturbatively the evas and evecs of dm.

We will call an eigensystem of a density matrix: a tuple, whose first item is a 1D numpy array, call it evas, with the eigenvalues of the density matrix, and the second item is a 2D numpy array, call it eigen_cols, whose i’th columns is an eigenvector for the i’th eigenvalue (i.e., evas[i]) of the density matrix.

See Ref.1 for a more detailed explanation of the algos used in this class.

References

1. R.R. Tucci, “A New Algorithm for Calculating Squashed Entanglement and a Python Implementation Thereof”

Variables:
  • del_dm (DenMat) – defined above
  • del_dm_in_sbasis (DenMat) – del_dm is in inbasis. It is convenient to change it to sbasis ( separable basis) so that if v1 = dm0_eigen_sys[1][n1] and v2 = dm0_eigen_sys[1][n2] then del_dm_in_sbasis[n1, n2] = <v1| del_dm |v2>
  • dm0_eigen_sys (tuple[np.ndarray, np.ndarray]) – eigensystem of density matrix dm0.
  • evas_of_dm_to_2nd_order (np.ndarray) – 1D array of floats. Eigenvalues of dm to second order.
  • evec_cols_of_dm_to_2nd_order (np.ndarray) – This is a unitary matrix with (a second order approx of) the eigenvectors of dm as columns. If this matrix is U, the dm pprox UDU^dag, where D is diagonal and U^dag is the Hermitian conjugate of U.
  • verbose (bool) –
__init__(dm0_eigen_sys, del_dm, verbose=False)[source]

Constructor

Parameters:
  • dm0_eigen_sys (tuple[np.ndarray, np.ndarray]) –
  • del_dm (DenMat) –
  • verbose (bool) –
diagonalize_del_dm_in_sbasis_in_degenerate_spaces()[source]

This function performs a similarity transformation on del_dm_in_sbasis so that it is diagonal on the subspaces of eigenvectors with degerate eigenvalues of dm0. After this transformation, if j != k and evas[j] = evas[k] then del_dm_in_sbasis[j, k] = 0, where evas are the eigenvalues of dm0. This is called degenerate 2nd order perturbation theory.

Returns:
Return type:None
static do_bstrap(dm0_eigen_sys, del_dm, num_steps=1, verbose=False)[source]

If we define sub_del_dm = del_dm/num_steps, then this method calculates an eigensystem for dm0 + sub_del_dm*(k+1) from the eigensystem for dm0 + sub_del_dm*k for k = 0, 1, 2, …, num_steps-1. This produces a “bootstrap sequence of eigensystems” that is num_steps steps long. This method returns the final eigensystem of that bootstrap sequence.

Parameters:
  • dm0_eigen_sys (tuple[np.ndarray, np.ndarray]) –
  • del_dm (DenMat) –
  • num_steps (int) –
  • verbose (bool) –
Returns:

Return type:

tuple[np.ndaray, np.ndarray]

static do_bstrap_with_separable_dm0(dm, num_steps=1, verbose=False)[source]

This method returns the same thing as the method (found in its parent class) DenMatPertTheory.do_bstrap( ). However, their names differ by a ‘_with_separable_dm0’ at the end and their inputs are different. This one takes as input a density matrix dm and calculates dm0_eigen_sys and del_dm from that, assuming that dm0 is the Kronecker product of the marginals of dm.

Parameters:
  • dm (DenMat) –
  • num_steps (int) –
  • verbose (bool) –
Returns:

Return type:

tuple[np.ndaray, np.ndarray]

get_dm0()[source]

This method returns the unperturbed density matrix dm0. We define this method so as to avoid storing dm0.

Returns:
Return type:DenMat
static new_with_separable_dm0(dm, verbose=False)[source]

This method returns a DenMatPertTheory built from a density matrix dm, assuming that dm0 is the Kronecker product of the marginals of dm.

Parameters:
  • dm (DenMat) –
  • verbose (bool) –
Returns:

Return type:

DenMatPertTheory

set_evas_of_dm_to_2nd_order()[source]

This function sets the class attribute evas_of_dm_to_2nd_order (the eigenvalues of dm, to second order in pert theory). Actually, since it’s not that difficult to go from 2nd to 3rd order perturbation for eigenvalues (for the eigenvectors it is more difficult), we calculate the 3rd order approx for evas.

Formulas used here come from the Wikipedia article Ref.1. That article has a figure containing the eigenvalues and eigenvectors to fifth order in perturbation theory!

References

1. https://en.wikipedia.org/wiki/Perturbation_theory_(quantum_mechanics)

Returns:
Return type:None
set_evec_cols_of_dm_to_2nd_order()[source]

This function sets the class attribute evec_cols_of_dm_to_2nd_order (a matrix with the eigenvectors, as columns, of dm, to second order in pert theory).

Formulas used here come from the Wikipedia article Ref.1. That article has a figure containing the eigenvalues and eigenvectors to fifth order in perturbation theory!

References

1. https://en.wikipedia.org/wiki/Perturbation_theory_(quantum_mechanics)

Returns:
Return type:None