quchip.declarative.ops

Declarative operator-handle namespaces for the physics DSL.

LocalOps (aliased EndpointOps at coupling call sites) exposes one Hilbert-space endpoint’s operators as composable PhysicsExpr nodes.

Classes

EndpointOps

LocalOps(label, space[, device])

Declarative operator namespace for one local Hilbert space endpoint.

class quchip.declarative.ops.LocalOps(label, space, device=None)[source]

Bases: object

Declarative operator namespace for one local Hilbert space endpoint.

Passed as op to DeviceModel.local_hamiltonian() and as the two endpoints a, b to CouplingModel.interaction(). Each property returns a PhysicsExpr that 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
space: LocalSpace
device: Any = None
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

Physical charge-like drive operator for this local representation.

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.

quchip.declarative.ops.EndpointOps

alias of LocalOps