pygsti.tools.jamiolkowski

Utility functions related to the Choi representation of gates.

Module Contents

Functions

jamiolkowski_iso(operation_mx, op_mx_basis='pp', choi_mx_basis='pp')

Given a operation matrix, return the corresponding Choi matrix that is normalized to have trace == 1.

jamiolkowski_iso_inv(choi_mx, choi_mx_basis='pp', op_mx_basis='pp')

Given a choi matrix, return the corresponding operation matrix.

fast_jamiolkowski_iso_std(operation_mx, op_mx_basis)

The corresponding Choi matrix in the standard basis that is normalized to have trace == 1.

fast_jamiolkowski_iso_std_inv(choi_mx, op_mx_basis)

Given a choi matrix in the standard basis, return the corresponding operation matrix.

sum_of_negative_choi_eigenvalues(model, weights=None)

Compute the amount of non-CP-ness of a model.

sums_of_negative_choi_eigenvalues(model)

Compute the amount of non-CP-ness of a model.

magnitudes_of_negative_choi_eigenvalues(model)

Compute the magnitudes of the negative eigenvalues of the Choi matricies for each gate in model.

pygsti.tools.jamiolkowski.jamiolkowski_iso(operation_mx, op_mx_basis='pp', choi_mx_basis='pp')

Given a operation matrix, return the corresponding Choi matrix that is normalized to have trace == 1.

Parameters
  • operation_mx (numpy array) – the operation matrix to compute Choi matrix of.

  • op_mx_basis (Basis object) – The source and destination basis, respectively. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt) (or a custom basis object).

  • choi_mx_basis (Basis object) – The source and destination basis, respectively. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt) (or a custom basis object).

Returns

numpy array – the Choi matrix, normalized to have trace == 1, in the desired basis.

pygsti.tools.jamiolkowski.jamiolkowski_iso_inv(choi_mx, choi_mx_basis='pp', op_mx_basis='pp')

Given a choi matrix, return the corresponding operation matrix.

This function performs the inverse of :function:`jamiolkowski_iso`.

Parameters
  • choi_mx (numpy array) – the Choi matrix, normalized to have trace == 1, to compute operation matrix for.

  • choi_mx_basis (Basis object) – The source and destination basis, respectively. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt) (or a custom basis object).

  • op_mx_basis (Basis object) – The source and destination basis, respectively. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt) (or a custom basis object).

Returns

numpy array – operation matrix in the desired basis.

pygsti.tools.jamiolkowski.fast_jamiolkowski_iso_std(operation_mx, op_mx_basis)

The corresponding Choi matrix in the standard basis that is normalized to have trace == 1.

This routine only computes the case of the Choi matrix being in the standard (matrix unit) basis, but does so more quickly than jamiolkowski_iso() and so is particuarly useful when only the eigenvalues of the Choi matrix are needed.

Parameters
  • operation_mx (numpy array) – the operation matrix to compute Choi matrix of.

  • op_mx_basis (Basis object) – The source and destination basis, respectively. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt) (or a custom basis object).

Returns

numpy array – the Choi matrix, normalized to have trace == 1, in the std basis.

pygsti.tools.jamiolkowski.fast_jamiolkowski_iso_std_inv(choi_mx, op_mx_basis)

Given a choi matrix in the standard basis, return the corresponding operation matrix.

This function performs the inverse of :function:`fast_jamiolkowski_iso_std`.

Parameters
  • choi_mx (numpy array) – the Choi matrix in the standard (matrix units) basis, normalized to have trace == 1, to compute operation matrix for.

  • op_mx_basis (Basis object) – The source and destination basis, respectively. Allowed values are Matrix-unit (std), Gell-Mann (gm), Pauli-product (pp), and Qutrit (qt) (or a custom basis object).

Returns

numpy array – operation matrix in the desired basis.

pygsti.tools.jamiolkowski.sum_of_negative_choi_eigenvalues(model, weights=None)

Compute the amount of non-CP-ness of a model.

This is defined (somewhat arbitarily) by summing the negative eigenvalues of the Choi matrix for each gate in model.

Parameters
  • model (Model) – The model to act on.

  • weights (dict) – A dictionary of weights used to multiply the negative eigenvalues of different gates. Keys are operation labels, values are floating point numbers.

Returns

float – the sum of negative eigenvalues of the Choi matrix for each gate.

pygsti.tools.jamiolkowski.sums_of_negative_choi_eigenvalues(model)

Compute the amount of non-CP-ness of a model.

This is defined (somewhat arbitarily) by summing the negative eigenvalues of the Choi matrix for each gate in model separately. This function is different from :function:`sum_of_negative_choi_eigenvalues` in that it returns sums separately for each operation of model.

Parameters

model (Model) – The model to act on.

Returns

list of floats – each element == sum of the negative eigenvalues of the Choi matrix for the corresponding gate (as ordered by model.operations.iteritems()).

pygsti.tools.jamiolkowski.magnitudes_of_negative_choi_eigenvalues(model)

Compute the magnitudes of the negative eigenvalues of the Choi matricies for each gate in model.

Parameters

model (Model) – The model to act on.

Returns

list of floats – list of the magnitues of all negative Choi eigenvalues. The length of this list will vary based on how many negative eigenvalues are found, as positive eigenvalues contribute nothing to this list.