qat.synthopline.phase_polynomial_synthesis

qat.synthopline.phase_polynomial_synthesis(phase_polynomial, method='gray_synth', synthesize_final=True, linear_operator=None, **kwargs)

Produces a quantum circuit implementing a phase polynomial.

Phase polynomials are a subset of unitary operators that can be described as:

\(|x\rangle \mapsto e^{2i\pi f(x)}|x\rangle\)

where \(f\) is a linear real valued function: \(f(x) = \sum_{y\in \mathbb{F}_2^n} \hat{f}(y).(x_1 y_1 \oplus x_2 y_2 \oplus \cdots \oplus x_n y_n)\) with Fourier coefficients \(\hat{f}(y)\).

In practice, the input phase polynomial is described by a map \(y \mapsto \hat{f}(y)\) mapping bitrings (parities) to non-zero real values (angles) (thus ommitting entries that have 0 as Fourier coefficient).

The method is also able to handle abstract fourier coefficient described by variables or arithmetic expressions. In that case, the output circuit will be a parametrized circuit.

This method is a binder to lower level c++ methods. The synthesis method can be chosen via the method parameter. Some methods have additional required parameters that can be passed via the kwargs argument (see below).

Algorithms:

gray_synth: GraySynth is an algorithm introduced by Amy et al in [AAM18]. It is provably optimal when \(f\) is full.

gray_synth_on_graph: An extension of GraySynth to limited connectivity. The heuristics is developed in [dGD20] and adopts the same recursive formulation as [AAM18] with additional constraints on the pivot choices.

lazy_synth: A lazy linear operator synthesis algorithm that greedily generates pieces of circuit in order to insert phase gates. The algorithm depends on a depth parameter to perform local exhaustive search. This parameter influences a lot the runtime and the quality of the final circuit (the higher, the longer the synthesis and the better the circuit). This method usually yields better results than gray_synth_on_graph for depth 2+.

Parameters
  • phase_polynomial (dict) – a dictionary mapping 0/1 value tuples of length n (the number of qubits) to a rotation parameter (a numeric type and/or an ArithExpression).

  • method (str) – the synthesis method to use. Default method is greedy.

  • synthesize_final (optional, bool) – if set to True, the final basis change is also synthesized via linear_operator_synthesis(). In that case, the output table can safely expected to be a permutation. If this is set, the method used for the linear synthesis can be specified via the linear_method kwarg (see below). Defaults to True.

  • linear_operator (optional, np.ndarray) – if set and synthesize_final is set to True, the operator will be synthesized and appended and the end of the circuit.

  • kwargs – additional parameters passed to the synthesis routine.

Additional parameters:
All methods:
  • linear_method (str): the linear operator synthesis method to use in order to synthesize the final basis change (used only if synthesize_final is set to True). Any additional parameters for this final synthesis can be passed inside the kwargs.

gray-synth on graph:
  • graph (nx.Graph): a networkx graph describing the chip connectivity. This parameter is required and the method will raise an exception if it is not set

lazy synthesis:
  • graph (nx.Graph): a networkx graph describing the chip connectivity. If no graph is provided, the algorithm assumes all-to-all connectivity.

  • any parameter accepted by the LazySynthesis plugin. If no strategy keyword is provided, the “clifford” strategy is employed, with the reorder keyword set to True. This implies a runtime that is quadratic in the number of parities. Set reorder to False in order to go back to a linear runtime.

Returns

a pair (circuit, table) such that circuit implements the phase polynomial and table describes the output parities of circuit

Return type

Circuit, np.ndarray

Note

The second output argument is not to be neglected, even when the synthesize_final argument is set to True. Depending on the method used to synthesize the final table, the output table might be a permutation remapping the output wires of the circuit, and thus should be taken into account when composed with another circuit.

Note

This method is available as an application in Qaptiva Access.