Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [qiskit]

Quantum Software Development Kit for writing quantum computing experiments, programs, and applications. If appropriate, also use the [programming] tag.

12
votes
2answers
2k views

How can I implement an n-bit Toffoli gate?

I want to create a Toffoli gate controlled by n qubits, and implement it in QISKit. Can this be done? If so, how?
9
votes
3answers
236 views

Does conditional gate collapse controller's superposition?

I've created a simple circuit in Q-Kit to understand conditional gates and outputted states on each step: In the beginning there is clear 00 state, which is the input The first qubit is passed ...
9
votes
2answers
212 views

Composing multiple quantum circuits in single quantum program in QISKit

I was wondering if there is a way to compose a program with multiple quantum circuits without having the register reinitialized at $0$ for each circuit. Specifically, I would like run a second ...
8
votes
2answers
228 views

Qubits specification on IBMQ devices

As it is shown here, CNOT gates between different qubits have different error rates. I have the following questions: 1) While defining a circuit on QISkit, does ...
8
votes
2answers
344 views

There was an error in the circuit!. Error = 'QISkit Time Out'

I've got the following quantum code using QISKit (based on hello_quantum.py): ...
8
votes
1answer
359 views

How to delete pending jobs on IBM Quantum Computer to retrieve units?

I am trying to run some code using qiskit, but I get the error message, that I have run out of necessary Experiment Units. I ...
8
votes
1answer
148 views

Submitting jobs to IBM devices without Python

Qiskit can be used to submit jobs to IBM devices using Python (or Swift and JavaScript). But what if I want to use a different language? For example, suppose I have a specific circuit I want to run. ...
8
votes
2answers
434 views

Quantum algorithm for linear systems of equations (HHL09): Step 2 - Preparation of the initial states $|\Psi_0\rangle$ and $|b\rangle$

