A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Tag Info

4

It is limited to matrix $U_f$ which maps $|x,y\rangle$ to $|x,y\oplus f(x)\rangle$, and the little thought is $$U_f|x,-\rangle=\frac{1}{\sqrt{2}}(|x,0\oplus f(x)\rangle-|x,1\oplus f(x)\rangle)=$$ $$=\begin{cases} |x,-\rangle & \text{if }f(x)=0\\ -|x,-\rangle & \text{if }f(x)=1 \end{cases}=(-1)^{f(x)}|x,-\rangle$$ where $x\in\{0,1\}$ or generally $x\... 3 Your first formula is not correct. The correct formula for Hadamard gates for the arbitrary$|x\rangle$from the calculational basis is (it can be proved by induction): $$H^{\otimes n}|x\rangle=\frac{1}{\sqrt{2^n}} \sum_{y=0}^{2n-1}{(-1)^{x\cdot y}}|y\rangle$$ where$x\cdot y=x_0y_0\oplus x_1y_1\oplus x_2y_2\oplus ...\oplus x_ny_n$In case$|x\rangle = |0\...

1

I implemented them as a "subcircuit" so it looks "hidden" from the "outside". constant 0: input = QuantumRegister(1, name='input') temp = QuantumRegister(1, name='temp') constant0 = QuantumCircuit(input, temp, name='oracle') oracle = constant0.to_instruction() identity: input = QuantumRegister(1, name='input') temp = QuantumRegister(1, name='temp') ...

1

@cgranade and I have a chapter on the Deutsch-Jozsa algorithm (Chapter 7) as well as implementations of the oracles for Q# in our book Learn Quantum Computing with Python and Q#. You can find the code samples for the book in the repo here. In particular, the oracles look like this: namespace DeutschJozsa { open Microsoft.Quantum.Intrinsic; ...

1

An oracle $U_f$ is actually $\mathrm{X}$ gate (or a negation). The circuit implementing the oracle is following Qubit $q_0$ is input and qubit $q_{1}$ is output. Firstly $\mathrm{X}$ is applied on $q_{0}$. This negate the qubit, however, we want to have an output on $q_1$. Therefore, we apply $\mathrm{CNOT}$ which in this setting "copy" the $q_{0}$ to ...

1

The $(-1)^{x\cdot y}$ terms come from the matrix elements of $H^{\otimes n}$. To see this, start from considering the matrix elements of $H$. You can check that they can be written as $H_{ij}=(-1)^{ij}$ where $i,j\in\{0,1\}$. The matrix elements of $H^{\otimes n}$ are indexed by tuples of $n$ binary numbers, that is, writing \$I\equiv (i_1,...,i_n), J\equiv(...

Only top voted, non community-wiki answers of a minimum length are eligible