Structure Constants Module

Structure constants for Lie algebras.

This module provides functions to compute and verify structure constants f_abc for Lie algebras, where [F_a, F_b] = 2i Σ_c f_abc F_c.

The structure constants encode the commutation relations of the algebra and are fundamental for extracting the effective Hamiltonian in the GENERIC decomposition.

qig.structure_constants.compute_structure_constants(operators, tol=1e-10)[source]

Compute structure constants f_abc for a list of operators {F_a}.

The structure constants satisfy: [F_a, F_b] = 2i Σ_c f_abc F_c

Parameters:
  • operators (List[np.ndarray]) – List of operators (Hermitian, traceless generators)

  • tol (float) – Tolerance for considering entries as zero

Returns:

f_abc – Structure constants

Return type:

np.ndarray, shape (n, n, n)

Notes

The normalization convention is: [F_a, F_b] = 2i Σ_c f_abc F_c

For each pair (a,b), we: 1. Compute commutator [F_a, F_b] 2. Project onto each basis element F_c 3. Extract coefficient f_abc

The projection uses: f_abc = Tr([F_a,F_b] F_c) / (2i Tr(F_c F_c))

qig.structure_constants.verify_lie_algebra(operators, f_abc, tol=1e-08)[source]

Verify that operators and structure constants satisfy Lie algebra relations.

Checks: [F_a, F_b] = 2i Σ_c f_abc F_c

Parameters:
  • operators (List[np.ndarray]) – List of operators

  • f_abc (np.ndarray, shape (n, n, n)) – Structure constants

  • tol (float) – Tolerance for verification

Returns:

report – Validation report with all checks

Return type:

ValidationReport

qig.structure_constants.verify_jacobi_identity(f_abc, tol=1e-08)[source]

Verify Jacobi identity for structure constants.

Checks: Σ_d (f_abd f_dce + f_bcd f_dae + f_cad f_dbe) = 0 for all a,b,c,e

Parameters:
  • f_abc (np.ndarray, shape (n, n, n)) – Structure constants

  • tol (float) – Tolerance for verification

Returns:

report – Validation report with Jacobi identity check

Return type:

ValidationReport

Notes

The Jacobi identity is equivalent to: [F_a, [F_b, F_c]] + [F_b, [F_c, F_a]] + [F_c, [F_a, F_b]] = 0

qig.structure_constants.verify_antisymmetry(f_abc, tol=1e-10)[source]

Verify antisymmetry of structure constants.

Checks: f_abc = -f_bac

Parameters:
  • f_abc (np.ndarray, shape (n, n, n)) – Structure constants

  • tol (float) – Tolerance for verification

Returns:

report – Validation report with antisymmetry check

Return type:

ValidationReport

qig.structure_constants.get_cached_structure_constants(algebra_type)[source]

Get cached structure constants for common algebras.

Parameters:

algebra_type (str) – Type of algebra: “su2” or “su3”

Returns:

f_abc – Cached structure constants, or None if not in cache

Return type:

np.ndarray or None

qig.structure_constants.cache_structure_constants(algebra_type, f_abc)[source]

Cache structure constants for reuse.

Parameters:
  • algebra_type (str) – Type of algebra

  • f_abc (np.ndarray) – Structure constants to cache

qig.structure_constants.compute_and_cache_structure_constants(operators, algebra_type, force_recompute=False, tol=1e-10)[source]

Compute structure constants with caching.

Parameters:
  • operators (List[np.ndarray]) – List of operators

  • algebra_type (str) – Type of algebra (for caching)

  • force_recompute (bool) – If True, recompute even if cached

  • tol (float) – Tolerance for computation

Returns:

f_abc – Structure constants

Return type:

np.ndarray

qig.structure_constants.verify_all_properties(f_abc, operators=None, algebra_name='unknown', tol_antisymmetry=1e-10, tol_jacobi=1e-08, tol_commutator=1e-08)[source]

Run all verification checks on structure constants.

Parameters:
  • f_abc (np.ndarray) – Structure constants

  • operators (List[np.ndarray], optional) – Operators (if provided, verify commutator relations)

  • algebra_name (str) – Name for reporting

  • tol_antisymmetry (float) – Tolerance for antisymmetry check

  • tol_jacobi (float) – Tolerance for Jacobi identity

  • tol_commutator (float) – Tolerance for commutator verification

