newsynth-0.3.0.2: Exact and approximate synthesis of quantum circuits

Safe HaskellNone

Quantum.Synthesis.Newsynth

Description

This module provides backward compatibility with older versions of the newsynth package. Formerly, it contained an implementation of the single-qubit Clifford+T approximation algorithm of

Since the new algorithm in Quantum.Synthesis.GridSynth is better in all cases, we now simply provide a compatible interface to that algorithm.

New software should not use this module, and it may eventually be removed.

Synopsis

Documentation

newsynth :: RandomGen g => Double -> SymReal -> g -> U2 DOmegaSource

Backward compatible interface to the approximate synthesis algorithm. The parameters are:

  • an angle θ, to implement a Rz(θ) = eiθZ/2 gate;
  • a precision b ≥ 0 in bits, such that ε = 2-b;
  • a source of randomness g.

Output a unitary operator in the Clifford+T group that approximates Rz(θ) to within ε in the operator norm. This operator can then be converted to a list of gates with to_gates.

Note: the argument theta is given as a symbolic real number. It will automatically be expanded to as many digits as are necessary for the internal calculation. In this way, the caller can specify, e.g., an angle of pi/128 :: SymReal, without having to worry about how many digits of π to specify.

newsynth_stats :: RandomGen g => Double -> SymReal -> g -> (U2 DOmega, Maybe Double, Integer)Source

A version of newsynth that also returns some statistics: log0.1 of the actual approximation error (or Nothing if the error is 0), and the number of candidates tried.

newsynth_gates :: RandomGen g => Double -> SymReal -> g -> [Gate]Source

A version of newsynth that returns a list of gates instead of a matrix. The inputs are the same as for newsynth.

Note: the list of gates will be returned in right-to-left order, i.e., as in the mathematical notation for matrix multiplication. This is the opposite of the quantum circuit notation.