symop.ccr.algebra.density.normalize_trace¶
Trace normalization for symbolic density polynomials.
This module provides a helper that rescales a density polynomial so that its trace equals one.
Given a density polynomial \(\rho\), we compute \(\mathrm{Tr}(\rho)\) symbolically and return
whenever \(|\mathrm{Tr}(\rho)|\) is not too small.
Functions
|
Scale a density polynomial so that its trace equals 1. |
- density_normalize_trace(terms: tuple[DensityTerm, ...], *, eps: float = 1e-14) tuple[DensityTerm, ...]¶
Scale a density polynomial so that its trace equals 1.
This function computes \(\mathrm{Tr}(\rho)\) via
density_trace()and returns \(\rho' = \rho / \mathrm{Tr}(\rho)\). If \(|\mathrm{Tr}(\rho)| < \text{eps}\), aValueErroris raised.Mathematically,
\[\rho' \;=\; \frac{1}{\mathrm{Tr}(\rho)} \, \rho, \qquad \mathrm{Tr}(\rho') \;=\; 1.\]- Parameters:
- Returns:
The scaled density polynomial with unit trace.
- Return type:
tuple[DensityTerm, …]
- Raises:
ValueError – If \(|\mathrm{Tr}(\rho)| < \text{eps}\).
Notes
Scaling is performed by
density_scale()with factor \(1/\mathrm{Tr}(\rho)\).Works with complex traces; no assumption of Hermiticity is required.