Catalog

The concept of the catalog is to provide the user a set of basic of qbit or photonic gate or circuit.

All circuits share the same interface that is describe by the following class CatalogItem:

class perceval.components.component_catalog.CatalogItem(name)
abstract build_circuit(**kwargs)

Build the component as circuit

Return type:

Circuit

Returns:

A Perceval circuit

abstract build_processor(**kwargs)

Build the component as processor

kwargs:
  • backend(ABackend or str): Name or instance of a simulation backend. Default “SLOS”

Return type:

Processor

Returns:

A Perceval processor

property name: str

Name of the component

Returns:

Name of the component

The catalog object work as a dictionary. To select the wanted component you must address it with its catalog key.

For example to get an heralded CZ gate, you must call it as followed:

from perceval import catalog
catalog['heralded cz']

You can after either get it as a circuit or a processor:

from perceval import catalog
processor = catalog['heralded cz'].build_processor() # Will return a processor
circuit = catalog['heralded cz'].build_circuit() # Will return a circuit

If a gate have parameters, like for instance a Mach-Zehnder interferometer phase first you can set those parameters as followed:

import math
from perceval import catalog
circuit = catalog["mzi phase first"].build_circuit(phi_a=math.pi,
                                                   phi_b=math.pi))

Klm Cnot

Catalog key: klm cnot

KLM CNOT gate with 4 ancillary modes You probably shouldn’t use the KLM CNOT, except for educational purpose. The Knill CNOT is better in every aspect (see ‘heralded cnot’ in the catalog)

                      ╭─────╮
ctrl (dual rail) ─────┤     ├───── ctrl (dual rail)
                 ─────┤     ├─────
                      │     │
data (dual rail) ─────┤     ├───── data (dual rail)
                 ─────┤     ├─────
                      ╰─────╯

See also: postprocessed cnot and heralded cnot (using cz)

Scientific article reference: https://doi.org/10.1073/pnas.1018839108

Heralded Cnot

Catalog key: heralded cnot

Knill CNOT gate with 2 heralded modes (built using Heralded CZ and H).

                              ╭──────────╮
ctrl (dual rail) ─────────────┤          ├───────────── ctrl (dual rail)
                 ─────────────┤ Heralded ├─────────────
                      ╭───╮   │    CZ    │   ╭───╮
data (dual rail) ─────┤ H ├───┤          ├───┤ H ├───── data (dual rail)
                 ─────┤   ├───┤          ├───┤   ├─────
                      ╰───╯   ╰──────────╯   ╰───╯

See also: heralded cz, postprocessed cnot and klm cnot

Postprocessed Cnot

Catalog key: postprocessed cnot

CNOT gate with 2 heralded modes and a post-selection function

                      ╭─────╮
ctrl (dual rail) ─────┤     ├───── ctrl (dual rail)
                 ─────┤     ├─────
                      │     │
data (dual rail) ─────┤     ├───── data (dual rail)
                 ─────┤     ├─────
                      ╰─────╯

See also: klm cnot and heralded cnot (using cz)

Scientific article reference: https://journals.aps.org/pra/abstract/10.1103/PhysRevA.65.062324

Heralded Cz

Catalog key: heralded cz

Knill CZ gate with 2 heralded modes

                      ╭─────╮
ctrl (dual rail) ─────┤     ├───── ctrl (dual rail)
                 ─────┤     ├─────
                      │     │
data (dual rail) ─────┤     ├───── data (dual rail)
                 ─────┤     ├─────
                      ╰─────╯

Scientific article reference: https://arxiv.org/abs/quant-ph/0110144

Postprocessed Cz

Catalog key: postprocessed cz

CZ gate with 2 heralded modes and a post-selection function

                      ╭─────╮
ctrl (dual rail) ─────┤     ├───── ctrl (dual rail)
                 ─────┤     ├─────
                      │     │
data (dual rail) ─────┤     ├───── data (dual rail)
                 ─────┤     ├─────
                      ╰─────╯

See also: heralded cz

Scientific article reference: https://journals.aps.org/pra/abstract/10.1103/PhysRevA.65.062324

Generic 2 Mode Circuit

Catalog key: generic 2 mode circuit

A universal 2 mode component, implemented as a beam splitter with variable theta + 3 free phases

