DumpOperation operation
Fully qualified name: Std.Diagnostics.DumpOperation
operation DumpOperation(nQubits : Int, op : (Qubit[] => Unit is Adj)) : Unit
Summary
Given an operation, dumps the matrix representation of the operation action on the given number of qubits.
Input
nQubits
The number of qubits on which the given operation acts.
op
The operation that is to be diagnosed.
Remarks
When run on the sparse-state simulator, the following snippet will output the matrix $\left(\begin{matrix} 0.0 & 0.707 \\ 0.707 & 0.0\end{matrix}\right)$:
operation DumpH() : Unit {
DumpOperation(1, qs => H(qs[0]));
}
Calling this operation has no observable effect from within Q#.
Note that if DumpOperation
is called when there are other qubits allocated,
the matrix displayed may reflect any global phase that has accumulated from operations
on those other qubits.