11

Both finite differences and the parameter-shift rule can be used to compute quantum gradients on quantum hardware. However, there are several reasons that lead to the parameter-shift rule being preferred. Numerical differentiation One method to compute gradients is finite difference, a form of numerical differentiation. Here we treat the function to be ...


8

As requested in the comments, here is a worked example. The main body deals with minimizing $f(x)$ for a specific problem. At the bottom follows a brief discussion of constraints then a brief discussion about the general case. Let's solve the Weighted Maximum Cut problem since this Is a relatively straight-forward example Is hard classically Is a ...


7

For the specific linear function you are interested in, the solution turns out to be trivial: you can take the channel to be $N_{X\rightarrow Y}(\rho) = \operatorname{Tr}(\rho) |\psi\rangle\langle \psi|$ for $|\psi\rangle$ being an eigenvector of $\sigma_Y$ having the largest possible eigenvalue. More generally, however, you can optimize any real-valued ...


6

What motivated this construction is mentioned in the original paper (section VI): adiabatic quantum computing. This construction is basically a Trotterized version of the evolution by the time dependent hamiltonian: $$ H(t) = (1-t/T)B + (t/T) C $$ where T is the total runtime. The Trotterized evolution consists of alternately applying $U_{C}$ and $U_{B}$. ...


6

(This answer uses ancillae and feedback) Does anyone know if there has been any improvement on the decomposition of the general n-qubits control X with phase differences in terms of elementary gates up to this day? [...] And also what is the theoretical lower bound? About a week ago I would have told you it's probably not possible to do better than a T ...


5

