symop.ccr.algebra.density.multiply

Density polynomial multiplication.

This module provides functionality for multiplying density polynomials in the CCR-based symbolic framework.

A density polynomial is represented as a linear combination of terms of the form \(c \, |L\rangle\langle R|\), where \(|L\rangle\) and \(|R\rangle\) are ket polynomials.

The product of two density terms is defined via contraction of the inner indices:

\[\left(c_1 \, |L\rangle\langle R|\right) \left(c_2 \, |A\rangle\langle B|\right) = c_1 c_2 \, \langle R | A \rangle \, |L\rangle\langle B|.\]

This corresponds to standard operator composition in Dirac notation, where the inner product \(\langle R | A \rangle\) contracts the adjacent bra–ket pair.

The multiplication is extended linearly over all pairs of terms from the left and right density polynomials. Contributions with negligible overlap are discarded based on a numerical threshold.

Notes

  • The inner product \(\langle R | A \rangle\) is evaluated using symop.ccr.algebra.ket.inner.ket_inner().

  • Terms are canonicalized after multiplication using combine_like_terms_density().

  • This operation preserves the density-operator structure \(|\,\cdot\,\rangle\langle\,\cdot\,|\).

Functions

density_multiply(left_terms, right_terms, *)

Return the symbolic product of two density polynomials.

density_multiply(left_terms: tuple[DensityTerm, ...], right_terms: tuple[DensityTerm, ...], *, eps: float = 1e-12) tuple[DensityTerm, ...]

Return the symbolic product of two density polynomials.

For density terms

c1 |L><R| and c2 |A><B|,

the product is defined as

c1 c2 <R|A> |L><B|,

extended linearly over all pairs of terms.

Parameters:
  • left_terms (tuple[DensityTerm, ...]) – Terms of the left density polynomial.

  • right_terms (tuple[DensityTerm, ...]) – Terms of the right density polynomial.

  • eps (float) – Contributions with overlap magnitude below eps are discarded.

Returns:

Canonicalized output density terms.

Return type:

tuple[DensityTerm, …]