Home Reference Source
public class | source

DecompositionRule

A rule for breaking down specific gates into sequences of simpler gates.

Constructor Summary

Public Constructor
public

constructor(gateClass: function, gateDecomposer: function, gateRecognizer: function)

Member Summary

Public Members
public
public
public

Public Constructors

public constructor(gateClass: function, gateDecomposer: function, gateRecognizer: function) source

Params:

NameTypeAttributeDescription
gateClass function

The type of gate that this rule decomposes.

The gate class is redundant information used to make lookups faster when iterating over a circuit and deciding "which rules apply to this gate?" again and again.

Note that this parameter is a gate type, not a gate instance. You supply gate_class=MyGate or gate_class=MyGate().class, not gate_class=MyGate().

gateDecomposer function

Function which, given the command to decompose, applies a sequence of gates corresponding to the high-level function of a gate of type gate_class.

gateRecognizer function

A predicate that determines if the decomposition applies to the given command (on top of the filtering by gate_class).

For example, a decomposition rule may only to apply rotation gates that rotate by a specific angle.

If no gate_recognizer is given, the decomposition applies to all gates matching the gate_class.

Public Members

public gateClass: * source

public gateDecomposer: * source

public gateRecognizer: * source