build_overlap_meta¶
- build_overlap_meta(cost_circuit)[source]¶
Build the compute-uncompute overlap circuit from a cost ansatz.
The forward block is the ansatz on its original parameters; the backward block is the ansatz inverted (
QuantumCircuit.inverse()flips each rotation, e.g.RX(θ) → RX(-θ)) on a disjoint parameter namespace. The returned MetaCircuit measures all qubits as a probability distribution; its parameters are ordered(*θ_fwd, *θ_bwd)(each of lengthd), so binding a flat2dvector[θ_fwd | θ_bwd]gives\[P(0^n) = |\langle 0|U(\theta_\text{bwd})^\dagger U(\theta_\text{fwd})|0\rangle|^2 = F(\theta_\text{fwd}, \theta_\text{bwd}),\]which is symmetric in its arguments. The result format is left unset — the probs
MeasurementStageassigns it during expansion, as for the sample pipeline.- Return type: