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
-
Decompose
gate
into a sequence of fully controlled two-level matrix gates and not gates.Declaration
Swift
func decomposeGate(_ gate: Gate, restrictedToCircuitQubitCount qubitCount: Int) -> Result<[Gate], QuantumOperatorError>
Parameters
gate
Gate
instance to decompose.qubitCount
Number of qubits in the circuit.
Return Value
A sequence of
Gate
instances that replace the inputgate
. OrQuantumOperatorError
error.
-
decomposeGates(_:
Extension methodrestrictedToCircuitQubitCount: ) 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 togates
. OrDecomposeGatesError
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 togates
. OrDecomposeGatesError
error.