Changelog¶
2.0.0 (unreleased)¶
This release fixes the conventions of the generalized QGT so that every quantity matches
its textbook definition and McLachlan’s equation reads Re(G) θ̇ = b with no extra factors.
It is not backwards compatible; see the migration guide below.
Breaking changes¶
get_derivativesis renamed toevaluate. It also accepts a plain sequence of values ordered likeqc.parameters. It no longer takestracking_time; timings of the last call are always stored inbowtie.last_timings.phase_fixis removed. The connected (gauge-invariant) quantities are always computed. Withphase_fix=Falsethe variance was wrong whenever two bowties acted on disjoint qubits, and could even be negative.VarQITE_gradientis removed from the constructor. Choose the direction when extracting:extract_gradient(generalized_qgt, which="real_time" | "imag_time").extract_gradientnow returns McLachlan’s right-hand sideb, so thatRe(G) θ̇ = b. The old output was-2 b, and the flag names were swapped (see the table below).extract_qgtreturns the real part by default (the metric McLachlan uses). Usepart="complex"for the previous complex output, orpart="imag"for the Berry curvature.extract_variance(generalized_qgt)no longer takesenergy.acceleratoris replaced bysimulator, which takes"CPU"(default),"GPU", or any noiseless statevectorAerSimulatorfor full control. The internalThreadPoolExecutoris gone. It was never used by Aer, so it had no effect.pbarandverbose_initare merged intoverbosity(0, 1 or 2).compute_varianceis removed (it had no effect).The generalized QGT no longer has the Hamiltonian coefficients folded in. The QGT block is unchanged. The old mixed block was
new[i, j] * c_j / 2(times an extraiwithVarQITE_gradient=True), and the old Hamiltonian block was±new[i, j] * c_i * c_j / 4. Code that indexed into these blocks directly must be updated; prefer theextract_*methods.remove_idle_qwiresis renamed toremove_idle_qubits.evaluatereturns the energy as afloatfor Hermitian Hamiltonians.
New features¶
Identity terms in the Hamiltonian are supported; they shift the energy only. A Hamiltonian that is a multiple of the identity raises a “Trivial Hamiltonian” warning.
evaluateaccepts a sequence of values or any mappingassign_parametersaccepts, and raises a clear error when a parameter has no value.Example: VarQRTE and VarQITE of a transverse-field Ising chain (
docs/examples/mclachlan_ising.py).
Bug fixes¶
Circuits are validated at construction. A parameter used in more than one gate is now an error; previously only one gate’s derivative was counted and the gradient was silently wrong. Parameter expressions and unsupported parameterized gates also give explanatory errors.
Circuits with classical bits, control flow or a parameterized global phase, and simulators that are not noiseless statevector simulators, are rejected with a clear error instead of crashing later or returning wrong numbers.
Bowtie circuits are actually transpiled. The result used to be discarded, so gates Aer cannot run natively (e.g.
QFTGate) failed.The energy variance is correct when bowties have disjoint support.
Complex coefficients enter the variance as
conj(c_i) c_j.
Packaging¶
Runtime dependencies trimmed to
numpy,qiskit,qiskit-aerandtqdm. Test-only dependencies moved to thedevextra. The generated_version.pyis no longer tracked.
Migrating from 1.0¶
# 1.0
bowtie = BowtieQGT(qc, obs, phase_fix=True, pbar=1, accelerator="GPU", VarQITE_gradient=False)
gen_qgt, energy = bowtie.get_derivatives(param_dict)
qgt = bowtie.extract_qgt(gen_qgt).real
b = bowtie.extract_gradient(gen_qgt).real / 2 # real time, see table
variance = bowtie.extract_variance(gen_qgt, energy)
# 2.0
bowtie = BowtieQGT(qc, obs, verbosity=1, simulator="GPU")
generalized_qgt, energy = bowtie.evaluate(param_dict)
qgt = bowtie.extract_qgt(generalized_qgt)
b = bowtie.extract_gradient(generalized_qgt, which="real_time")
variance = bowtie.extract_variance(generalized_qgt)
How old gradient calls map to the new API:
1.0 call |
returned |
2.0 equivalent |
|---|---|---|
|
|
|
|
|
|
Code that solved G θ̇ = gradient / 2 with the default VarQITE_gradient=False was
integrating e^{+iHt}, i.e. backwards in time. Solve G θ̇ = b with
b = extract_gradient(g, which="real_time") to get e^{-iHt}. For a real Hamiltonian
started from a real state, such as a transverse-field Ising quench from |0...0⟩, both
directions give the same expectation values, so the old results are unaffected.