This is a continuation of Quantum algorithm for linear systems of equations (HHL09): Step 2 - What is $|\Psi_0\rangle$? In the paper: Quantum algorithm for linear systems of equations (Harrow, ...
8
votes
1answer
1k views

Visualization of Quantum Circuits when using IBM QISKit

I have followed the installation steps, regarding QISKit working environment. For circuit visualization, I've installed latex as in addition to poppler to convert from PDF to images. Afterwards, I ...
7
votes
1answer
298 views

Changing indices of qubits in QISKit

I was wondering if something like this is possible in QISKit: let's say we have two registers containing target and ancilla qubits: $a_0$ ------------------- $a_1$-------------------- $\vdots$ $...
7
votes
1answer
184 views

SWAP gate(s) in the $R(\lambda^{-1})$ step of the HHL circuit for $4\times 4$ systems

Context: On the 5th page of the paper Quantum circuit design for solving linear systems of equations (Cao et al, 2012) there's this circuit: Schematic: A brief schematic of what's actually ...
7
votes
1answer
210 views

One-qubit gates results in QISKit

I found it odd that the result of the action of identity gate (namely a $2\times2$ identity matrix) on a pure state $|0\rangle$ (namely the vector corresponding to the $2\times1$ matrix $\begin{...
6
votes
1answer
316 views

What are theta, phi and lambda in cu1(theta, ctl, tgt) and cu3(theta, phi, lam, ctl, tgt)? What are the rotation matrices being used?

I was reading the documentation for qiskit.QuantumCircuit and came across the functions cu1(theta, ctl, tgt) and ...
6
votes
2answers
220 views

Why do we need a Classical Register for carrying out Quantum Computations?

I've just started to mess about with QISKit on Python and one thing is confusing me a fair bit. Given that we are building Quantum Circuits what is the need for a classical register ? Is it because ...
6
votes
2answers
118 views

Construct Controlled-$G^{\dagger}$ from known Controlled-$G$

Let there be a known a scheme (quantum circuit) of Controlled-G, where unitary gate G has G$^†$ such that G≠G$^†$ and GG$^†$=I (for example S and S$^†$, T and T$^†$, V and V$^†$, but not Pauli and H ...
6
votes
1answer
269 views

How would one implement a quantum equivalent of a while loop in IBM QISkit?

I'm writing a simple multiplication algorithm that uses the Quantum Fourier Transform to repetitively add a number (the multiplicand) to itself and decrements another number (the multiplier). The ...
6
votes
1answer
94 views

Why does job.running in QISKit output False, even if the job is still running?

I submitted a job in the 0.5.0 version of QISKit using job = execute(qc, 'ibmqx5', shots=shots) This just submits the job, and does not wait for a result. I ...
5
votes
3answers
176 views

How is the Grover-Algorithm applied to a database?

Question I want to use the Grover-Algorithm to search an unsorted database for an element $x$. Now the question arises, how do I initialize index and value of the database with the qubits? Example ...
5
votes
4answers
261 views

How do I build a gate from a matrix on Qiskit?

I'm creating a gate for a project and need to test if it has the same results as the original circuit in a simulator, how do I build this gate on Qiskit? It's a 3 qubit gate, 8x8 matrix: $$ \frac{1}{...
5
votes
1answer
440 views

Phase-Shift Gate in Qiskit

How to implement the phase shift gate in qiskit or ibmq? Phase Shift Gate : $$\begin{pmatrix}e^{ia} && 0 \\ 0 && e^{ia}\end{pmatrix} = e^{ia}I$$
5
votes
1answer
133 views

What is the purpose of the TDG gate in QISKit?

The QISKIT documentation doesn't explain what a TDG gate does and I can't find it anywhere else online.
5
votes
1answer
575 views

What is Qconfig in QISKit and how do I set it up?

To use certain things in QISKIt, such as acessing the real quantum processors, it seems that there is a file 'Qconfig.py'. That needs to be set up. How do I do this?
5
votes
1answer
129 views

Status of software packages for quantum compiling

By "quantum compiling", what I mean is classical algorithms to solve the following problem: given a $SU(D)$ matrix $U$ (the goal) and a set of $SU(D)$ unitary matrices $V_1 \cdots V_N$ (the gates), ...
5
votes
2answers
201 views

Checking value of variable using quantum approach

A beginner question after watching few videos. Say, var=a; var can be either of two values, ...
5
votes
1answer
127 views

Entanglement state preparation by using amplitude values

I have an algorithm that uses QRAM, after accessing the given QRAM that store M d-dimensional classical vectors, the state of the index register and the data register become entangled. But for now I ...
5
votes
0answers
193 views

Quantum SVM Algorithm Error on import

I am experimenting with some Qiskit ACQUA AI algorithms which require the following import statement: from datasets import * However, ...
4
votes
1answer
394 views

ImportError: cannot import name 'QuantumProgram' from 'qiskit'

I get below error when I run a code on spyder environment: File C:/MYPYTHON Programs/My Quantum Programs/Shor algo.py, line 4, in from ...
4
votes
1answer
536 views

How to create an arbitrary state in QISKit for a local_qasm_simulator?

I would like to play with a quantum circuit local_qasm_simulator in QISKit, but I do not want to implement a separate quantum circuit that would prepare an initial ...
4
votes
1answer
84 views

Can I remove gates from a QuantumCircuit?

Suppose I want to implement run several circuits one after another, but they are constructed in a similar fashion. I could reinstantiate a QuantumCircuit for each ...
4
votes
1answer
101 views

How can noise on a device be simulated using measured noise parameters?

The real devices used as backends for Qiskit have calibration data that quantifies errors ($T_1$ and $T_2$, gate fidelities, etc). This can be accessed by, for example ...
4
votes
2answers
201 views

How to create a condition on only one classical bit when we have a total of 2 classic bits in the system

I am trying to make a quantum circuit with one qubit and 2 classical bits for each measurment in the system below: I want to make condition on the first bit: if the first collapse to zero so x ...
4
votes
1answer
99 views

Qiskit - How do we measure the same single qubit system multiple times while also getting the counts/results after each measurement?

I am able to apply multiple measurements (2) to the same qubit system. However, I would like to get the counts right after each measurement is executed. I realize that the counts should be the same ...
4
votes
1answer
133 views

Deprecation warnings in Qiskit (circuit drawing)

I am just starting to get around Qiskit, I'm going at baby steps, so I tried to run the code below and I noticed three things: I tried using ...
4
votes
1answer
43 views

Controlled unitary from the HHL algorithm – practical implementation using Qiskit

I have a question about the implementation of the controlled unitary $e^{iAt}$, from the paper Demonstration of a Quantum Circuit Design Methodology for Multiple Regression, using the Qiskit framework....
4
votes
1answer
109 views

Quantum algorithm for linear system of equations (HHL) - Final Step: How can I find my vector of solution $|x\rangle$?

I'm working on solving a linear system with the quantum algorithm HHL. I don't understand how I can recover my vector $|x\rangle$ of real solution of the system starting from the states measured with ...
4
votes
1answer
103 views

How to deal with -LookupError: backend “ibmqx4” is not found?

I am using Jupyter notebook to write and running my qiskit codes (python 3.6) and every time I encounter the message: LookupError: backend "ibmqx4" is not found, right now the ibmqx4 computer is not ...
4
votes
1answer
220 views

How to install qiskit in spyder editor?

I am working in Anaconda using spyder editor. Can anyone tell me how to install qiskit in spyder?
4
votes
1answer
192 views

Is there a common set of modules for user-defining-quantum-gate for QISKit

I am wondering if there exists a common library or a set of modules for user-defining-quantum-gate for QISKit. If it does, could you tell me? By referring to Define Quantum Gates and How to define ...
3
votes
2answers
173 views

Why won't Qiskit ccx gate accept registers?

In Qiskit, they have the concept of a Toffoli gate (ccx). However, the following code throws an error: ...
3
votes
2answers
92 views

Problems with qiskit-terra: missing members of instance QuantumCircuit

I have installed a Python 3.7.2, download anaconda and visual studio code. Install Qiskit SDK 0.5.3. But when I launch my first test program from https://github.com/Qiskit/qiskit-terra I received a ...
3
votes
2answers
410 views

Comparing run times on IBM Quantum Experience

I have run this program - ...
3
votes
2answers
111 views

Finding the second smallest number. Is it achievable in QC?

I have a set of numbers in a superposition state (example: 3,8,1,5) in a quantum register (of 3 qubits). So I try to find the $n^{\text{th}}$ smallest number (...
3
votes
1answer
88 views

Is it possible to create a superposition in IBMQ QISkit which has probability amplitudes $|a|\neq |b|$?

For example, we can create a single qubit state with a polar angle of $\pi/2$ with the Hadamard gate. But, can we create a state such as this, $$\Psi = \cos(\pi/8)|0\rangle + \sin(\pi/8)|1\rangle$$ ...
3
votes
2answers
137 views

Implementing gate with two parameters using Qiskit in Python

I am trying to implement the HHL algorithm (for solving $Ax=b$). I am assuming $A$ to be unitary and Hermitian so that I can find the Hamiltonian simulation for it easily. For any $A$ to be Hermitian ...
3
votes
1answer
71 views

For CNOT gate with control qubit set to 1, the measured state of the second qubit unexpectedly depends on the measurement

I have the following circuit in qiskit. It is a simple CNOT operation with the control qubit set to 1, by running the control qubit through an X-gate. However, when I measure the 2nd qubit, I get the ...
3
votes
1answer
48 views

LaTeX error when drawing circuits with Qiskit

I am currently running the following document from this Qiskit documentation. This notebook is running in Jupyter, and I started Jupyter from the Mac terminal within a Conda environment. Normally, ...
3
votes
2answers
163 views

How to fix? 'E1101:Instance of 'QuantumCircuit' has no 'h' member' and 'E1101:Instance of 'QuantumCircuit' has no 'cx' member'

I'm using this simple code to test my Qiskit and learn how to use it but it keeps giving this problems, how do I fix it (Using VS Code and Anaconda Python 3.7) ...
3
votes
1answer
53 views

Consistent QISkit error: “All devices are currently unavailable”

I am attempting to run the following on a remote backend through QISkit: ...
3
votes
1answer
132 views

Path to learn Qiskit as a tool for the future

I am an undergraduate in Engineering physics, yet to take classes on Quantum mechanics, but none (if I'm not mistaken) on quantum information and quantum algorithms, and I am curious about the subject ...
3
votes
1answer
98 views

How can I resolve the error QISkit Error: The same provider has already been registered!

I am writing a small algorithm to multiply two numbers using IBM's QISkit. The code is below: times_shell.py ...