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(Union[ABackend, 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

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

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