Template Function Pennylane::Util::computePurityFromParts¶
Defined in File Util.hpp
Function Documentation¶
-
template<class ComplexT>
inline auto Pennylane::Util::computePurityFromParts(const std::vector<std::vector<ComplexT>> &released_parts) -> std::decay_t<decltype(std::declval<ComplexT>().real())>¶ Compute purity of the released subsystem from released parts.
Purity Tr(ρ^2) measures how pure a quantum state is:
Tr(ρ^2) = 1: pure state (not entangled with active qubits)
Tr(ρ^2) < 1: mixed state (entangled)
See https://en.wikipedia.org/wiki/Purity_(quantum_mechanics) for details.
Formula: Tr(ρ^2) = Σ_i,j |Σ_a released_parts[a][i] * conj(released_parts[a][j])|^2 Where a indexes over active states.
- Template Parameters:
ComplexT – Complex number type
- Parameters:
released_parts – Vector of released parts indexed by active state {active -> [released] for all active \in active states}
- Returns:
Purity value
api/function_Util_8hpp_1a02ea114b09d1c859e004cd7523153060
Download Python script
Download Notebook
View on GitHub