# 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.

1,519 questions
Filter by
Sorted by
Tagged with
32 views

### Circuits acting on subsets of qubits in other circuits

I am trying to figure out what is the best way of dealing with registers while constructing circuits from abstract blocks. Consider the following subcircuit: U|x\rangle|y\rangle|z\...
• 1,478
102 views

### How to implement SU(2) rotation with qiskit?

Before I start, I would like to say sorry for this possibly stupid question of mine. I just recently got into the topic of quantum computing and try me there. I'm currently trying to display a SU(2) ...
• 50
1 vote
45 views

### Jordan-Wigner map for ionic molecule H_2^+

I want to derive the Hamiltonian of the ion molecule $H_2^+$ by making use of Jordan-Wigner map. Thus, I used qiskit nature. I wrote down the same command given in qiskit nature. The only difference ...
21 views

### What are the differences between discrete-time quantum walks between dimensions?

When working with quantum walks in other dimensions (1D – 2D – 3D...) do your results tend to be different from what is proposed in theory with the probability density? The results obtained in the ...
• 67
52 views

### Some of the qubits are not evaluated at Qiskit

When I implement a 3-qubit circuit in Qiskit, circuit is executed smoothly at the simulator but counts I read back as results does not contain all of the qubits that are defined and included in the ...
51 views

### T-depth in Qiskit