Returns:

report – Combined validation report

Return type:

ValidationReport

Overview

This module provides functions to compute and verify structure constants for Lie algebras, which are fundamental for the GENERIC decomposition procedure.

For a Lie algebra with generators {F_a}, the structure constants f_abc satisfy:

\[[F_a, F_b] = 2i \sum_c f_{abc} F_c\]

The structure constants encode all commutation relations of the algebra and are used to extract the effective Hamiltonian in the GENERIC decomposition.

Examples

Computing Structure Constants

For Pauli matrices (SU(2)):

from qig.exponential_family import pauli_basis
from qig.structure_constants import compute_structure_constants

# Get Pauli operators for single qubit
operators = pauli_basis(0, 1)

# Compute structure constants
f_abc = compute_structure_constants(operators)

# Should be 3x3x3 for SU(2)
print(f_abc.shape)  # (3, 3, 3)

# Check specific value: f_123 = 1
print(f_abc[0, 1, 2])  # 1.0

For Gell-Mann matrices (SU(3)):

from qig.exponential_family import gell_mann_matrices
from qig.structure_constants import compute_structure_constants

# Get Gell-Mann generators
operators = gell_mann_matrices()

# Compute structure constants
f_abc = compute_structure_constants(operators)

# Should be 8x8x8 for SU(3)
print(f_abc.shape)  # (8, 8, 8)

Verification

Verify all properties of structure constants:

from qig.structure_constants import (
    compute_structure_constants,
    verify_all_properties
)
from qig.exponential_family import pauli_basis

operators = pauli_basis(0, 1)
f_abc = compute_structure_constants(operators)

# Verify antisymmetry, Jacobi identity, and commutator relations
report = verify_all_properties(f_abc, operators, "SU(2)")
report.print_summary()

if report.all_passed():
    print("All verifications passed!")

Cross-Validation Against Reference Data

Compare computed structure constants with reference values:

from qig.structure_constants import compute_structure_constants
from qig.reference_data import get_reference_structure_constants
from qig.exponential_family import pauli_basis
import numpy as np

# Compute structure constants
operators = pauli_basis(0, 1)
f_computed = compute_structure_constants(operators)

# Get reference
f_reference = get_reference_structure_constants("su2")

# Compare
max_error = np.max(np.abs(f_computed - f_reference))
print(f"Max error: {max_error:.2e}")  # Should be < 1e-10

Caching for Performance

Cache structure constants for reuse:

from qig.structure_constants import compute_and_cache_structure_constants
from qig.exponential_family import pauli_basis

operators = pauli_basis(0, 1)

# First call computes and caches
f_abc = compute_and_cache_structure_constants(operators, "my_pauli")

# Second call uses cache (fast!)
f_abc_cached = compute_and_cache_structure_constants(operators, "my_pauli")

Tensor Product Structures

For systems with multiple sites, operators on different sites commute:

from qig.exponential_family import pauli_basis
from qig.structure_constants import compute_structure_constants
import numpy as np

# 2-qubit system: 3 operators per site = 6 total
ops_site0 = pauli_basis(0, 2)
ops_site1 = pauli_basis(1, 2)
operators = ops_site0 + ops_site1

f_abc = compute_structure_constants(operators)

# Verify operators on different sites commute
for a in range(3):  # Site 0
    for b in range(3, 6):  # Site 1
        for c in range(6):
            # f_abc should be ~0 when a,b on different sites
            assert np.abs(f_abc[a, b, c]) < 1e-10

Mathematical Properties

Antisymmetry

The structure constants are antisymmetric in the first two indices:

\[f_{abc} = -f_{bac}\]

This follows from the antisymmetry of the commutator: [F_a, F_b] = -[F_b, F_a].

Jacobi Identity

The structure constants satisfy the Jacobi identity:

\[\sum_d (f_{abd} f_{dce} + f_{bcd} f_{dae} + f_{cad} f_{dbe}) = 0\]

This is equivalent to the operator Jacobi identity:

\[[F_a, [F_b, F_c]] + [F_b, [F_c, F_a]] + [F_c, [F_a, F_b]] = 0\]

Real Values

For Hermitian generators, the structure constants are real:

\[f_{abc} \in \mathbb{R}\]

See Also