New answers tagged

0

As a general comment Aqua has function at different levels, algorithms such as VQE, QPE, HHL etc, pluggable components that were designed to be replaceable 'parts' of algorithms such as Variational Forms, Optimizers, Uncertainty models etc, and then there are circuits which can be used to build any of the above. When it comes to Phase Estimation it's a ...


0

I believe this tutorial takes you through how to find eigenvectors. They use EigsQPE, through a helper function they define themselves, called create_eigs().


0

qiskit-aqua is the github repo in the link above. Chemistry is in the qiskit-aqua repo under qiskit.chemistry so from qiskit.chemistry.components.variational_forms import UCCSD


3

The chemistry sample in the README on the qiskit-aqua repo shows how to do this now: from qiskit.chemistry import FermionicOperator from qiskit.chemistry.drivers import PySCFDriver, UnitsType from qiskit.aqua.operators import Z2Symmetries # Use PySCF, a classical computational chemistry software # package, to compute the one-body and two-body integrals in #...


1

No, it wasn't removed, it's here: https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/chemistry/components/variational_forms/uccsd.py


2

Maybe this paper can help you, that's what the implementation in Qiskit is based on. Otherwise looking at the implementation of Shor's algorithm in Qiskit itself might be insightful. The circuit for the algorithm is constructed in the method construct_circuit and can be visualized with this snippet. from qiskit.aqua.algorithms import Shor a, N = 2, 3 ...


1

It seems that docplex class also was moved to from qiskit.optimization.ising import docplex


1

You can simply control $X$ gates with qubits $q3$ and $q4$. You DO NOT have to measure them firstly and then use classical bits for controlling. The reason is that in quantum computing, controling some qubit with other qubits or with their measured results in classical register is the same. Hence, you can implement the algorithm on real quantum computer.


2

I don't think that this will be possible on real current quantum hardware. An alternative would be to run it on a simulator with a realistic noise model. This means that the circuit will be run in a non-ideal environment, and so should incur errors similar to how it would if it was executed on a real device. This tutorial teaches you how to build a noise ...


1

AFAIK, this is impossible on IBM's current hardware. See this github issue: https://github.com/Qiskit/qiskit-textbook/issues/119


3

This can be done using the statevector_simulator provided with Qiskit Aer. It will return the statevector that describes the quantum state at the end of your circuit. It can be used in the same way as the qasm_simulator, only your circuit shouldn't have measurement gates at the end. There is more information about this simulator in this tutorial.


5

The %qiskit_backend_overview magic is not deprecated and has seen updates for the most recent 0.11.0 release: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/tools/jupyter/backend_overview.py to ensure it works with new devices. The ZeroDivisionError might point to a bug in the code for the function or in your calling code, without a full traceback ...


2

A brute force solution :). You can also obtain CCH via qiskit's basic gates with help of get_controlled_circuit method. from qiskit import * from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit q_reg = QuantumRegister(3, 'q') qc_h = QuantumCircuit(q_reg) qc_ch = QuantumCircuit(q_reg) qc_cch = QuantumCircuit(q_reg) qc_h.h(q_reg[0]) ...


4

Assuming you've got Toffoli and single-qubit rotations, you can implement the following: This basically works because if either of the controls is not $|1\rangle$, the Toffoli does nothing and the two single-qubit unitaries cancel each other. Whereas, if both controls are $|1\rangle$, then the net gate on the target qubit is $$ (\cos\frac{\pi}{8}I+i\sin\...


1

3 things I see from your implementation of inverse QFT: SWAP gates are missing prior to applying Hadamard gates and cu1 gates. The Hadamard gate should come first before cu1 gates. The angles of cu1 gates, how I understand inverse QFT, should be different. Here is inverse QFT that worked for me with not touching other parts of the code: def qft_dagger(...


0

I just copied and pasted your code above, and that is the output I get from the print() statement. What version of qiskit do you have? from qiskit import qiskit_version print(qiskit_version)


0

What does the print(qc.qasm()) yield for you? Here is what I get: OPENQASM 2.0; include "qelib1.inc"; qreg q2[2]; Controlled-Evolution^1 q2[0],q2[1];


0

It seems that this is not a problem/bug. In case the global phase gate $P$ is applied in non-controlled form, final matrix for two qubits ($P$ is acting on second qubit) is \begin{equation} I \otimes P = \begin{pmatrix} P & O \\ O & P \\ \end{pmatrix} =\mathrm{e}^{i\phi}I \end{equation} So, $P$ acts as global phase gate and the phase $\mathrm{e}^{i\...


0

You should put measurement after all quantum gates. According to the theory, there is no difference whether gates (in this case CNOTs) are controlled by qubits or classical bits. I encountered the same problem, see solution here.


1

The error is caused by appending gates onto qubits following a measurement. On qubit 1 and qubit 0, you attach a cx gate after a measurementhas already been placed. This will compile on the simulator, but it is not something that is supported on the real hardware.


3

AFAIK, what you want can't be run on the hardware right now. See this github issue. However, you can do this in the simulators. If, for example, c[0] and c[1] make up a two-bit classical register c, you can do this: qc.x(q[0]).c_if(c,3) qc.x(q[1]).c_if(c,3)


2

This is just a warning to let you know that the API has changed for the backend configurations such as PulseBackendConfiguration. The dt (qubit drive channel timestep) and dtm (measurement drive channel timestep) parameters were previously specified in nanoseconds, but they are now specified in seconds. If you're not doing anything so advanced as to directly ...


5

Using PyCall it is possible to use arbitrary Python packages (such as Qiskit) in Julia and use the Python functions. At least, this is what PyCall advertises to be able. What you describe has been done before: here is an example on GitHub. Essentially, you would need to do this (I haven't tried this out myself): using PyCall qiskit = pyimport("qiskit") ...


Top 50 recent answers are included