Questions tagged [programming]

For any questions whose answer is expected to require code or programming notions. For questions about a specific framework (e.g. qiskit or cirq) please also include a more specific tag.

149 questions
Filter by
Sorted by
Tagged with
342 views

How many shots should one take to get a reliable estimate in a quantum program?

When testing my quantum programs, I wonder how many shots I must take to get a specific accuracy. Are there any papers that you can recommend that analyze this?
682 views

298 views

How to repeat circuit efficiently and reliably in IBM Qiskit?

I'm having a problem in IBM Qiskit with my qubit identities switching places during transpilation. I've been told by developers on the Qiskit slack server that there's currently no built-in way to fix ...
610 views

Implementing a complex circuit for a Szegedy quantum walk in qiskit

Problem definition I'm implementing a quantum circuit in qiskit for a Szegedy quantum walk, (reference, Fig 21.). It uses two registers of dimension $N$ ($N=3$) each one. The challenges I'm facing are:...
309 views

Calculating the ground states of an Ising Hamiltonian on a real quantum computer

I have followed this tutorial and based on it, I've written the following function in qiskit, which can explicitly calculate the ground states of a transverse-field Ising Hamiltonian. ...
114 views

Simulating flag qubits and conditional branches using Stim

In a quantum error correcting code using flag qubits, it's common to have flag measurements that tell you it's necessary to do some extra measurements for safety. So, for example, I want to say: ...
430 views

How to find a common eigenstate of commuting operators?

I have multiple different operators in matrix form and I need to find their common eigenstates. The challenge is that the common eigenstate is in a superposition of multiple states and isn't just a ...
314 views

Preparing Bell state $(1/\sqrt{2}) (|01\rangle + |10\rangle)$ in Qiskit

I'm working through the Qiskit textbook right now, and wanted to complete part 1 of exercise 3.4, which asks me to use qiskit to produce the Bell state: $$\frac{|01\rangle + |10\rangle}{\sqrt{2}}$$ ...
815 views

Import from qiskit-aqua error

I try to use Quantum SVM kernel algorithm: multiclass classifier extension. This is my code section with imports ...
589 views

What is the difference between Qiskit execute and the IBMQJobManager?

I was researching how to submit multiple pulse schedules/circuits in the same job and came across 2 methods: Executing Experiments with qiskit.execute and ...
209 views

Qiskit installation

I'm trying to get started with Qiskit but the installation process has been horrendous and the official instructions are unusable. The latest python doesnt work with the install instructions at: https:...
711 views

How can I create an arbitrary superposition state of two qubits in Qiskit?

I am trying to produce any arbitrary superposition state of two qubits, for example $a|00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$, such that $a^2 + b^2 + c^2 + d^2 = 1$ . How can I do that ...
77 views

How can I print out the probability of a certain state in histogram?

This is a simulation I did in my program. I'm hoping to print out the probability of the state $|0001\rangle$ (which is $0.052$), and store this number in a letter (a). How can I do this? Thanks!!
92 views

How do Hadamard and CNOT gates work on Qiskit SDK? Why is the output reversed?

Here is the code that I have been using on IBM Q Experience (should be the latest version of Qiskit). From my understanding it seems like the outputs of Hadamard and CNOT gates are reversed in a 2-...
104 views

What is the convention of indices for the one and two-body integrals in qiskit

I was able to calculate the one and two-body integrals for the H2 with the following code ...
96 views

How to use Initial States in Qiskits QAOA?

The class QAOA from qiskit: https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.QAOA.html has the parameter initial_state from the type InitialState. https://qiskit.org/documentation/apidoc/...
159 views

qiskit: IQFT acting on subsystem of reversed-ordered qubits state

I have a state psi as an ndarray of shape (2 ** 3,) s.t. psi[0]= amplitude of 000 ...
149 views

Is it possible to implement c_if statement based on a measurement in a single specified classical bit in qiskit?

I'm trying to write a 1-bit teleportation error correction code and there is one part in it where I need to add a gate that's dependent on a measurement from earlier in the circuit. The measurement ...
102 views

Why is local qasm simulation taking so long for VQE?

I've successfully run the $LiH$ VQE simulation detailed in Simulating Molecules using VQE using the statevector_simulator, however when attempting to run the same ...
261 views

88 views

202 views

Can I access device specifications of IBMQ paying devices?

I need to perform some tests for my thesis in real quantum computers, however, I only have access to IBM's free quantum devices (the maximum number of qubits I can use is 15, in ...
92 views

Why "job_manager" did not submit some of the jobs?

I tried to submit around 2000 circuits with "job_manager", and it turns out that some jobs are not submitted. Please see the code and error message below. I understand that we can submit max ...