qsttoolkit.quantum Submodule

Miscellaneous functions for quantum state tomography research.

qsttoolkit.quantum.expectation(rho: Tensor, measurement_operators: list[Tensor]) Tensor[source]

Computes the expectation values of the given density matrix with respect to the given projective measurement operators using purely TensorFlow operations.

Parameters:
  • rho (tf.Tensor) – Density matrix to compute expectation values for.

  • measurement_operators (list of tf.Tensor) – Projective measurement operators to compute the expectation values for.

Returns:

Expectation values of the density matrix with respect to the measurement operators.

Return type:

tf.Tensor

qsttoolkit.quantum.fidelity(rho: ndarray, sigma: ndarray) float[source]

Computes the fidelity between two density matrices.

Parameters:
  • rho (np.ndarray) – First density matrix.

  • sigma (np.ndarray) – Second density matrix.

Returns:

Fidelity between the two density matrices.

Return type:

float

qsttoolkit.quantum.maximally_mixed_state_dm(dim: int) Qobj[source]

Computes the maximally mixed state density matrix in the given Hilbert space dimensionality.

Parameters:

dim (int) – Hilbert space dimensionality.

Returns:

Maximally mixed state density matrix.

Return type:

Qobj

qsttoolkit.quantum.random_positive_semidefinite_dm(dim: int) Qobj[source]

Computes a random positive semi-definite density matrix in the given Hilbert space dimensionality.

Parameters:

dim (int) – Hilbert space dimensionality.

Returns:

Random positive semi-definite density matrix.

Return type:

Qobj