quchip.chip.transformations.methods¶
Reduction-method registry for device elimination (extension seam).
eliminate()’s device path is
method-agnostic up to a handful of decision points: how the surviving pair
parameters are extracted, how the eliminated mode’s jump operator is carried
into the reduced frame, whether a residual ZZ and a pathway attribution are
available, and what higher-order physics the reduction drops. This module
factors those decision points into a ReductionMethod strategy keyed
in _REDUCTION_METHODS, so a new route (a higher-order Schrieffer-Wolff,
a numeric fit) registers a strategy with register_reduction_method()
rather than threading another method == branch through the fold — the
same registration pattern as quchip.chip.retarget’s rule registry.
Dispatch keys on the static method string, never a traced value:
the two shipped strategies, SchriefferWolffMethod
and ExactReduction, are selected once by name and then operate on the
DeviceReductionContext the caller computed.
Functions
|
Return the strategy registered under |
The registered method names, in registration order. |
|
|
Register a reduction strategy under its |
Classes
|
Method-agnostic inputs of one device elimination. |
Exact-from-dressing reduction ( |
|
One route from a bare chip to its reduced effective parameters. |
|
2nd-order Schrieffer-Wolff reduction ( |
- class quchip.chip.transformations.methods.DeviceReductionContext(chip, mode, mode_label, survivor_labels, labels, dims, h, s, p_mask)[source]¶
Bases:
objectMethod-agnostic inputs of one device elimination.
Computed once by the device path of
eliminate()and handed to the chosenReductionMethod. Every field is shared by both shipped routes: the reduction differs only in how it reads this context, not in what the context contains.- Parameters:
- chip¶
The source chip being reduced (never mutated).
- Type:
Any
- mode¶
The device being eliminated.
- Type:
Any
- survivor_labels¶
The touching survivors in bare-label order — the same ordering the pair extraction and the fold loop key on, so every
("J", a, b)lookup agrees regardless of coupling-scan order.
- h¶
The bare chip Hamiltonian as a dense array.
- Type:
Any
- s¶
The Sylvester generator rotating the P/Q partition of
h.- Type:
Any
- p_mask¶
Boolean mask selecting the kept (P) block of the product basis.
- Type:
Any
- class quchip.chip.transformations.methods.ReductionMethod[source]¶
Bases:
objectOne route from a bare chip to its reduced effective parameters.
A concrete strategy declares its
name(themethodstringeliminate()dispatches on) and implements the five hooks below. Each receives theDeviceReductionContextthe caller assembled; a hook returns the same shape itsmethod == namebranch produced before this seam existed, so the fold loop is identical across routes.Every hook body runs on
jax.grad/jitpaths and must stay traceable: nofloat()/int()/bool()or Python branching on a traced value.- pair_parameters(ctx)[source]¶
Reduced per-survivor and per-pair parameters.
Returns a mapping matching
extract_pair_parameters()/exact_reduction():{survivor: {"freq_after": ...}}for each survivor, plus a("J", a, b)entry per survivor pair (and, for a route that resolves it, a("zz", a, b)entry).- Parameters:
ctx (DeviceReductionContext)
- Return type:
- survivor_amplitudes(ctx)[source]¶
Survivor-lowering amplitude of the mode’s transformed unit jump operator.
One entry per
ctx.survivor_labels: the amplitude with which the eliminated mode’s own (unit, dimensionless) lowering operator, carried into the reduced frame with the route’s rotation, drives that survivor. The caller folds each amplitude into a Purcell rate withpurcell_rate_from(). Only called when the mode dissipates.- Parameters:
ctx (DeviceReductionContext)
- Return type:
- residual_zz(ctx, pair_params, a, b)[source]¶
Residual ZZ between survivor pair
(a, b), orNoneif the route cannot resolve it.- Parameters:
ctx (DeviceReductionContext)
pair_params (dict)
a (str)
b (str)
- Return type:
Any | None
- class quchip.chip.transformations.methods.SchriefferWolffMethod[source]¶
Bases:
ReductionMethod2nd-order Schrieffer-Wolff reduction (
method="sw").Perturbative and differentiable: pair parameters come from the projected 2nd-order effective Hamiltonian, and the mediated exchange carries a virtual-state pathway attribution. Residual ZZ is a higher-order correction this route does not represent (Bravyi, DiVincenzo & Loss, Ann. Phys. 326, 2793 (2011)).
- pair_parameters(ctx)[source]¶
Reduced per-survivor and per-pair parameters.
Returns a mapping matching
extract_pair_parameters()/exact_reduction():{survivor: {"freq_after": ...}}for each survivor, plus a("J", a, b)entry per survivor pair (and, for a route that resolves it, a("zz", a, b)entry).- Parameters:
ctx (DeviceReductionContext)
- Return type:
- survivor_amplitudes(ctx)[source]¶
Survivor-lowering amplitude of the mode’s transformed unit jump operator.
One entry per
ctx.survivor_labels: the amplitude with which the eliminated mode’s own (unit, dimensionless) lowering operator, carried into the reduced frame with the route’s rotation, drives that survivor. The caller folds each amplitude into a Purcell rate withpurcell_rate_from(). Only called when the mode dissipates.- Parameters:
ctx (DeviceReductionContext)
- Return type:
- residual_zz(ctx, pair_params, a, b)[source]¶
Residual ZZ between survivor pair
(a, b), orNoneif the route cannot resolve it.- Parameters:
ctx (DeviceReductionContext)
pair_params (dict)
a (str)
b (str)
- Return type:
Any | None
- class quchip.chip.transformations.methods.ExactReduction[source]¶
Bases:
ReductionMethodExact-from-dressing reduction (
method="exact").Reads the reduced parameters off the chip’s exact dressed spectrum: exact kept-block energies (what residual ZZ needs) at the cost of a full diagonalization. It has no perturbative generator, so no pathway attribution is available (
exact_reduction()).- pair_parameters(ctx)[source]¶
Reduced per-survivor and per-pair parameters.
Returns a mapping matching
extract_pair_parameters()/exact_reduction():{survivor: {"freq_after": ...}}for each survivor, plus a("J", a, b)entry per survivor pair (and, for a route that resolves it, a("zz", a, b)entry).- Parameters:
ctx (DeviceReductionContext)
- Return type:
- survivor_amplitudes(ctx)[source]¶
Survivor-lowering amplitude of the mode’s transformed unit jump operator.
One entry per
ctx.survivor_labels: the amplitude with which the eliminated mode’s own (unit, dimensionless) lowering operator, carried into the reduced frame with the route’s rotation, drives that survivor. The caller folds each amplitude into a Purcell rate withpurcell_rate_from(). Only called when the mode dissipates.- Parameters:
ctx (DeviceReductionContext)
- Return type:
- residual_zz(ctx, pair_params, a, b)[source]¶
Residual ZZ between survivor pair
(a, b), orNoneif the route cannot resolve it.- Parameters:
ctx (DeviceReductionContext)
pair_params (dict)
a (str)
b (str)
- Return type:
Any | None
- quchip.chip.transformations.methods.register_reduction_method(method)[source]¶
Register a reduction strategy under its
ReductionMethod.name.- Parameters:
method (ReductionMethod)
- Return type:
None
- quchip.chip.transformations.methods.lookup_reduction_method(name)[source]¶
Return the strategy registered under
name, orNoneif none is.- Parameters:
name (str)
- Return type:
ReductionMethod | None