Parameters:
  • theta: name or numerical value for beam splitter ‘theta’ parameter (default ‘theta’)

  • phi_tl: name or numerical value for top left phase (default ‘phi_tl’)

  • phi_bl: name or numerical value for bottom left phase (default ‘phi_bl’)

  • phi_tr: name or numerical value for top right phase (default ‘phi_tr’)

    ╭──────╮╭─────╮╭──────╮
0:──┤phi_tl├┤     ├┤phi_tr├──:0
    ╰──────╯│BS.H │╰──────╯
    ╭──────╮│theta│
1:──┤phi_bl├┤     ├──────────:1
    ╰──────╯╰─────╯

Mzi Phase First

Catalog key: mzi phase first

Mach-Zehnder interferometer

Parameters:
  • phi_a: first phase of the MZI (default ‘phi_a’)

  • phi_b: second phase of the MZI (default ‘phi_b’)

  • theta_a: theta value of the first beam splitter (default pi/2)

  • theta_b: theta value of the second beam splitter (default pi/2)

    ╭─────╮╭─────╮╭─────╮╭─────╮
0:──┤phi_a├┤BS.Rx├┤phi_b├┤BS.Rx├──:0
    ╰─────╯│     │╰─────╯│     │
1:─────────┤     ├───────┤     ├──:1
           ╰─────╯       ╰─────╯

See also: mzi phase last

Mzi Phase Last

Catalog key: mzi phase last

Mach-Zehnder interferometer

Parameters:
  • phi_a: first phase of the MZI (default ‘phi_a’)

  • phi_b: second phase of the MZI (default ‘phi_b’)

  • theta_a: theta value of the first beam splitter (default pi/2)

  • theta_b: theta value of the second beam splitter (default pi/2)

    ╭─────╮       ╭─────╮
0:──┤BS.Rx├───────┤BS.Rx├─────────:0
    │     │╭─────╮│     │╭─────╮
1:──┤     ├┤phi_a├┤     ├┤phi_b├──:1
    ╰─────╯╰─────╯╰─────╯╰─────╯

See also: mzi phase first

Symmetric Mzi

Catalog key: symmetric mzi

Mach-Zehnder interferometer

Parameters:
  • phi_a: first phase of the MZI (default ‘phi_a’)

  • phi_b: second phase of the MZI (default ‘phi_b’)

  • theta_a: theta value of the first beam splitter (default pi/2)

  • theta_b: theta value of the second beam splitter (default pi/2)

    ╭─────╮╭─────╮╭─────╮
0:──┤BS.Rx├┤phi_a├┤BS.Rx├──:0
    │     │╰─────╯│     │
    │     │╭─────╮│     │
1:──┤     ├┤phi_b├┤     ├──:1
    ╰─────╯╰─────╯╰─────╯

See also: mzi phase first

Postprocessed Ccz

Catalog key: postprocessed ccz

CCZ gate with 6 heralded modes and a post-selection function

                       ╭─────╮
ctrl0 (dual rail) ─────┤     ├───── ctrl0 (dual rail)
                  ─────┤     ├─────
                       │     │
ctrl1 (dual rail) ─────┤     ├───── ctrl1 (dual rail)
                  ─────┤     ├─────
                       │     │
data (dual rail)  ─────┤     ├───── data (dual rail)
                  ─────┤     ├─────
                       ╰─────╯

Scientific article reference: https://journals.aps.org/pra/abstract/10.1103/PhysRevA.65.062324

Toffoli

Catalog key: toffoli

Toffoli gate CCNOT gate with 6 heralded modes and a post-selection function (built using post-processed CCZ and H).

                               ╭──────────╮
ctrl0 (dual rail) ─────────────┤          ├───────────── ctrl0 (dual rail)
                  ─────────────┤          ├─────────────
ctrl1 (dual rail) ─────────────┤          ├───────────── ctrl1 (dual rail)
                  ─────────────┤   CCZ    ├─────────────
                       ╭───╮   │          │   ╭───╮
data (dual rail)  ─────┤ H ├───┤          ├───┤ H ├───── data  (dual rail)
                  ─────┤   ├───┤          ├───┤   ├─────
                       ╰───╯   ╰──────────╯   ╰───╯

Postprocessed Controlled Gate

Catalog key: postprocessed controlled gate

