pdft.coherence.certify_flat_modulus

pdft.coherence.certify_flat_modulus#

pdft.coherence.certify_flat_modulus(basis, frozen_indices=None, *, atol=1e-08)[source]#

Certify that training cannot raise mu above 1.

Two conditions, both necessary. The basis must be flat-modulus now, and every tensor left trainable must be diagonal — then by the proposition in the module docstring, mu == 1 for every value those parameters can take.

frozen_indices is the same argument train_basis_batched accepts, so:

cert = certify_flat_modulus(basis, frozen_indices=frozen)
if not cert:
    raise ValueError(cert.reason)
result = train_basis_batched(basis, frozen_indices=frozen, ...)

Frozen non-diagonal gates are fine: a fixed Hadamard is what the proposition assumes. It is training them that voids it.

The proposition’s other hypothesis, one Hadamard per wire, is not checked. Every basis in the package satisfies it; for a circuit of your own with two Hadamards on a wire the certificate can hold where sampled_flat_modulus shows it does not.

Parameters:
Return type:

FlatModulusCertificate