quchip.devices.spaces

Backend-neutral local Hilbert spaces and their named operators.

Classes

ChargeSpace(num_basis)

Finite integer-charge basis centered on zero charge.

CustomSpace(dimension, operators)

Named local operators supplied as matrices or zero-argument JAX callables.

FockSpace(levels)

Finite Fock ladder with standard bosonic and qubit operators.

LocalSpace()

Numerical realization of the operators used by one device model.

PhaseGridSpace(points, extent)

Uniform endpoint-excluded phase grid with nonperiodic finite differences.

TruncationBoundary(indices, description, ...)

Authored basis indices near a cutoff and the corresponding convergence check.

class quchip.devices.spaces.TruncationBoundary(indices, description, convergence_hint)[source]

Bases: object

Authored basis indices near a cutoff and the corresponding convergence check.

Parameters:
  • indices (tuple[int, ...]) – Distinct non-negative boundary indices.

  • description (str) – Human-readable boundary name.

  • convergence_hint (str) – Suggested convergence comparison.

indices: tuple[int, ...]
description: str
convergence_hint: str
class quchip.devices.spaces.LocalSpace[source]

Bases: ABC

Numerical realization of the operators used by one device model.

abstract property dimension: int

Return the authored local-space dimension.

abstractmethod matrix(name)[source]

Return one named operator as a JAX-compatible dense array.

Parameters:

name (str) – Operator name supported by the concrete space.

truncation_boundary()[source]

Describe a cutoff, or return None for an intrinsically finite space.

operator(name, backend)[source]

Lower one named local operator through backend.

Parameters:
  • name (str) – Supported local operator name.

  • backend (backend protocol) – Object that supplies native operator constructors.

class quchip.devices.spaces.FockSpace(levels)[source]

Bases: LocalSpace

Finite Fock ladder with standard bosonic and qubit operators.

Parameters:

levels (int) – Hilbert-space dimension, at least 2. The a ladder is truncated at levels - 1.

levels: int
truncation_boundary()[source]

Describe a cutoff, or return None for an intrinsically finite space.

property dimension: int

Return the authored local-space dimension.

matrix(name)[source]

Return a named charge-space matrix.

Parameters:

name ({"n", "cos_phi", "sin_phi", "I"}) – Operator to construct.

operator(name, backend)[source]

Lower one named local operator through backend.

Parameters:
  • name (str) – Supported local operator name.

  • backend (backend protocol) – Object that supplies native operator constructors.

class quchip.devices.spaces.ChargeSpace(num_basis)[source]

Bases: LocalSpace

Finite integer-charge basis centered on zero charge.

Parameters:

num_basis (int) – Odd basis size, at least 3, with charges from -(num_basis-1)//2 to +(num_basis-1)//2.

num_basis: int
truncation_boundary()[source]

Describe a cutoff, or return None for an intrinsically finite space.

property dimension: int

Return the authored local-space dimension.

matrix(name)[source]

Return a named phase-grid matrix.

Parameters:

name ({"phi", "n", "n2", "cos_phi", "sin_phi", "I"}) – Operator to construct.

class quchip.devices.spaces.PhaseGridSpace(points, extent)[source]

Bases: LocalSpace

Uniform endpoint-excluded phase grid with nonperiodic finite differences.

The centered-difference stencil does not wrap across the grid boundary. Values beyond each endpoint are zero. :param points: Number of endpoint-excluded grid points, at least 3. :type points: int :param extent: Positive half-width of the grid, in dimensionless phase radians. :type extent: float

points: int
extent: float
truncation_boundary()[source]

Describe a cutoff, or return None for an intrinsically finite space.

property dimension: int

Return the authored local-space dimension.

matrix(name)[source]

Return one custom operator matrix.

Parameters:

name (str) – Key in operators.

class quchip.devices.spaces.CustomSpace(dimension, operators)[source]

Bases: LocalSpace

Named local operators supplied as matrices or zero-argument JAX callables.

Parameters:
  • dimension (int) – Positive matrix dimension.

  • operators (mapping[str, array or callable]) – Operator providers. Each resulting matrix needs shape (dimension, dimension).

property dimension: int

Return the authored local-space dimension.

matrix(name)[source]

Return one named operator as a JAX-compatible dense array.

Parameters:

name (str) – Operator name supported by the concrete space.