Questions tagged [qiskit]

Qiskit is an open source SDK for working with quantum computers at the level of pulses, circuits and application modules. If appropriate, also use the [programming] tag. Please include the version of Qiskit you use when using this tag.

Filter by
Sorted by
Tagged with
30 votes
6 answers
12k 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}{...
Nillmer's user avatar
  • 715
28 votes
4 answers
11k 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?
Ali Javadi's user avatar
  • 1,612
22 votes
1 answer
9k views

What is a "barrier" in Qiskit circuits?

I just started studying IBM Qiskit, and cannot find details about the barrier method on the QuantumCircuit class. It is shown in the circuit drawing, but I never heard about it after reading quantum ...
czwang's user avatar
  • 849
17 votes
1 answer
7k views

What's meant by the depth of a quantum circuit?

I'm using Qiskit to create quantum circuits wherein I've this attribute called depth. The documentation states it is the length of the critical path here. What does ...
Van Peer's user avatar
  • 547
15 votes
4 answers
2k 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 ...
alex's user avatar
  • 151
15 votes
1 answer
11k views

How to measure in another basis

I am new to qiskit and I have to simulate a quantum circuit. I read this documentation https://qiskit.org/textbook/ch-states/single-qubit-gates.html where it is left as an exercise to the reader to ...
thedumbkid's user avatar
14 votes
3 answers
5k views

How to calculate an Expected Value of some operator acting on qubits?

I'm trying to implement the Variational Quantum Eigensolver in Qiskit. Suppose, I have an operator $A = \sigma_1^z\sigma_2^z$ acting on some two-qubit state $|\psi\rangle$. After a measurement I get ...
C-Roux's user avatar
  • 878
12 votes
1 answer
7k views

Evaluating expectation values of operators in Qiskit

I'm wondering how in Qiskit one can calculate the expectation value of an operator given as a WeightedPauli (or, at least, of a single ...
mavzolej's user avatar
  • 1,852
12 votes
4 answers
4k views

How to quickly calculate the custom U3 gate parameters $\theta, \phi$ and $\lambda$ for any unitary?

In IBM Qiskit and Quantum Experience, the custom U3 gate is defined as $$ U(\theta, \phi, \lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -e^{...
Sanchayan Dutta's user avatar
11 votes
3 answers
3k views

Big Endian vs. Little Endian in Qiskit

I've noticed that Q# favors Little Endian. Meaning that most operations are designed for this type of encoding. Is is it the same with Qiskit?
Sorin Bolos's user avatar
11 votes
1 answer
2k views

What is the relationship between Choi and Chi matrix in Qiskit?

I'm struggling with the framework for quantum process tomography on Qiskit. The final step of such a framework is running fit method of ...
Daniele Cuomo's user avatar
11 votes
2 answers
4k views

Qiskit - Z expectation value from counts?

For a given state $|\psi\rangle$, how would I work out $\langle\psi|Z|\psi\rangle$ ? If I run a quantum circuit and get the counts dictionary on qiskit, I get observables in the Z basis. For n=1 ...
Zohim Chandani's user avatar
11 votes
1 answer
539 views

Submitting jobs to IBMQ backend via HTTP API Requests

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. ...
James Wootton's user avatar
11 votes
2 answers
466 views

AWS Braket Backend for Qiskit?

Is there a working AWS Braket backend provider for Qiskit 0.29 that can be used with the MinimumEigenOptimizer interface? The qiskit-aws-braket-provider package is unfortunately not working.
Nepomuk Hirsch's user avatar
11 votes
1 answer
2k views

Is it possible to run a general implementation Shor's algorithm on a real IBM quantum computer at least for N = 15?

I need to make a general implementation of Shor's algorithm that factors, at least, N = 15. I have been able to perform an implementation that works in simulators, with ProjectQ, but when running it ...
WaSon's user avatar
  • 111
11 votes
2 answers
4k 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 ...
asdf's user avatar
  • 493
11 votes
1 answer
378 views

How many qubits would be needed to do boson sampling in Qiskit?

In December 2020, there was this claim of quantum advantage/supremacy by a team of UST China using Gaussian boson sampling. Here is the paper and here is an explanatory news article in Nature. To get ...
Mauricio's user avatar
  • 2,202
10 votes
2 answers
4k views

Is Qiskit more popular than cirq? Why?

It seems like most people are using Qiskit, what's the difference?
nighthawk30's user avatar
10 votes
1 answer
3k 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 ...
Alexey Uvarov's user avatar
10 votes
2 answers
2k 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, ...
Sanchayan Dutta's user avatar
9 votes
4 answers
9k views

What does fidelity mean?

I am learning qiskit software and this term keeps popping up and I am unable to get a grasp on the technical definition given by wikipedia. For example, the functions state fidelity and process ...
Eesh Starryn's user avatar
9 votes
5 answers
1k views

If quantum computing always return random measurement (or uncertain measurement), why do we still need it?

I am very new to quantum computing and currently studying quantum computing on my own through various resources (Youtube Qiskit, Qiskit website, book). As my mindset is still "locked" with ...
KamWoh Ng's user avatar
9 votes
1 answer
3k 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$$
Debarghya Kundu's user avatar
9 votes
2 answers
1k views

Transpilation into custom gate set in qiskit

In qiskit, I can transpile a given circuit into a some predefined gate set as follows (just an example) ...
Nikita Nemkov's user avatar
9 votes
2 answers
764 views

How to program a controlled Hadamard-Hadamard gate?

I'm trying to program a controlled gate as the figure below in Qiskit. Should it be sufficient to separate and control individually the Hadamard gates?
German Alamilla's user avatar
9 votes
2 answers
825 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 ...
Mathist's user avatar
  • 495
9 votes
1 answer
3k views

What are the differences between Qiskit's AerSimulator, QasmSimulator and StatevectorSimulator?

In Qiskit, we can see the names of available simulators with the command Aer.backends(). These include: ...
user3886914's user avatar
9 votes
1 answer
1k views

How efficient is Qiskit's unitary decomposition?

In Qiskit's extension package we have the UnitaryGate module that you can initialize using a unitary matrix and then add it to your circuit. How efficiently is this ...
Dani007's user avatar
  • 532
9 votes
2 answers
2k views

How to implement controlled multiqubit gates in qiskit?

To implement a stabilizer code I need to measure stabilizer generators, as shown in Fig. 10.16 in Nielsen & Chuang. Is there a way for controlled multiqubit gates in qiskit?
Jacey Li's user avatar
  • 585
9 votes
3 answers
820 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 ...
CodeSandwich's user avatar
9 votes
2 answers
404 views

Quantum implementation of arcsin

I am looking to implement a quantum version of the arcsinus function. Such a problem is motivated by the HHL algorithm where $x\mapsto 1/x$ and $\arcsin$ can be used to get $1/x$ from the ...
SRichoux's user avatar
  • 319
9 votes
2 answers
426 views

How to implement Projector Control-Not in Qiskit?

I want to impliment Projector Control-Not in Qiskit just like in this , which is a $|0\rangle\langle 0|$ projector found in the paper "Grand Unification of Quantum Algorithm" page 7. Also, ...
Shashi Kumar's user avatar
8 votes
3 answers
1k views

Can I find the axis of rotation for any single-qubit gate?

Suppose I have an arbitrary qiskit $U_3$ gate: $U_3(\theta,\phi,\lambda)$. Is there a way I can find which axis the gate is rotating around? In other words, given any real numbers $\theta,\phi,\lambda$...
ZR-'s user avatar
  • 2,378
8 votes
2 answers
2k views

Why doesn't Shor's algorithm output a solution for some numbers?

I've been trying to mess around with Qiskit's implementation of Shor's algorithm, and while trying I've noticed that Shor(33), for example, would not output a solution (even with an absurd number of ...
Nuno Costa's user avatar
8 votes
3 answers
3k views

Access results from an experiment without having to run the script again

I have ran an experiment in one of the IBM processors and the work has finished. However, I can not obtain the data as histograms or counts in the qiskit notebook because the experiment was concluded ...
Henao's user avatar
  • 113
8 votes
2 answers
2k 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 ...
Sanchayan Dutta's user avatar
8 votes
2 answers
477 views

Apply readout error mitigation to mid-circuit measurement

I'm trying to construct a quantum circuit with 3 mid-circuit measurements, here's an example: ...
ZR-'s user avatar
  • 2,378
8 votes
2 answers
8k views

How to get state vector from QasmSimulator in Qiskit

I'm currently able to get state vector in Qiskit using state_vector backend using something like : ...
user12910's user avatar
  • 429
8 votes
1 answer
8k 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 ...
Alexander Pozdneev's user avatar
8 votes
2 answers
849 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): ...
kenorb's user avatar
  • 662
8 votes
1 answer
1k views

What are the differences between the different transpiler optimization levels in qiskit

I am currently running a simple algorithm using Qiskit and I am running it for various transpiler optimization levels (0-3). I wish to know what exactly occurs differently when for example I run the ...
Generic_dp's user avatar
8 votes
2 answers
1k 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$ $...
brzepkowski's user avatar
  • 1,029
8 votes
2 answers
736 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 ...
Jake Xuereb's user avatar
8 votes
2 answers
522 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 ...
John Lancaster's user avatar
8 votes
1 answer
1k 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 ...
brzepkowski's user avatar
  • 1,029
8 votes
1 answer
513 views

How does measurement calibration work?

One of the possible ways to improve the results of an experiment on the IBM machine using the Qiskit language is to use the measurement calibration methods. This is the link to the documentation. I ...
Marco Ballarin's user avatar
8 votes
1 answer
636 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 ...
Sanchayan Dutta's user avatar
8 votes
1 answer
2k 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 ...
user2519's user avatar
7 votes
3 answers
2k views

Why isn't $Ry(\pi/2)$ gate equivalent to Hadamard gate?

I've been experimenting with quantum circuits and can't quite fathom how the difference between states comes together. Speaking in terms of simulations using qiskit,...
Ricardo's user avatar
  • 179
7 votes
1 answer
1k views

How good is basic_device_noise_model() simulating the noise in the quantum computer?

Is there any paper or article about the performance of the noise model using basic_device_noise_model()? For example, like the noise model in the code below. ...
Firepanda's user avatar
  • 105

1
2 3 4 5
44