Skip to content

Conversation

@mateuszkupper
Copy link
Collaborator

@mateuszkupper mateuszkupper commented Jun 24, 2025

Reorganisation of all optyx generators into two categories: user-facing and back-end. User-facing generators are subclasses of Channel - they represent physical gates or operations which are of use in building hybrid photon-qubit circuit. The back-end classes (core) are the graphical languages on which the user-facing channels are based on - they provide a way to define Kraus maps for the user-facing channels.

Qubit primitives:

Category Primitives Description
Circuits Circuit, QubitChannel Quantum circuits and channels operating on qubits.
ZX Z, X, H, Scalar, Bra, Ket Core ZX-calculus generators (spiders, Hadamard, scalar).
Errors BitFlipError, DephasingError Stochastic error channels acting on qubits.
Classical-quantum Encode, Discard, Measure Channels for encoding, discarding, and measuring qubits.

Photonic primitives:

Category Primitives Description
Measurements Discard, PhotonThresholdMeasurement, NumberResolvingMeasurement Operations that discard modes or measure photon number (threshold or resolving).
Linear optical gates Gate, Phase, BBS, TBS, MZI, ansatz Unitary transformations built from beam splitters, phase shifters, and general interferometers.
Dual-rail operators DualRail, HadamardBS, PhaseShiftDR, ZMeasurementDR, XMeasurementDR, FusionTypeI, FusionTypeII Gates and measurements for qubits encoded in dual-rail photonic modes.
States Encode, Create Preparation of photonic states and encoding of modes.
Other NumOp, Scalar, PhotonLoss Miscellaneous operators.

Classical primitives:

Category Primitives Description
Logic gates NotBit, XorBit, AndBit, OrBit, CopyBit, SwapBit, Z, X, H Boolean operations and ZX spiders acting on classical bits.
Arithmetic on modes AddN, SubN, MultiplyN, DivideN, Mod2, CopyN, SwapN Integer arithmetic and data-movement primitives on natural-number modes.
Control & routing BitControlledGate, BitControlledPhaseShift, ClassicalFunction, BinaryMatrix Classical control of quantum gates and generic functions/matrix maps on bit or mode registers.
Bit, digits & selection PostselectBit, PostselectDigit, DiscardBit, DiscardMode, Select, Digit, Bit, Id, Scalar State preparation, post-selection, discarding, and identity/scalar boxes for classical data.

Note: the functionality to convert to optyx from tket is not available until the tket->discopy conversion method (no init_and_discard) is modified.

@mateuszkupper mateuszkupper marked this pull request as ready for review July 7, 2025 09:11
@mateuszkupper mateuszkupper requested a review from giodefelice July 7, 2025 09:26
Copy link
Collaborator

@giodefelice giodefelice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good! A couple of things:

  1. There is an error message in the ZX transpilation notebook. That notebook can be removed all-together.

  2. The LO diagrams obtained from dual_rail_encoding map are huge and clutter the documentation. Remove this from everywhere except maybe in the zx module.

Copy link
Collaborator

@giodefelice giodefelice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments can be handled in future PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants