quchip.devices.circuit¶
CircuitDevice — shared base for diagonalize/truncate/project device models.
Concrete subclasses (fluxonium, charge-basis transmon) implement three methods that live entirely in the native basis (phase grid or integer charge basis):
_build_native_hamiltonian()— total Hamiltonian in native basis._native_charge_operator()— charge operator \(\hat n\) in native basis._native_phase_operator()— phase-space coupling operator (\(\hat\varphi\) or \(\sin\hat\varphi\) depending on basis) in native basis.
The base class handles:
JAX-traceable diagonalization (
_truncated_eigh(), aneighwhose reverse pass involves only kept-level gaps, so degenerate discarded levels cannot NaN circuit-parameter gradients) cached on theBaseDevice.state_versioncounter (tracer-safe viaquchip.utils.jax_utils.contains_tracer()).Truncation to
levelslowest eigenstates; spectrum shifted so \(E_0 = 0\).project_operator()transforming a native-basis matrixOto \(V^\dagger O V\) in the truncated eigenbasis.Physical-coupling accessors (
charge_coupling_operator(),phase_coupling_operator()) consumed by drives that dispatch viaquchip.devices.protocols.Fermi-golden-rule Lindblad channels in
collapse_operators().
Init-order contract (subclass discipline)¶
Subclass __init__ must set all native-Hamiltonian parameters
(E_C, E_J, E_L, phi_ext, num_basis, …) before
returning, and must not call _eigensys from within __init__.
Violating this would cache against a partially-constructed Hamiltonian.
The base class enforces this by instantiating lazily: no accessor is
called during __init__. Mutation tracking — which gates
_validate_param_write() — switches on
automatically once the outermost __init__ returns
(StateVersioned); subclasses do not
call _finish_init by hand.
See docs/superpowers/specs/2026-04-21-circuit-level-devices-design.md.
Classes
|
Abstract base for devices built by diagonalizing a native-basis circuit. |
- class quchip.devices.circuit.CircuitDevice(levels, label=None, *, collapse_model='fermi_golden', coupling_channel=None, collapse_rate_threshold=1e-08, **noise_kwargs)[source]¶
Bases:
BaseDeviceAbstract base for devices built by diagonalizing a native-basis circuit.
Conforms to the
ChargeCoupledandPhaseCoupledProtocols by default; subclasses may additionally conform toFluxCoupledby definingflux_coupling_operator().Subclasses must implement:
_build_native_hamiltonian()_native_charge_operator()_native_phase_operator()
- Parameters:
- approximation: str | None = None¶
Declared approximation-regime statement surfaced by
physics_notes(), mirroringapproximation— this class does not inherit fromDeviceModel, so the attribute and its surfacing are declared here directly.
- hamiltonian()[source]¶
Diagonal
diag(0, E_01, E_02, …)in the truncated eigenbasis.Returned as a backend-native diagonal operator — the engine relies on
chip.hamiltonian()producing the same sparse layout asnumber_operator()so layout-aware backends (e.g. dynamiqs sparse-DIA) do not silently densify when assemblingH₀.- Return type:
- eigenenergies()[source]¶
Return the truncated eigenvalue array, shape
(levels,), with \(E_0 = 0\).- Return type:
- eigenvectors()[source]¶
Return the truncated eigenvector matrix
V, shape(num_basis, levels).- Return type:
- project_operator(native_op)[source]¶
Transform a native-basis operator
Ointo the truncated eigenbasis.Returns \(V^\dagger O V\).
- charge_coupling_operator()[source]¶
Return the physical charge operator \(V^\dagger \hat n V\) in the eigenbasis.
Returned as a dense, trace-safe array-like (see
quchip.devices.protocols); backend composition entry points coerce it to native form on use.- Return type:
- phase_coupling_operator()[source]¶
Return the physical phase-coupling operator in the eigenbasis.
Returns \(V^\dagger \hat\varphi V\) on a phase-basis device (fluxonium); returns \(V^\dagger \sin\hat\varphi V\) on an integer-charge-basis device (charge-basis transmon), since \(\hat\varphi\) is not single-valued there.
- Return type: