:py:mod:`kosmos.quantum_logic.quantum_state` ============================================ .. py:module:: kosmos.quantum_logic.quantum_state Classes ------- .. py:class:: QuantumState(*, creation_time: int | None = 0, rho: numpy.ndarray | None = None, fidelity: float | None = 0.0) Representation of a quantum state using a density matrix. Initialize and validate density matrix and validity of state. :param creation_time: Timestamp of creation. Defaults to 0. :type creation_time: int | None :param rho: Density matrix of a quantum register. Defaults to None. :type rho: np.ndarray | None :param fidelity: Fidelity value of a quantum register. Defaults to 0.0. :type fidelity: float | None | .. rubric:: Properties .. py:property:: rho Density matrix of a state. .. py:property:: dim Dimension of rho. | .. rubric:: Methods .. py:method:: validate_density_matrix(rho: numpy.ndarray, tolerance: float = 1e-10) -> None Verify whether the density matrix represents a quantum state. :param rho: Density matrix. :type rho: np.ndarray :param tolerance: Tolerance due to inaccurate calculations. Defaults to 1e-10. :type tolerance: float .. py:method:: fidelity_from_rho(target: QuantumState) -> float Compute Uhlmann fidelity between two states. :param target: target quantum state. :type target: QuantumState :returns: Fidelity value between 0 and 1. :rtype: float .. py:method:: fidelity_with_target(target_rho: numpy.ndarray) -> float Compute fidelity between this state and an ideal target state. How close is the actual state to the ideal state. :param target_rho: Density matrix of the ideal target state. :type target_rho: np.ndarray :returns: Fidelity value between 0 and 1: :rtype: float