quchip.declarative.ops¶
Declarative operator-handle namespaces for the physics DSL.
LocalOps (with the alias EndpointOps at coupling call sites)
exposes one Hilbert-space endpoint’s operators as composable
PhysicsExpr nodes.
Classes
|
Declarative operator namespace for one local Hilbert space endpoint. |
- class quchip.declarative.ops.LocalOps(label, space, device=None)[source]¶
Bases:
objectDeclarative operator namespace for one local Hilbert space endpoint.
Quchip passes this namespace as
optoDeviceModel.local_hamiltonian()and as the two endpointsa,btoCouplingModel.interaction(). Each property returns aPhysicsExprthat composes with+,-,@(same endpoint),*(scalar or tensor product).Examples
>>> from quchip.declarative import LocalOps >>> from quchip.devices.spaces import FockSpace >>> op = LocalOps(label="q", space=FockSpace(3)) >>> H = 5.0 * op.n + 0.5 * (op.adag @ op.adag @ op.a @ op.a) >>> H.kind 'add'
- Parameters:
label (str) – Endpoint label.
space (LocalSpace) – Authored local Hilbert space.
device (device or None, default None) – Owning device. It is required for derived energy-level operators and supplies a declared charge operator to
charge.
- space: LocalSpace¶
- property a: PhysicsExpr¶
Lowering operator for this endpoint.
- property adag: PhysicsExpr¶
Raising operator for this endpoint.
- property n: PhysicsExpr¶
Number operator for this endpoint.
- property level: PhysicsExpr¶
Energy-level index operator in the authored local basis.
- property n2: PhysicsExpr¶
Squared charge operator in a compatible authored local space.
- property phi: PhysicsExpr¶
Phase operator in a compatible authored local space.
- property cos_phi: PhysicsExpr¶
Cosine of phase in a compatible authored local space.
- property sin_phi: PhysicsExpr¶
Sine of phase in a compatible authored local space.
- property I: PhysicsExpr¶
Identity operator for this endpoint.
- property x: PhysicsExpr¶
Unnormalized quadrature
x = a + a†(no 1/sqrt(2) factor).
- property charge: PhysicsExpr¶
Charge operator that couplings use for this endpoint.
A device that declares
charge_coupling_operator()supplies the operator, so its couplings and itsChargeDriveact through the same charge. Without such a device, the local space sets the operator:a + a†on aFockSpace,non aChargeSpaceorPhaseGridSpace, and the space’s"charge"operator otherwise.
- property sigma_x: PhysicsExpr¶
|0><1| + |1><0|on the computational|0>, |1>subspace of the truncated space.
- property sigma_y: PhysicsExpr¶
-i|0><1| + i|1><0|on the computational|0>, |1>subspace.
- property sigma_z: PhysicsExpr¶
|0><0| - |1><1|on the computational|0>, |1>subspace.
- property sigma_plus: PhysicsExpr¶
Raising operator
|1><0|on the computational subspace.
- property sigma_minus: PhysicsExpr¶
Lowering operator
|0><1|on the computational subspace.