Short Answer: It is potentially hard (as bRost03 indicates in the comments). To be precise, coNP-hard. Longer Answer: In adiabatic quantum computation, the ground-space of the final Hamiltonian is typically determined by the optimum solution to some constraint satisfaction problem (CSP). If the CSP is perfectly solvable, the ground-space is spanned by (...


5

Here is the best circuit I've found. It uses 14 CNOTs. Note that this circuit is not using a linear layout! It is placed on the grid like this: 0-A-1 | 3 | 2 Where 'A' is an ancilla initialized in the |0> state and '0','1','2','3' are the qubits making up the register (with '0' being the least significant bit). I verified this circuit in Quirk ...


5

These levels are provided via "preset passmanagers" in Qiskit. These are simple-to-use transpiler pipelines, but you can also build your own passmanager pipeline. You can see what each does by inspecting the documentation for those: https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/transpiler/preset_passmanagers But briefly, level 0 does no explicit ...


5

Maybe this will help. Let's take a simple case: $$f(x_1, x_2) = -2x_1 x_2$$ Then it is minimum when $x_1 = x_2 = 1$. Now let's take this Hamiltonian: $$H_f = -2Z \otimes Z$$ The Hamiltonian is minimum when we have either $|00\rangle$ or $|11\rangle$ states. So this Hamiltonian doesn't correspond to the $f(x_1, x_2)$. Instead this one looks better: $$H_f = -2 ...


4

First: The paper references [37] for Levy's Lemma, but you will find no mention of "Levy's Lemma" in [37]. You will find it called "Levy's Inequality", which is called Levy's Lemma in this, which is not cited in the paper you mention. Second: There is an easy proof that this claim is false for VQE. In quantum chemistry we optimize the parameters of a ...


4

I am not an expert but I read a few papers and here is what I have found. Similarly to NN, people found strategies to avoid this issue with the gradients. Basically, for some problems, you can use ansatzes that are inspired by the physics of the problem itself. For example, in quantum chemistry, people use something called unitary coupled clusters. See ...


4

So for hybrid quantum-classical algorithms, I suggest looking at : The Quantum Approximate Optimization Algorithm Variational hybrid quantum-classical algorithms that include the so famous Variational Quantum Eigensolver applied for Max-Cut problems PennyLane which helps you in developping hybrid computation for optimization problems and Machine Learning. ...


4

The proof of the variational theorem (the theorem that the ground state energy is the lowest possible energy you can get from $\frac{\langle \psi|H|\psi\rangle}{ \langle \psi | \psi \rangle}$) is very simple: https://en.wikipedia.org/wiki/Variational_method_(quantum_mechanics) If you get a lower energy, it means you don't actually have $\frac{\langle \psi|...


4

$\langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$ is basically the function evaluation step during the optimization. If you use a gradient-free optimizer, then it uses this information to drive its search. Depending on the optimizer if it needs them to update the parameters. You seem confused between the simulation and measurement part. $\langle ...


4

The ADMM optimizer is a classical optimizer that will be execute on the classical computer. Nowadays, because of the limitation of the hardware, we see a lot of hybrid quantum-classical algorithms. In particular, Variational algorithms. These algorithms relies on the variational principle. Hence, part of the algorithm require a classical computer doing some ...


3

If you are looking for a more complete implementation of a quantum variational algorithm in the context of Cirq, I would recommend looking at the second example in the OpenFermion-Cirq notebook found here. It uses a custom ansatz for hydrogen in a minimal basis, but makes a bit more explicit all the required pieces. Another good example, perhaps without ...


3

Here is the best construction I've found. It uses 8 CNOTs. I verified this circuit in Quirk using the channel-state duality and a known-good inverse. The target is the middle qubit. None of the CNOTs go directly from top to bottom or bottom to top. You can switch which qubit is the the target by simply switching which line the Hadamards are on.


3

I believe I've got it down to 9 controlled-not gates: What I did was I used a set of three cNots in the place of Swap to move the two controls next to each other to achieve the last part of the standard Toffoli circuit (see here). This used 12 cNots. However, the final $T$ and $H$ gates on the target qubit I propagated through one of these swaps. This let ...


3

So in your example, you try to find the quantum circuit representing the Toffoli operation. I would then change my objective/fitness function and compare the unitary matrix representing the operation. You can use an minimization objective like : $$ \mathcal{F} = 1-\frac{1}{2^n} |\operatorname{Tr}(U_aU_t^{\dagger})| $$ with $ U_a $ is the unitary of the ...


3

The Quantum Approximate Optimization Algorithm is a good place to start for analyzing the relative performance of quantum algorithms on approximation problems. One result so far is that at p=1 QAOA can theoretically achieve an approximation ratio of 0.624 for MaxCut on 3-regular graphs. This result was obtained using brute force enumeration of the different ...


3

One of the advantages, as stated in the paper you linked, is that with QAOA you can increase the precision arbitrarily, whereas QA will only find the solution with probability 1 as $T \to \infty$ which is impractical. In addition if $T$ is too long you're likely to not find the solution as the probability is not monotonic. I believe an example of this can be ...


3

I changed the stock parameter to a list of strings and added the line stockmarket = StockMarket.NASDAQ as such: num_assets = 4 # Generate expected return and covariance matrix from (random) time-series stocks = ['MSFT', 'DIS', 'NKE', 'HD'] data = WikipediaDataProvider( token="xeesvko2fu6Bt9jg-B1T", ...


3

Qiskit has an optimization module and you can find tutorials that illustrate its functionality here. To solve the example you posted, e.g., with the Quantum Approximate Optimization Algorithm (QAOA), you can do the following: from qiskit import Aer from qiskit.optimization import QuadraticProgram from qiskit.aqua.algorithms import QAOA from qiskit....


3

Thank you for your report. I investigated the details and fixed the bug with this pull request.


3

If you use infinite depth then QAOA can be consider as quantum annealer on gate-based. The authors of QAOA original paper probably deduce it from quantum annealing. What I mean by infinite depth is you take $p \to \infty$ in the operator $$U(\beta, \gamma) = \Pi_{i=1}^p U_B(\beta_i)U_C(\gamma_i) $$ Your are right about the commutation problem. However, ...


3

It can actually and this is done by adding penalties to include the constraints in the cost function. See this article on formulations of different problems. There also exist an adaptation for constrained problems. See this articla on the Quantum Alternating Operator Ansatz.


3

The Quantum Approximate Optimization Algorithm is closely related to the Quantum Adiabatic Algorithm. Let's say we have a simple Hamiltonian (in our case $H_B$) with a known ground state and another Hamiltonian $H_C$, whose ground state we want to calculate. Consider the time-dependent Hamiltonian \begin{equation} H(t) = \left(1-\frac{t}{T}\right)H_B(t) + \...


3

There are nothing practical that current quantum computers can do that has advantage over classical computers. But these machines do provide potential speed-up over certain problems like factoring through Shor's algorithm. The biggest number being successful factored through Shor's algorithm is 21. This can be seen in this paper: "Experimental study of ...


3

A precursor to the canonical QAOA is the Quantum Adiabatic Algorithm (QAA). Since we want to end up in the ground state of the Cost Hamiltonian ($H_C$) but don't know how to construct it, we exploit adiabaticity by starting with the ground state $|+\rangle^{\otimes n}$ of the (mixing) Hamiltonian $H_M = \sum_i \sigma_i^x$. Now, if we slowly change a ...


3

You can set the attribute parameters_bounds of a circuit to the desired intervals like below: from qiskit import QuantumCircuit from qiskit.circuit import Parameter a=Parameter('a') b=Parameter('b') ansatz=QuantumCircuit(2) ansatz.ry(a,0) ansatz.ry(b,1) ansatz.parameter_bounds=[[0,np.pi]]*2 Then you can run your vqe program.


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