AssertOperationsEqualInPlace operation

Namespace: Microsoft.Quantum.Diagnostics

Package: Microsoft.Quantum.QSharp.Core

Given two operations, asserts that they act identically for all input states.

This assertion is implemented by checking the action of the operations on all states of the form $V_0 \otimes ... \otimes V_{n-1}$, where $V_k$ is one of the states $\ket{0}$, $\ket{1}$, $\ket{+}$ and $\ket{i}$ (+1 eigenstate of Pauli Y operator).

This assertion uses $n$ qubits and requires multiple calls of the operations being compared.

operation AssertOperationsEqualInPlace (nQubits : Int, givenU : (Qubit[] => Unit), expectedU : (Qubit[] => Unit is Adj)) : Unit

Input

nQubits : Int

The number of qubits $n$ that the operations givenU and expectedU operate on.

givenU : Qubit[] => Unit

Operation on $n$ qubits to be checked.

expectedU : Qubit[] => Unit is Adj

Reference operation on $n$ qubits that givenU is to be compared against.

Output : Unit

References

The basis of states $\ket{0}$, $\ket{1}$, $\ket{+}$ and $\ket{i}$ is the Chuang-Nielsen basis, described in I. L. Chuang, M. A. Nielsen .

See Also