FubiniStudyMetricEstimator

class FubiniStudyMetricEstimator[source]

Bases: MetricEstimator

Block-diagonal Fubini–Study metric (quantum geometric tensor).

For each block of mutually-commuting parametric gates with Hermitian generators K_i, the metric on the pre-block state is g_ij = 1/2 <{K_i, K_j}> - <K_i><K_j>. The blocks are stacked block- diagonally. Unlike the pullback metric this is independent of the loss observable — it is the geometry of the ansatz state — so it applies to any program with a supported Pauli-rotation ansatz (including PCE, whose loss is a classical objective). It provides only metric_fn; the gradient falls back to the program’s parameter-shift rule.

Methods Summary

bind(program)

Return the evaluators this metric provides, keyed by name.

check_compatible(program)

Raise ContractViolation if this metric cannot be applied to program.

Methods Documentation

bind(program)[source]

Return the evaluators this metric provides, keyed by name.

Deterministic estimators (pullback, Fubini–Study) provide "metric_fn" — a pure function of the parameters returning the metric matrix — and the pullback estimator additionally returns the loss gradient under "jac". The stochastic-fidelity estimator instead provides "fidelity_fn": the QN-SPSA optimizer builds its metric from finite differences of that fidelity rather than from a closed-form matrix. The variational algorithm forwards whichever keys appear to the optimizer; keys absent fall back to the algorithm’s parameter-shift defaults.

Return type:

dict[str, Callable[..., Any]]

check_compatible(program)[source]

Raise ContractViolation if this metric cannot be applied to program. Called at run() start so an incompatible pairing fails loudly before any optimization.

Return type:

None