Safe Haskell  None 

Language  Haskell98 
This module provides an enumeration type for gate bases. This is useful, for example, to provide a uniform interface to gate base decomposers, so that they can be selected via command line options or function arguments.
Synopsis
 data GateBase
 gatebase_enum :: [(String, GateBase)]
 decompose_generic :: (QCData qa, QCData qb, QCurry qfun qa qb) => GateBase > qfun > qfun
Gate bases
An enumeration type for gate bases. More cases can be added in the future, for example for using gates from a particular physical machine description.
Some gate bases carry additional parameters; for example, in the case of decomposition into a discrete gate base, one may specify a precision ε, a random seed, or other flags.
If a Precision
parameter is present, it specifies the desired
precision per gate. If a RandomSource
parameter is present, it
specifies a source of randomness.
If a KeepPhase
parameter is present, it determines whether global
phases are respected (True
) or disregarded (False
).
Logical  Use all logical gates, i.e., leave the circuit unchanged. 
Binary  Decompose into binary gates. 
Toffoli  Decompose into Toffoli and binary gates. 
CliffordT_old  Decompose into Clifford+T. This is a legacy transformer
that does not handle all gates correctly. For example, it does
not handle Wgates, rotations, or phase gates. Use

CliffordT KeepPhase Precision RandomSource  Decompose into Clifford+T, specifically: singlequbit Clifford gates, the controllednot gate (with positive or negative controls), and the gates T and T^{†}. 
Standard Precision RandomSource  Decompose into the standard gate set, which we define to be X, Y, Z, H, S, S^{†}, T, T^{†}, and CNOT. Suppresses global phases. 
Strict Precision RandomSource  Decompose into H, S, T, CNOT gates only. Suppresses global phases. 
Approximate KeepPhase Precision RandomSource  Decompose rotation and phase gates into Clifford+T, using an approximate synthesis algorithm. Other gates are unchanged. 
Exact  Decompose gates that can be exactly represented in the Clifford+T base into that base, specifically: singlequbit Clifford gates, the controllednot gate (with positive or negative controls), and the gates T and T^{†}. Leave rotation and phase gates unchanged. 
TrimControls  Eliminate excess controls from gates. 
gatebase_enum :: [(String, GateBase)] Source #
An assignment of gate bases to names. Names are given as lowercase strings.
This can be useful, e.g., in the definition of command line options.
In the future, the syntax should be extended so that users can specify parameters (e.g., the precision, random seed) on the command line as well. For now, we just use the default precision.
Generic decomposition
decompose_generic :: (QCData qa, QCData qb, QCurry qfun qa qb) => GateBase > qfun > qfun Source #
Decompose a circuit into gates from the given GateBase
. This
can be applied to a circuitgenerating function in curried form
with n arguments, for any n ≥ 0.
The type of this heavily overloaded function is difficult to read. In more readable form, it has all of the following types:
decompose_generic :: (QCData qa) => GateBase > Circ qa > Circ qa decompose_generic :: (QCData qa, QCData qb) => GateBase > (qa > Circ qb) > (qa > Circ qb) decompose_generic :: (QCData qa, QCData qb, QCData qc) => GateBase > (qa > qb > Circ qc) > (qa > qb > Circ qc)
and so forth.