sf.circuitspecs.X12_02

class X12_02[source]

Bases: strawberryfields.circuitspecs.X12.X12Specs

Circuit specifications for the second X12 chip.

circuit

decompositions

graph

The allowed circuit topologies or connectivity of the class, modelled as a directed acyclic graph.

interactive

local

modes

parameter_ranges

Allowed parameter ranges for supported quantum operations.

primitives

remote

short_name

sq_amplitude

circuit = 'name template_6x2_X12\nversion 1.0\ntarget X12_02 (shots=1)\n\n# for n spatial degrees, first n signal modes, then n idler modes, all phases zero\nS2gate({squeezing_amplitude_0}, 0.0) | [0, 6]\nS2gate({squeezing_amplitude_1}, 0.0) | [1, 7]\nS2gate({squeezing_amplitude_2}, 0.0) | [2, 8]\nS2gate({squeezing_amplitude_3}, 0.0) | [3, 9]\nS2gate({squeezing_amplitude_4}, 0.0) | [4, 10]\nS2gate({squeezing_amplitude_5}, 0.0) | [5, 11]\n\n# standard 6x6 interferometer for the signal modes (the lower ones in frequency)\n# even phase indices correspond to internal Mach-Zehnder interferometer phases\n# odd phase indices correspond to external Mach-Zehnder interferometer phases\nMZgate({phase_0}, {phase_1}) | [0, 1]\nMZgate({phase_2}, {phase_3}) | [2, 3]\nMZgate({phase_4}, {phase_5}) | [4, 5]\nMZgate({phase_6}, {phase_7}) | [1, 2]\nMZgate({phase_8}, {phase_9}) | [3, 4]\n\nMZgate({phase_10}, {phase_11}) | [0, 1]\n\nMZgate({phase_12}, {phase_13}) | [2, 3]\nMZgate({phase_14}, {phase_15}) | [4, 5]\nMZgate({phase_16}, {phase_17}) | [1, 2]\nMZgate({phase_18}, {phase_19}) | [3, 4]\n\nMZgate({phase_20}, {phase_21}) | [0, 1]\nMZgate({phase_22}, {phase_23}) | [2, 3]\nMZgate({phase_24}, {phase_25}) | [4, 5]\nMZgate({phase_26}, {phase_27}) | [1, 2]\nMZgate({phase_28}, {phase_29}) | [3, 4]\n\n# duplicate the interferometer for the idler modes (the higher ones in frequency)\nMZgate({phase_0}, {phase_1}) | [6, 7]\nMZgate({phase_2}, {phase_3}) | [8, 9]\nMZgate({phase_4}, {phase_5}) | [10, 11]\nMZgate({phase_6}, {phase_7}) | [7, 8]\nMZgate({phase_8}, {phase_9}) | [9, 10]\n\nMZgate({phase_10}, {phase_11}) | [6, 7]\nMZgate({phase_12}, {phase_13}) | [8, 9]\nMZgate({phase_14}, {phase_15}) | [10, 11]\nMZgate({phase_16}, {phase_17}) | [7, 8]\nMZgate({phase_18}, {phase_19}) | [9, 10]\n\nMZgate({phase_20}, {phase_21}) | [6, 7]\nMZgate({phase_22}, {phase_23}) | [8, 9]\nMZgate({phase_24}, {phase_25}) | [10, 11]\nMZgate({phase_26}, {phase_27}) | [7, 8]\nMZgate({phase_28}, {phase_29}) | [9, 10]\n\n# add final dummy phases to allow mapping any unitary to this template (these do not\n# affect the photon number measurement)\nRgate({final_phase_0}) | [0]\nRgate({final_phase_1}) | [1]\nRgate({final_phase_2}) | [2]\nRgate({final_phase_3}) | [3]\nRgate({final_phase_4}) | [4]\nRgate({final_phase_5}) | [5]\nRgate({final_phase_6}) | [6]\nRgate({final_phase_7}) | [7]\nRgate({final_phase_8}) | [8]\nRgate({final_phase_9}) | [9]\nRgate({final_phase_10}) | [10]\nRgate({final_phase_11}) | [11]\n\n# measurement in Fock basis\nMeasureFock() | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]\n'
decompositions = {'BipartiteGraphEmbed': {'drop_identity': False, 'mesh': 'rectangular_symmetric'}, 'Interferometer': {'drop_identity': False, 'mesh': 'rectangular_symmetric'}}
graph

The allowed circuit topologies or connectivity of the class, modelled as a directed acyclic graph.

This property is optional; if arbitrary topologies are allowed in the circuit class, this will simply return None.

Returns

a directed acyclic graph

Return type

networkx.DiGraph

interactive = False
local = True
modes = 12
parameter_ranges

Allowed parameter ranges for supported quantum operations.

This property is optional.

Returns

a dictionary mapping an allowed quantum operation to a nested list of the form [[p0_min, p0_max], [p1_min, p0_max], ...]. where pi corresponds to the i th gate parameter

Return type

dict[str, list]

primitives = {'BSgate', 'MZgate', 'MeasureFock', 'Rgate', 'S2gate'}
remote = True
short_name = 'X12_02'
sq_amplitude = 1.0

compile(seq, registers)

Try to arrange a quantum circuit into a form suitable for X12.

decompose(seq)

Recursively decompose all gates in a given sequence, as allowed by the circuit specification.

compile(seq, registers)

Try to arrange a quantum circuit into a form suitable for X12.

Parameters
  • seq (Sequence[Command]) – quantum circuit to modify

  • registers (Sequence[RegRefs]) – quantum registers

Returns

modified circuit

Return type

List[Command]

Raises

CircuitError – the circuit does not correspond to X12

decompose(seq)

Recursively decompose all gates in a given sequence, as allowed by the circuit specification.

This method follows the directives defined in the primitives and decompositions class attributes to determine whether a command should be decomposed.

The order of precedence to determine whether decomposition should be applied is as follows.

  1. First, we check if the operation is in decompositions. If not, decomposition is skipped, and the operation is applied as a primitive (if supported by the CircuitSpecs).

  2. Next, we check if (a) the operation supports decomposition, and (b) if the user has explicitly requested no decomposition.

    • If both (a) and (b) are true, the operation is applied as a primitive (if supported by the CircuitSpecs).

    • Otherwise, we attempt to decompose the operation by calling decompose() recursively.

Parameters

list[strawberryfields.program_utils.Command] – list of commands to be decomposed

Returns

list of compiled commands for the circuit specification

Return type

list[strawberryfields.program_utils.Command]