Validation Module
Validation utilities for the quantum inaccessible game GENERIC decomposition.
This module provides tools for validating computational results throughout the GENERIC decomposition procedure, including: - Matrix property checks (Hermiticity, symmetry, tracelessness) - Cross-validation between different computational methods - Comparison against reference data - Comprehensive validation reporting
These utilities are used throughout all implementation phases to ensure correctness and numerical stability.
- class qig.validation.ValidationCheck(name, passed, value, tolerance, message='')[source]
Bases:
objectRepresents a single validation check with its result.
- class qig.validation.ValidationReport(title)[source]
Bases:
objectCollects and reports validation results for a computation.
This class accumulates validation checks throughout a computation and provides methods to display results, identify failures, and generate summary statistics.
Examples
>>> report = ValidationReport("Structure Constants") >>> report.add_check("Antisymmetry", error < tol, error, tol) >>> report.add_check("Jacobi identity", violation < tol, violation, tol) >>> report.print_summary() >>> if not report.all_passed(): ... print(report.get_failures())
- Parameters:
title (str)
- __init__(title)[source]
Initialize validation report.
- Parameters:
title (
str) – Title for this validation report
- checks: List[ValidationCheck]
- add_check(name, passed, value, tolerance, message='')[source]
Add a validation check to the report.
- qig.validation.compare_matrices(A, B, tol, name='Matrix comparison')[source]
Compare two matrices with detailed diagnostics.
Computes various error norms and provides diagnostic information about differences between matrices.
- Parameters:
- Return type:
- Returns:
- qig.validation.check_antisymmetric(M, tol=1e-14)[source]
Check if a matrix is antisymmetric (M = -M^T).
- qig.validation.check_commutator(A, B, operators, f_abc, tol=1e-08)[source]
Verify commutator relation [A, B] = 2i Σ_c f_abc F_c.
- Parameters:
A (
np.ndarray) – First operator (index a)B (
np.ndarray) – Second operator (index b)operators (
List[np.ndarray]) – List of basis operators {F_c}f_abc (
np.ndarray,shape (n,n,n)) – Structure constantstol (
float) – Tolerance for commutator verification
- Return type:
- Returns:
- qig.validation.finite_difference_jacobian(func, x, eps=1e-05)[source]
Compute Jacobian using finite differences.
This provides an independent validation method for analytically computed Jacobians.
- Parameters:
func (
Callable) – Function mapping R^n -> R^mx (
np.ndarray,shape (n,)) – Point at which to compute Jacobianeps (
float) – Finite difference step size
- Returns:
J – Jacobian matrix approximation
- Return type:
np.ndarray,shape (m,n)
Notes
Uses central differences: f’(x) ≈ (f(x+h) - f(x-h))/(2h)
- qig.validation.check_constraint_tangency(M, constraint_gradient, tol=1e-06)[source]
Check if flow is tangent to constraint manifold.
Verifies that M @ a ≈ 0 where a = ∇C is the constraint gradient.
- qig.validation.check_entropy_monotonicity(M, theta, tol=1e-12)[source]
Check if flow decreases entropy (or stays constant).
Verifies that θ^T M θ ≤ 0 (with small tolerance for numerical error).
- qig.validation.check_positive_semidefinite(M, tol=1e-14)[source]
Check if a matrix is positive semidefinite.
See Validation Framework for detailed usage examples and the complete validation framework documentation.