# Tag Info

Remember that when you define the oracle effect as $B_f |x \rangle |y \rangle = |x \rangle |y \oplus f(x) \rangle$, $f(x)$ is a classical function of a classical 1-bit argument, so you do not have a way to compute $f(\frac {1} {\sqrt 2} |0\rangle +\frac {1} {\sqrt 2} |1\rangle)$ (a function of a quantum state). The quantum oracles that implement classical ...
I would use a circuit that looks like: Where $|0\rangle$ is an ancillary output bit. Assume the initial state of the system is in the standard basis. Here, the first $\land_2(X)$ (CCNOT) applies the $X$ gate to the target qubit for all states that have their two least significant bits set to 1. Note that if none of the states have $|x_{n-1}\rangle=|1\... 3 There are several different answers to your question, but let me give the answer that computer scientists will find most satisfying here. As it comes to implementing general unitary operators$U$, I would like to refer you to section 4.5 in the book "Quantum Computation and Information" by Nielsen and Chuang. They give a construction which allows one to ... 2 Typically the second option: you map the fermionic occupation number for each single-particle state to a qubit. (Also, the usual convention is that$0$denotes unoccupied,$1$denotes occupied ;) This mapping is usually accomplished via the Jordan-Wigner or Bravyi-Kitaev transformation, or some hybrid of the two: see https://arxiv.org/abs/1208.5986 for a ... 1 I think you've simplified the problem too much. The way your question is framed it sounds like you expect a square-root speedup of a small problem, which doesn't seem that impressive. In actuality there may be a Grover-style speedup not of$O(\sqrt{X Y})$but of$O(\sqrt{2^X 2^Y})$. Let's set up the problem, and see what is to be solved. Let's let your ... 1 As a reminder, Shor's algorithm is implemented in the gate model of computation. As mentioned by @nippon, factoring is can also be described as an optimization problem, which may be solved with an adiabatic algorithm - e.g., by evolving a quantum state to a minimum of$(N-xy)^2$,$x$and$y$may be factors of$N$. The adiabatic algorithm's runtime is, as I ... 1 First point: in most of the cases, the QPE algorithm cannot output the integer$x$. That is why$w$is introduced in the algorithm: to represent the closest approximation of$x$that can be returned by the QPE. About your question, no the QPE is not always 100% successful (in this case successful means that the algorithm returns$w$, the closest ... 1 For a more high-level interface to coding and running variational quantum algorithms, you can also check out the PennyLane Python library, which has a Qiskit plugin available for using Qiskit simulators and IBM hardware as a backend. For example, a variational quantum algorithm in PennyLane using qiskit looks like this: import pennylane as qml dev = qml.... 1 In this Qiskit Aqua tutorial, they show how to use the Variational Quantum Eigensolver (VQE) for solving a ground state energy problem. Here's another in the context of the travelling salesman problem. Note that both use the Aer simulators as backend and not the real IBMQ devices. You might also want to go through their documentation on VQE, Variational ... 1 "What feature of a quantum algorithm makes it better than its classical counterpart?" First, a classical algorithm can be thought of a quantum algorithm that makes no use of quantum superpositions. Therefore a quantum algorithm can be at least as good as its classical counterpart. No classical algorithm can be "better" than quantum algorithms can do, ... 1 I'm confused about what you want to do with a$256\times 256$matrix of integers$[0,1,\cdots, 255]$. You can create a uniform superposition by Hadamard'ing$24$separate qubits, and consider your system as the adjacency matrix of a$256$-vertex directed graph, where vertices can be connected with an edge weighted with an integer between$0$and$2^8-1=255$.... 1 If you implement an oracle for Grover's algorithm that sometimes gives unhelpful answers, you can, as you suggest, rerun and remeasure. In your example, there are only two incorrect answers$x=0$and$x=m$. With the way you defined$f(x)$, these would indeed be negated and diffused. Because there are only two bad answers, the impact may be small. However ... 1 Since the state$|\psi\rangle$is known, we can assume that we have a preparation procedure that takes some standard state (call it$|0\rangle$, although in general it will be composed of many qubits). Thus, there is a unitary$V$such that $$V|0\rangle=|\psi\rangle.$$ In that case, to measure$|\langle\psi|U|\psi\rangle|^2$, we simply follow the ... 1 To find modulus of that expectation value you can use swap test on$|\psi\rangle \otimes U|\psi\rangle$. I doubt there are simpler ways since$\langle \psi |U|\psi\rangle$is complex in general. Also note, that both algorithms you mentioned require access to the controlled version of$U$. But you can't construct circuit for controlled$U$if$U\$ is given as ...