qig.pair_operators
Bell states, Gell-Mann generators, and two-qubit operators.
Operator bases for entangled pairs in quantum exponential families.
This module provides generators for su(d²) Lie algebras, which act on the Hilbert space of a pair of d-level systems (e.g., two qubits for d=2). These operators can generate entangled states, unlike local operators.
- qig.pair_operators.gell_mann_generators(d)[source]
Generate the d²-1 Gell-Mann matrices for su(d).
These are traceless Hermitian matrices that generalize the Pauli matrices. For d=2, this gives the three Pauli matrices. For d=3, this gives the eight Gell-Mann matrices.
The construction follows the standard pattern:
Symmetric matrices:
|j⟩⟨k| + |k⟩⟨j|for j < kAntisymmetric matrices:
-i(|j⟩⟨k| - |k⟩⟨j|)for j < kDiagonal matrices:
sum_{l=0}^{j-1} |l⟩⟨l| - j|j⟩⟨j|for j = 1,…,d-1
- Parameters:
d (
int) – Dimension of the Hilbert space- Returns:
List of d²-1 traceless Hermitian matrices of size d×d
- Return type:
List[np.ndarray]
Notes
The matrices are normalized to have Tr(λ_a λ_b) = 2δ_{ab}.
- qig.pair_operators.pair_basis_generators(d)[source]
Generate su(d²) generators for a pair of d-level systems.
These act on the d²-dimensional Hilbert space of a pair (e.g., two qubits give d=2, d²=4, with 15 generators in su(4)).
- Parameters:
d (
int) – Dimension of each individual system (e.g., 2 for qubits, 3 for qutrits)- Returns:
List of d⁴-1 traceless Hermitian matrices of size d²×d²
- Return type:
List[np.ndarray]
Examples
>>> # For a qubit pair >>> generators = pair_basis_generators(d=2) >>> len(generators) 15 >>> generators[0].shape (4, 4)
- qig.pair_operators.bell_state(d, k=0)[source]
Create a maximally entangled state for a pair of d-level systems.
Returns the state vector
|Φₖ⟩ = (1/√d) ∑_{j=0}^{d-1} |j, (j+k) mod d⟩.For k=0, this is the standard Bell state
(1/√d) ∑_j |jj⟩.- Parameters:
- Returns:
State vector of length d², normalized
- Return type:
np.ndarray
Notes
All d Bell states are maximally entangled with the same properties: - Global purity: S(ρ) = 0 - Marginals: ρ_A = ρ_B = I/d - Entanglement: maximal for dimension d
The states are mutually orthogonal:
⟨Φₖ|Φₗ⟩ = δₖₗExamples
>>> psi = bell_state(d=2, k=0) # |00⟩ + |11⟩ >>> psi array([0.70710678+0.j, 0. +0.j, 0. +0.j, 0.70710678+0.j])
>>> psi = bell_state(d=2, k=1) # |01⟩ + |10⟩ >>> psi array([0. +0.j, 0.70710678+0.j, 0.70710678+0.j, 0. +0.j])
- qig.pair_operators.bell_state_density_matrix(d)[source]
Create the density matrix of a maximally entangled pair state.
Returns
ρ = |Φ⟩⟨Φ|where|Φ⟩ = (1/√d) ∑_j |jj⟩.This is a pure state (Tr(ρ²) = 1) that is globally pure but locally maximally mixed: both marginals have entropy log(d).
- Parameters:
d (
int) – Dimension of each subsystem- Returns:
Density matrix of size d²×d², positive semidefinite with trace 1
- Return type:
np.ndarray
Notes
Properties of the Bell state: - Global purity: S(ρ) = 0 - Local marginals: ρ_A = ρ_B = I/d (maximally mixed) - Marginal entropies: S(ρ_A) = S(ρ_B) = log(d) - Mutual information: I = 2log(d) (maximal)
- qig.pair_operators.multi_pair_basis(n_pairs, d)[source]
Generate direct sum operator basis for n independent pairs.
Creates operators of the form F_α^(k) = I ⊗ … ⊗ F_α ⊗ … ⊗ I, where F_α is at position k.
- Parameters:
- Return type:
- Returns:
operators (
List[np.ndarray]) – List of n(d⁴-1) operators, each of size (d²)ⁿ × (d²)ⁿpair_indices (
List[int]) – Index of which pair each operator acts on
Notes
The resulting Fisher metric will be block-diagonal, with one block per pair. Cross-pair elements vanish: G_{(k,i),(k’,j)} = 0 for k≠k’.
Examples
>>> # Two qubit pairs >>> ops, indices = multi_pair_basis(n_pairs=2, d=2) >>> len(ops) 30 >>> ops[0].shape (16, 16) >>> indices[:15] # First 15 operators act on pair 0 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] >>> indices[15:] # Next 15 operators act on pair 1 [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
- qig.pair_operators.product_of_bell_states(n_pairs, d, bell_indices=None)[source]
Create a product state of n maximally entangled pairs.
Returns
|Ψ⟩ = |Φₖ₁⟩⊗|Φₖ₂⟩⊗...⊗|Φₖₙ⟩where each|Φₖ⟩is a Bell state.- Parameters:
- Returns:
State vector of length (d²)ⁿ
- Return type:
np.ndarray
Notes
This is the “origin” of the inaccessible game. Properties: - Globally pure: S(ρ) = 0 - All 2n marginals maximally mixed: S(ρ_i) = log(d) for all i - Pairs are entangled, but no cross-pair entanglement - Total marginal entropy: C = 2n·log(d)
Different
bell_indicesgive orthogonal product states that share the same constraint value C and marginal entropies, but represent different “origins” in the exponential family.Examples
>>> # Standard: |Φ₀⟩⊗|Φ₀⟩ = (|00⟩+|11⟩)⊗(|00⟩+|11⟩) >>> psi = product_of_bell_states(n_pairs=2, d=2)
>>> # Mixed: |Φ₀⟩⊗|Φ₁⟩ = (|00⟩+|11⟩)⊗(|01⟩+|10⟩) >>> psi = product_of_bell_states(n_pairs=2, d=2, bell_indices=[0, 1])