How to find T-depth in Qiskit? Is there any inbuilt function or some method to find T-depth? I know that the .depth() function exists which returns circuit depth (i....
• 107
75 views

### Qiskit: How to implement a classical function?

I'm quite lost, I have to implement the following function with qiskit $$f(x,y,z) = (\lnot x \land y \land z) \lor (x \land \lnot y \land z)$$ but how can we do that ? I don't understand how to do ...
• 107
88 views

### qiskit qaoa.compute_minimum_eigenvalue

I am having some trouble running the compute_minimum_eigenvalue method from qiskit's QAOA: the documentation states that one ...
75 views

### Performance metrics in QSVM

I have implemented QSVM on breast cancer dataset using link: "https://qiskit.org/documentation/stable/0.24/tutorials/machine_learning/01_qsvm_classification.html" but unable to compute other ...
• 149
41 views

### Predator–prey theory

We have a project where we are supposed to simulate the predator–prey theory in qiskit. Can anyone help or suggest of any ways to start from somewhere because we are kinda lost.
1 vote
75 views

### Conditional measurement using classical bit in qiskit

I am trying to implement Figure 6 in Implementing a distance-based classifier with a quantum interference circuit by Schuld et. al The specific part that I'm struggling with is the controlled (on |0&...
1 vote
38 views

### Qiskit: Transpile circuit with custom equivalences

I would like to automatically get a phase gate of pi/2 converted to a S gate. I have: ...
1 vote
32 views

### Converting data into a SHA256 hash using Qiskit quantum computer

I was wondering how can we convert data into a hash using Qiskit quantum computer? e.g, this code below will generate a SHA256 hash based on random data. ...
90 views

### Decomposing S gate in two T gate with qiskit

Let's suppose I define a basis gate set and the following circuit. ...
28 views

### How to set the meas_level and optimization_level in Quantum Azure IonQ provider?

I am performing a benchmark process using the Azure Quantum IonQ provider. I use Qiskit in the Azure platform, and I was trying to see how to control the transpiling and compiling process. It seems ...
• 284
1 vote
42 views

### ket statevector of a 2-quibit system

Given the following code: ...
• 181
1 vote
70 views

### Expectation value of pauli strings for VQE

I am studying VQE and have boiled it down to a matter of determining the expectation value of pauli strings: $$\langle H \rangle = \sum_i \alpha_i \langle\psi|\hat{P_i}|\psi\rangle.$$ I have been ...
77 views

### Hamiltonian & QubitMappingType cannot be imported from qiskit.chemistry.core

I'm trying to implement the same Jupyter notebook in The Variational Quantum Eigensolver — Programming on Quantum Computers — Coding with Qiskit S2E4;however,I found a problem: Error: ...
• 11
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 ...
32 views

### Validating existing QAOA, deprecated solutions on qiskit

I'm currently evaluating a static QC, QML and QAOA approach to solving a combinational problem. My solution with the static QC and QML approach is finished, and all data has been collected. Now, the ...
• 147
43 views

### IBM Q jobs being cancelled without error or explanation?

While sometimes the jobs run without any problem, and in other cases there are errors that can tell how to troubleshoot, in this case it seems there is no explanation from IBM. Has anyone had similar ...
• 475
55 views

### Qiskit gates out of order?

I'm running the following piece of code and get the following output. ...
1 vote
136 views

### ket zero $|0\rangle = [1,\, 0]$, why a qubit which is initialized with zero is 1 in first basis state?

ket zero $|0\rangle = [1,\, 0]$ The $[1,\, 0]$ is telling us that the probability amplitude for being in the first basis state is $1$, and the probability amplitude for being in the second basis state ...
• 181
57 views

### understanding QuantumCircuit.x() function

For Code 1 qc.x(0,1) throws error but not for code 2 . Please help me to understand code 1 ...
• 181
42 views

### what is difference between the following two results

If this question sounds trivial please bear with me as I am beginner in QC. Code 1 ...
• 181
48 views

### Why do we need to reverse the order of qubits in Quantum Fourier Transform? [duplicate]

Looking at Qiskit's QFT tutorial, their implementation of QFT requires you to swap the qubits at the end (Nielsen and Chuang do this too). I'm wondering why this is the case. Can we flip the gates ...
1 vote
37 views

### How to simulate $H(\theta) = B(\sin\theta S_1^x +\cos\theta S_1^z +\sin\theta S_2^x +\cos\theta S_2^z)+aS_2^zI_z$ on IBM Qiskit

I am trying to simulate this Hamiltonian on IBM Qiskit, for varying values of $\theta$: $H(\theta) = B(\sin\theta S_1^x +\cos\theta S_1^z +\sin\theta S_2^x +\cos\theta S_2^z)+aS_2^zI_z$ Where S is ...
51 views

### HHL for non power of 2 matrix

I'm trying to see how HHL does on a series of matrices coming from a linear problem I'm interested in. These matrices are always square, real, and symmteric. They are not, however, very often exactly ...
• 460
53 views

### Converting sigma model Hamiltonian into a quantum circuit

I would like to ask some specific questions about a paper I'm reading. In 1903.06577, authors are playing with the sigma model hamiltonian, and they are showing how they constructed the time evolution ...
• 101
136 views

### Qiskit compute mean expectation value

I want to calculate the mean expectation value of an PauliSumOp within qiskit after I executed a QAOA Circuit. My approach is the following: ...
1 vote
46 views

### split_dataset_to_data_and_labels in qiskit not working correctly

I am using source code of split_dataset_to_data_and_labels as I am unable to install qiskit-aqua because of error. But in that source code, "keys" is not being identified. I am using qiskit'...
1 vote
45 views

### Unable to import split_dataset_to_data_and_labels and map_label_to_class_name in qiskit

I was using command-: from qiskit.aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name but it was giving error-: ...
15 views

### Idle time or reset, efficiency comparison on Qiskit

As usual in QEC there are ancillary qubits set to the ground state. In a QEC scheme, not necessarily such a qubit is used immediately. In Qiskit framework, i think, all the qubits are initialized to ...
34 views

### Quantum Kernel Machine Learning loss function and the plot of kernel？

When I was doing quantum machine learning, after building the quantum kernel, I drew the graph of the loss function changing with the iteration function and the graph of the quantum kernel, but I ...
20 views

### Qiskit library.gaussian() does not accept parametric expression

I'm trying to build a gaussian pulse in qiskit where I keep the amplitude as a parameter but for the followig code ...
1 vote
52 views

### Can one reset a qubit to the ground state on real IBM quantum processor?

As explained here, IBM provided the possibility to reset a qubit to the ground state within the Qiskit framework. However it is not clear whether this tool is available for any backend or it works ...
1 vote
34 views

### Fail to add amplitude damping error to NoiseModel

I am reading a book named Learn Quantum Computing with Python and IBM Quantum Experience authored by Robert Loredo. When I tried to run the code on Chapter 11, I followed the instruction and wroted ...
• 11
98 views

### No module named 'qiskit.optimization' on Google Colab

I have qiskit installed in my colab runtime and can import qiskit, but I can not import anything from qiskit.optimization. Am I missing something? EDIT: It seems ...
57 views

### How to take Statevector for subsystem?

I want to calculate the 2nd Renyi entropy using the density matrix in Qiskit. To do this, I need to calculate the $Tr(\rho^2)$ for subsystem. The complete system consists of 12 qubits from which I ...
36 views

### From Hamiltonian to the Pulse Sequence

I know my Hamiltonian: I know which unitary I want to have. Suppose that I want to have this matrix from Hamiltonian: How can I find the pulse sequence to have this matrix from the Hamiltonian? What ...
• 426
65 views

### How to implement a gate that generate a uniform superposition of all permutation of element

I'm looking for a quantum circuit that permits generating a uniform superposition of all possible permutations for example if we have as input $|0123\rangle$ the output will be the uniform ...
• 41
71 views

### Qiskit: QAOAnsatz circuit with custom Hamiltonian

I am trying to implement the Quantum Approximate Optimization Ansatz by creating a parametrized subcircuit $$V (α) = e^{−iH_M α_1} e^{−iH_D b_1} ... e^{−iH_M α_n} e^{−iH_D b_n}$$ with the custom ...
• 75
25 views

### Understanding the penalty term in portfolioOptimization using qiskit

The equality constraint 1ᵀ𝑥=𝐵 is mapped to a penalty term (1ᵀ𝑥−𝐵)² which is scaled by a parameter and subtracted from the objective function Source: https://qiskit.org/documentation/finance/...
1 vote
41 views

### The statevector of three-qubit bit-flip encoding circuit for entangled state

I was trying to implement a three-qubit bit-flip code for shared entangled state. I was curious to analyze this mathematically, but the problem is I can't calculate the statevector after encoding. ...
1 vote
37 views

### Generating a random 32-byte hex integer using Qiskit

Hello I posted here yesterday about generating random 16 digits using Qiskit, and a gentle guy helped me but how about a string? How can I generate random 256 bit key in hex format in a superposition ...
1 vote
63 views

### How do I use the quantum searching algorithm to loop search through a datafile in qiskit?

I have a localhost index.html has a table contains names and address and balances etc... also there is a search bar on the home page to go through the pages, the interesting thing is, there is loooot ...
74 views

I recently learned about the mock backends or the fake backends provided by Qiskit and I was wondering, do they behave the same way IBMQ systems backends like (ibmq_brooklyn)? also, can I depend on ...
36 views

### Why does running a pulse schedule for Bell circuit give incorrect counts?

As part of another project I need to be able to run a custom pulse schedule for a bell ciruit and measure the counts. However I am having a problem where running the scheduled circuit is giving counts ...