TwoLevelDecompositionSolver

public protocol TwoLevelDecompositionSolver

A quantum gate can be decomposed into a sequence of fully controlled two-level matrix gates and not gates. The following implementation is based on: Decomposition of unitary matrices and quantum gates & Decomposition of unitary matrix into quantum gates

Public methods

  • Decompose one by one each instance in gates to produce an equivalent sequence of fully controlled two-level matrix gates and not gates.

    Declaration

    Swift

    public func decomposeGates(_ gates: [Gate],
                               restrictedToCircuitQubitCount qubitCount: Int) -> Result<[Gate], DecomposeGatesError>

    Parameters

    gates

    Gate instances to decompose.

    qubitCount

    Number of qubits in the circuit.

    Return Value

    A sequence of Gate instances equivalent to gates. Or DecomposeGatesError error.

  • decomposeGates(_:) Extension method

    Decompose one by one each instance in gates to produce an equivalent sequence of fully controlled two-level matrix gates and not gates.

    Declaration

    Swift

    public func decomposeGates(_ gates: [Gate]) -> Result<[Gate], DecomposeGatesError>

    Parameters

    gates

    Gate instances to decompose.

    Return Value

    A sequence of Gate instances equivalent to gates. Or DecomposeGatesError error.