quchip.chip.transformations.methods¶
Reduction-method registry for device elimination (extension seam).
eliminate()’s device path is
method-agnostic except at a few decision points. They are how to extract the
surviving pair parameters and how to carry the eliminated mode’s jump operator
into the reduced frame. They also include whether a residual ZZ and a pathway
attribution are available, and what higher-order physics the reduction drops.
This module puts those decision points into a ReductionMethod
strategy. New routes, such as a higher-order Schrieffer-Wolff method or numeric
fit, register with register_reduction_method(), following the rule
registry in quchip.chip.retarget.
Dispatch keys on the static method string, never on a traced value. The
two shipped strategies, SchriefferWolffMethod and
ExactReduction, are selected once by name and then operate on the
DeviceReductionContext that the caller computed.
Functions
|
Return the strategy registered under |
The registered method names, in registration order. |
|
|
Register a reduction strategy under its name. |
Classes
|
Method-agnostic inputs of one device elimination. |
Exact-from-dressing reduction ( |
|
Compute a retained Hamiltonian, embedding and reduction diagnostics. |
|
2nd-order Schrieffer-Wolff reduction ( |
- class quchip.chip.transformations.methods.DeviceReductionContext(mode_label, survivor_labels, labels, dims, h, p_mask, sectors=None)[source]¶
Bases:
objectMethod-agnostic inputs of one device elimination.
The device path of
eliminate()computes this context once and passes it to the chosenReductionMethod. The perturbative generator is computed only when a method requests it, and exact reduction does not use it.- Variables:
mode_label (str) – Its label.
survivor_labels (list[str]) – The touching survivors in bare-label order. The retained Hamiltonian and the pair diagnostics use the same order, so every
("J", a, b)lookup agrees for all coupling-scan orders.labels (list[str]) – Device labels in the bare product-basis order.
dims (tuple[int, ...]) – Per-device Hilbert-space dimensions, aligned with
labels.h (Any) – The bare chip Hamiltonian as a dense array.
s – The Sylvester generator rotating the P/Q partition of
h.p_mask (Any) – Boolean mask selecting the kept (P) block of the product basis.
sectors (numpy.ndarray | None) – Total excitation number of each product state when
hconserves it, elseNone.
- class quchip.chip.transformations.methods.ReductionMethod[source]¶
Bases:
objectCompute a retained Hamiltonian, embedding and reduction diagnostics.
A concrete strategy declares its
name(themethodstring thateliminate()dispatches on) and implements the hooks below. Each hook receives theDeviceReductionContextthe caller assembled and uses its fixed product energy coordinates.Every hook body runs on
jax.grad/jitpaths and must stay traceable. Do not usefloat()/int()/bool()or Python branching on a traced value.- retained_hamiltonian(ctx)[source]¶
Return the complete Hamiltonian on the retained product coordinates.
- pair_parameters(ctx)[source]¶
Reduced per-survivor and per-pair parameters.
Returns a mapping that matches
extract_pair_parameters()/exact_pair_parameters(), with{survivor: {"freq_after": ...}}for each survivor and a("J", a, b)entry for each survivor pair. A route that resolves it also adds a("zz", a, b)entry.
- transform_operator(ctx, operator)[source]¶
Carry a full operator into the kept mode-ground manifold.
- dressed_transition(ctx, lowering)[source]¶
Compute the eliminated mode’s dressed transition and lowering weight.
The default reads the labeled exact eigensystem of
ctx.h. A route can override it with its own approximation, as SW does.- Parameters:
ctx (DeviceReductionContext) – Captured reduction inputs in product energy coordinates.
lowering (Any) – Mode lowering operator embedded in the full product space.
- Returns:
Transition frequency in GHz and dimensionless squared matrix element.
- Return type:
- residual_zz(ctx, pair_params, a, b)[source]¶
Residual ZZ between survivor pair
(a, b), orNoneif the route cannot resolve it.
- pathways(ctx, pair_params, a, b)[source]¶
Top virtual-state attribution of the pair’s mediated exchange, or
None.
- pathway_source(ctx)[source]¶
Attribution of any retained element to virtual states, or
Nonewhen the route has none.The function takes two product-state indices of
ctxand returns(index, amount)pairs. The elimination result keeps it, so it holds only the arrays it reads.
- class quchip.chip.transformations.methods.SchriefferWolffMethod[source]¶
Bases:
ReductionMethod2nd-order Schrieffer-Wolff reduction (
method="sw").This reduction is perturbative and differentiable, and the pair parameters come from the projected 2nd-order effective Hamiltonian. The mediated exchange carries a virtual-state pathway attribution. Residual ZZ is a higher-order correction that this route does not represent (Bravyi, DiVincenzo & Loss, Ann. Phys. 326, 2793 (2011)).
- retained_hamiltonian(ctx)[source]¶
Return the complete Hamiltonian on the retained product coordinates.
- dressed_transition(ctx, lowering)[source]¶
Compute second-order energies and a unitary first-order transition weight.
- pair_parameters(ctx)[source]¶
Reduced per-survivor and per-pair parameters.
Returns a mapping that matches
extract_pair_parameters()/exact_pair_parameters(), with{survivor: {"freq_after": ...}}for each survivor and a("J", a, b)entry for each survivor pair. A route that resolves it also adds a("zz", a, b)entry.
- residual_zz(ctx, pair_params, a, b)[source]¶
Residual ZZ between survivor pair
(a, b), orNoneif the route cannot resolve it.
- pathways(ctx, pair_params, a, b)[source]¶
Top virtual-state attribution of the pair’s mediated exchange, or
None.
- class quchip.chip.transformations.methods.ExactReduction[source]¶
Bases:
ReductionMethodExact-from-dressing reduction (
method="exact").This reduction reads reduced parameters from an exact diagonalization of the same engine-consumed static model as the SW route. It gives exact kept-block energies (which residual ZZ needs), but requires a full diagonalization. It has no perturbative generator, so no pathway attribution is available (
exact_pair_parameters()).- retained_hamiltonian(ctx)[source]¶
Return the complete Hamiltonian on the retained product coordinates.
- pair_parameters(ctx)[source]¶
Reduced per-survivor and per-pair parameters.
Returns a mapping that matches
extract_pair_parameters()/exact_pair_parameters(), with{survivor: {"freq_after": ...}}for each survivor and a("J", a, b)entry for each survivor pair. A route that resolves it also adds a("zz", a, b)entry.
- residual_zz(ctx, pair_params, a, b)[source]¶
Residual ZZ between survivor pair
(a, b), orNoneif the route cannot resolve it.
- pathways(ctx, pair_params, a, b)[source]¶
Top virtual-state attribution of the pair’s mediated exchange, or
None.
- quchip.chip.transformations.methods.register_reduction_method(method)[source]¶
Register a reduction strategy under its name.
- Parameters:
method (ReductionMethod) – Strategy added under its unique
name.