Like the title says, how to realize the Grover's Diffusion Operator in Q#? I know it's defined as 2 ⟨s|s⟩ - I
where |s⟩
is the uniform state for any arbitrary number of qubits. This can further be defined in terms of Z0 (saw it called U0) gate sandwiched by a pair of H-gates. I was unable to find any function in the quantum primitive and canon docs starting with possible names like Grover, diff etc.
I don't want to use the function AmpAmpByOracle
since it is very high level implementation and doesn't clear my understanding. I want to implement a function that takes a oracle Uf(unknown to me suppose) and the number of qubit it takes(N) and perform the Grover's algorithm by simply following the circuit given in Grover's Algorithm | Wikipedia and measure the required state by measuring all the N qubits at the end of r = approx(2^(N/2)) iterations.