kosmos.quantum_logic.quantum_state¶
Classes¶
- 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.
- Parameters:
Properties
- property rho¶
Density matrix of a state.
- property dim¶
Dimension of rho.
Methods
- validate_density_matrix(rho: numpy.ndarray, tolerance: float = 1e-10) None¶
Verify whether the density matrix represents a quantum state.
- Parameters:
rho (np.ndarray) – Density matrix.
tolerance (float) – Tolerance due to inaccurate calculations. Defaults to 1e-10.
- fidelity_from_rho(target: QuantumState) float¶
Compute Uhlmann fidelity between two states.
- Parameters:
target (QuantumState) – target quantum state.
- Returns:
Fidelity value between 0 and 1.
- Return type:
- 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.
- Parameters:
target_rho (np.ndarray) – Density matrix of the ideal target state.
- Returns:
Fidelity value between 0 and 1:
- Return type: