qig.core
Core quantum information utilities for density matrices and entropy calculations.
Core utilities for the quantum inaccessible game.
This module contains the basic state-manipulation and entropy helpers
used throughout the quantum inaccessible game code:
-
qig.core.partial_trace(rho, dims, keep)[source]
Compute partial trace over all subsystems except ‘keep’.
- Parameters:
rho (array, shape (D, D)) – Density matrix for composite system
dims (list of int) – Dimensions of each subsystem [d1, d2, …]
keep (int) – Index of subsystem to keep (0-indexed)
- Returns:
rho_reduced – Reduced density matrix
- Return type:
array, shape (d_keep, d_keep)
-
qig.core.von_neumann_entropy(rho, regularisation=1e-14)[source]
Compute von Neumann entropy S(rho) = -Tr(rho log rho).
- Parameters:
rho (array, shape (d, d)) – Density matrix
regularisation (float) – Small value added to eigenvalues to avoid log(0)
- Returns:
entropy – Von Neumann entropy
- Return type:
float
-
qig.core.create_lme_state(n_sites, d)[source]
Create a locally maximally entangled (LME) state.
For even n_sites, creates n_sites/2 maximally entangled pairs.
For odd n_sites, leaves one site pure.
- Parameters:
-
- Return type:
Tuple[ndarray, list]
- Returns:
rho (array, shape (d**n_sites, d**n_sites)) – LME state density matrix
dims (list of int) – Dimensions [d, d, …, d]
-
qig.core.marginal_entropies(rho, dims)[source]
Compute marginal entropies for all subsystems.
- Parameters:
rho (array, shape (D, D)) – Joint density matrix
dims (list of int) – Dimensions of subsystems
- Returns:
h – Marginal entropies [h_1, h_2, …]
- Return type:
array, shape (n_sites,)
-
qig.core.generic_decomposition(M)[source]
Decompose Jacobian into symmetric and antisymmetric parts.
M = S + A where S = (M + M^T)/2, A = (M - M^T)/2
- Parameters:
M (array, shape (n, n)) – Jacobian matrix
- Return type:
Tuple[ndarray, ndarray]
- Returns:
S (array, shape (n, n)) – Symmetric part (dissipative)
A (array, shape (n, n)) – Antisymmetric part (conservative)