n-qubit controlled rotation gate C…CZ(alpha) with 2*n ancillary modes and a post-selection function

Parameters:
  • n: number of qubit of the gate

  • alpha: angle of the controlled-rotation

                        ╭─────╮
ctrl0 (dual rail)  ─────┤     ├───── ctrl0 (dual rail)
                   ─────┤     ├─────
                        │     │
ctrl1 (dual rail)  ─────┤     ├───── ctrl1 (dual rail)
                   ─────┤     ├─────
    .                      .           .
    .                      .           .
    .                      .           .
ctrlN (dual rail)  ─────┤     ├───── ctrlN (dual rail)
                   ─────┤     ├─────
                        ╰─────╯

Scientific article reference: https://arxiv.org/abs/2405.01395

X

Catalog key: x

2 modes LO circuit equivalent of the Pauli X single Qubit Gate.

                ╭───╮
Q (dual rail) ──┤ X ├── Q (dual rail)
              ──┤   ├──
                ╰───╯

Y

Catalog key: y

2 modes LO circuit equivalent of the Pauli Y single Qubit Gate.

                ╭───╮
Q (dual rail) ──┤ Y ├── Q (dual rail)
              ──┤   ├──
                ╰───╯

Z

Catalog key: z

2 modes LO circuit equivalent of the Pauli Z single Qubit Gate.

                ╭───╮
Q (dual rail) ──┤ Z ├── Q (dual rail)
              ──┤   ├──
                ╰───╯

H

Catalog key: h

2 modes LO circuit equivalent of the Hadamard single Qubit Gate.

                ╭───╮
Q (dual rail) ──┤ H ├── Q (dual rail)
              ──┤   ├──
                ╰───╯

Rx

Catalog key: rx

2 modes LO circuit equivalent of the Rx single Qubit Gate.

                ╭────╮
Q (dual rail) ──┤ Rx ├── Q (dual rail)
              ──┤    ├──
                ╰────╯

Ry

Catalog key: ry

2 modes LO circuit equivalent of the Ry single Qubit Gate.

                ╭────╮
Q (dual rail) ──┤ Ry ├── Q (dual rail)
              ──┤    ├──
                ╰────╯

Rz

Catalog key: rz

2 modes LO circuit equivalent of the Rz single Qubit Gate.

                ╭────╮
Q (dual rail) ──┤ Rz ├── Q (dual rail)
              ──┤    ├──
                ╰────╯

Ph

Catalog key: ph

2 modes LO circuit equivalent of the Phase Shifter single Qubit Gate.

                ╭────╮
Q (dual rail) ──┤ Ps ├── Q (dual rail)
              ──┤    ├──
                ╰────╯

S

Catalog key: s

2 modes LO circuit equivalent of the S single Qubit Gate.

                ╭───╮
Q (dual rail) ──┤ S ├── Q (dual rail)
              ──┤   ├──
                ╰───╯

Sdag

Catalog key: sdag

2 modes LO circuit equivalent of the \(S^†\) single Qubit Gate.

                ╭────╮
Q (dual rail) ──┤ S† ├── Q (dual rail)
              ──┤    ├──
                ╰────╯

T

Catalog key: t

2 modes LO circuit equivalent of the T single Qubit Gate.

                ╭───╮
Q (dual rail) ──┤ T ├── Q (dual rail)
              ──┤   ├──
                ╰───╯

Tdag

Catalog key: tdag

2 modes LO circuit equivalent of the \(T^†\) single Qubit Gate.

                ╭────╮
Q (dual rail) ──┤ T† ├── Q (dual rail)
              ──┤    ├──
                ╰────╯

Qloq Ansatz

Catalog key: qloq ansatz

A QLOQ Ansatz generator, linking qudits with CZ gates

Parameters:
  • group_sizes: list of DUAL_RAIL or QUDITn Encodings

  • layers: list of rotation layers to apply. Values can be either ‘X’, ‘Y’, or ‘Z’

  • phases: list of names or numerical values for qudit phases (default ‘phi{i}’). Required length can be computed using self.get_parameter_nb

  • ctype: name of the entanglement gate to apply. Value can be either ‘cx’ or ‘cz’ (default ‘cx’)

User defined (depends on the parameters)

Scientific article reference: https://arxiv.org/pdf/2411.03878