graphix.states module

Quantum states and operators.

class State[source]

Bases: ABC

Abstract base class for single qubit states objects.

Only requirement for concrete classes is to have a to_statevector_numpy() method that returns the statevector representation of the state

abstractmethod to_statevector_numpy() → NDArray[complex128][source]

Return the state vector.

to_densitymatrix_numpy() → NDArray[complex128][source]

Return the density matrix.

class PlanarState(plane: Plane, angle: float)[source]

Bases: State

Light object used to instantiate backends.

doesn’t cover all possible states but this is covered in graphix.sim.statevec.Statevector and graphix.sim.densitymatrix.DensityMatrix constructors.

Parameters:
  • plane (graphix.pauli.Plane) – One of the three planes (XY, XZ, YZ)

  • angle (float) – Angle (in units of π)

Returns:

State

Return type:

graphix.states.State object

plane: Plane
angle: float
to_statevector_numpy() → NDArray[complex128][source]

Return the state vector.

__init__(plane: Plane, angle: float) → None
class BasicStates[source]

Bases: object

Basic states.

ZERO: ClassVar[PlanarState] = graphix.states.PlanarState(Plane.XZ, 0)
ONE: ClassVar[PlanarState] = graphix.states.PlanarState(Plane.XZ, 1)
PLUS: ClassVar[PlanarState] = graphix.states.PlanarState(Plane.XY, 0)
MINUS: ClassVar[PlanarState] = graphix.states.PlanarState(Plane.XY, 1)
PLUS_I: ClassVar[PlanarState] = graphix.states.PlanarState(Plane.XY, 0.5)
MINUS_I: ClassVar[PlanarState] = graphix.states.PlanarState(Plane.XY, -0.5)
VEC: ClassVar[list[PlanarState]] = [graphix.states.PlanarState(Plane.XY, 0), graphix.states.PlanarState(Plane.XY, 1), graphix.states.PlanarState(Plane.XZ, 0), graphix.states.PlanarState(Plane.XZ, 1), graphix.states.PlanarState(Plane.XY, 0.5), graphix.states.PlanarState(Plane.XY, -0.5)]