quchip.chip.coupling_base¶
Coupling base class and registry.
Split out of quchip.chip.couplings so the declarative API in
quchip.declarative.models can subclass BaseCoupling
without re-entering the import chain through Capacitive
(Capacitive now itself depends on CouplingModel).
The concrete coupling classes — Capacitive,
TunableCapacitive, Coupling — still live in
quchip.chip.couplings.
Classes
|
Abstract base for a two-body coupling between :class:`BaseDevice`s. |
- class quchip.chip.coupling_base.BaseCoupling(device_a, device_b, *, label=None)[source]¶
Bases:
StateVersioned,Registrable,ABCAbstract base for a two-body coupling between :class:`BaseDevice`s.
Subclasses own their local interaction Hamiltonian
H_intacting onH_a ⊗ H_b. The engine embeds this local form into the full chip tensor space; couplings never touch the engine directly.Subclasses auto-register via the shared
Registrablemixin — no manual registration step is needed. Ensure the module defining the subclass is imported so the registration runs.- Parameters:
device_a (BaseDevice or str) – The two coupled devices, given as device objects or their label strings. Label-string references are late-bound: the coupling remembers the string, and
Chipresolves it to the matching device instance at construction time. Before that resolution the coupling cannot produce an interaction Hamiltonian.device_b (BaseDevice or str) – The two coupled devices, given as device objects or their label strings. Label-string references are late-bound: the coupling remembers the string, and
Chipresolves it to the matching device instance at construction time. Before that resolution the coupling cannot produce an interaction Hamiltonian.label (str, optional) – Human-readable label. Auto-generated from
_type_prefixwhen omitted (e.g."cap_0"forCapacitive).
Notes
All coupling parameters (
g, any tunable envelope, etc.) must be JAX-traceable so sweeps and gradient-based optimization work without forcing concretization.- copy(device_map)[source]¶
Shallow copy rebound to the device instances in device_map.
- Parameters:
device_map (dict[str, BaseDevice])
- Return type:
- property coupling_strength_name: str¶
Display name of the scalar
coupling_strengthparameter.Default
"g"(the conventional coupling-strength symbol, and the actual attribute name onCoupling).CouplingModeloverrides this to the name of its first declared parameter field; a subclass with a different primary-scalar convention overrides it directly.
- set_coupling_strength(value)[source]¶
Write value into the scalar named by
coupling_strength_name.The mutation counterpart of
coupling_strength: callers that need to move a coupling’s primary scalar (optimizers, sweeps) go through this seam instead of assuming an attribute name (gholds only forCapacitive/Coupling;TunableCapacitiveusesg_0,CrossKerruseschi). Default implementation covers the common case where the writable attribute name matchescoupling_strength_nameexactly; a subclass whose writable attribute differs from its display name overrides this.- Parameters:
value (Any)
- Return type:
None
- rwa_keeps_band(delta_a, delta_b)[source]¶
Whether the RWA retains the
(Δa, Δb)excitation-change band.The structural RWA policy for this coupling: when the chip resolves RWA (
Chip.resolve_rwa()), only bands accepted here survive — inChip.hamiltonian()’s mask and in stage 2’s band filter alike. Offsets follow the engine conventionΔ = col − row(+1= lowering). Overrides must stay symmetric under joint sign flip so the retained operator is Hermitian, and must depend only on the integer offsets — never on frequency values, which may be traced.Default: total-excitation-conserving (
Δa + Δb == 0), the beam-splitter selection of the textbook coupling RWA.
- abstractmethod interaction_hamiltonian()[source]¶
Return the full
H_inton the localH_a ⊗ H_bsubspace.Always the complete (non-RWA) interaction: the RWA is a chip policy the engine applies structurally, keeping only the bands
rwa_keeps_band()accepts whenChip.resolve_rwa()resolvesTruefor this coupling. Couplings author one form.- Return type:
- parametric_operator(chip)[source]¶
Backend operator a scheduled edge pump multiplies, or
Nonewhen this coupling is not modulable.The base coupling is static-only; declarative couplings opt in by implementing
CouplingModel.parametric_interaction().
- dropped_terms()[source]¶
Return advisory records for terms this coupling’s model itself elides.
RWA band drops are reported generically by stage 2; this hook is for other approximations a coupling applies inside
interaction_hamiltonian(). Default: nothing is dropped.- Return type:
list[‘DroppedTerm’]