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.

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

What is an example of numbers that when used for a Gaussian pulse, would result in a rotation about the x axis?

For the playing of a Gaussian pulse, what is an example of numbers that could be plugged in for duration, amp, and sigma that would result in the pulse rotating something about the x axis? Here is the ...
1
vote
1answer
51 views

Get the probability amplitudes of the 0 and 1 states of a single qubit in Qiskit considering a system of multiple qubits

I am looking for a method to get the values of $\alpha$ and $\beta$ probability amplitudes of each single qubit in a multiple qubit system. Is that possible? As you can see in the image, I have a 4-...
1
vote
1answer
99 views

Return only the measurements of a circuit

I have written the following program in jupyter: ...
2
votes
0answers
42 views

Does anyone know how to use TF Quantum with real hardware data?

I'm currently trying to embed a tensorflow model for denoising measurements as a tensorflow quantum model, and at some point I'd like for this to be able to run on hardware. After reading through all ...
2
votes
3answers
439 views

Are these two circuits equivalent in performing controlled time-evolution?

I want to perform the controlled time-evolution of some 2 or 3-qubit Hamiltonian. Say we have this example: $$ H= Z_0\otimes Z_1 + Z_1\otimes Z_2 $$ The circuit performing the time-evolution ...
0
votes
1answer
46 views

Pad get_counts() with zeros for unmeasured states? (Qiskit)

After executing a job on qiskit, the typically procedure to get the measurement data from the quantum computer is to call get_counts() like so... ...
0
votes
0answers
52 views

Import error to do with tweedledum

I am on MacOS 10.14.6. Installed Python3.9, create env with venv and installed qiskit. When I import qiskit, I get the ImportError, see below: ...
1
vote
1answer
65 views

What would be the procedure if I wish to code entanglement swapping?

Most of the methods that I have seen in various papers all take single examples and then proceed to manually perform swapping by re-writing the states on a different basis and then performing a ...
0
votes
1answer
29 views

How to get information about 'qubit location' or 'variable of qubit location' in qiskit docs?

I have something problem with using qiskit. I searched several qiskit docs to get 'qubit location' or 'variables' that represent qubit. I searched three documents below. ...
0
votes
1answer
41 views

How to execute a qiskit circuit from strangeworks hub? [closed]

I would like to execute a circuit in the strangeworks hub on IBM's "ibm_nairobi" system. Could someone just please send me a general layout of execute and provide a command for stangeworks ...
1
vote
1answer
47 views

Q# install issue

I have followed the instructions to install Q# using conda as recommended, and given by MS. When I try to import qsharp from my virtual env within a Python program, ...
2
votes
3answers
114 views

Saving statevector on more than one location in a quantum circuit in Qiskit

So, I'm fairly new to Qiskit, and I've been playing around and following the tutorials from the Qiskit textbook. However, there is one thing I fail to understand/implement: for a quantum circuit with ...
0
votes
0answers
29 views

Quantum check sample implementation

I've been trying to figure out how to create a simple circuit in Qiskit to create a check (cheque ) generation and verification as described in this paper. I started with 3 qubits, first one with the ...
2
votes
0answers
56 views

How can I add custom pulse gate to the Qiskit circuit?

I tried to make my pulse and get the pulse into the circuit. But it seems not working properly. The code and the result are below. Just change the 'x' to the 'h' (hadamard) with the same piecewise ...
1
vote
1answer
110 views

How to design Multi qubit Controlled Z rotations

I need some help in multi-qubit controlled -Z rotation. Below is the qiskit code of triple controlled z rotation ...
1
vote
0answers
53 views

How do I find the qubit trajectory on the Bloch sphere when implementing an RY rotation on an IBM backend?

Suppose I use Qiskit to prepare the $| + \rangle$ state using a RY rotation, ...
2
votes
1answer
99 views

HHL - the result is correct for one matrix but wrong for another one

I tried to run HHL algorithm in new version of Qiskit (0.29). Firstly I tried to solve a diagonal system 4x4 with matrix [[1,0,0,0],[0,2,0,0],[0,0,3,0],[0,0,0,4]] ...
4
votes
2answers
189 views

Cannot get a provider from IBMQ

My code is: from qiskit import IBMQ IBMQ.load_account() provider = IBMQ.get_provider('ibm-q') qcomp = provider.get_backend('ibmq_16_melbourne') but ...
1
vote
1answer
69 views

Simulating OpenQASM 2.0 in Qiskit?

I'm just getting started with OpenQASM, but I'm feeling a bit confused. Is there a way to run the .qasm file I've written in Qiskit (i.e. in Python), or is OpenQasm ...
6
votes
0answers
76 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.
1
vote
1answer
101 views

Does anyone have some references on EigenGate used in Google's cirq framework?

I am trying to understand the code below but can not find any references other than the code itself. https://github.com/quantumlib/Cirq/blob/v0.11.1/cirq-core/cirq/ops/eigen_gate.py I am not clear ...
1
vote
1answer
70 views

Can I extract information from a single shot efficiently?

I'm running a quantum simulation and want to obtain some information from a single shot of an experiment. Here's part of the code I'm working on: ...
1
vote
1answer
86 views

QAOA Optimization

I want to use historical data for 5 stocks from YahooFinance and then calculate mean vector and covariance matrice, so I can optimize them with QAOA. Anyone know what is wrong with this code:
0
votes
0answers
37 views
0
votes
1answer
37 views

Initialization time for StatevectorSimulator Qiskit

I have a question about initializing a quantum circuit to a custom state using Qiskit's StatevectorSimulator(). My naive understanding is that eventually, the ...
2
votes
1answer
79 views

Python shorthand for tensor product (Kronecker product)

When using numpy or tensorflow in Python, we can simply write C = A @ B for matrix ...
2
votes
2answers
130 views

IBM Quantum: Are ibmq_5_yorktown and ibmqx2 different devices?

When I run provider.backends(), ibmqx2 is listed as an available backend, but is not listed on the IBMQ systems page. This file ...
1
vote
1answer
50 views

Define customized excitation for the unitary coupled-cluster (UCC) algorithm in qiskit

I encountered the issue that when defining my customized excitation list in the UCC algorithm, there was only one parameter. How to fix this so that the algorithm assign one parameter for each ...
2
votes
1answer
74 views

Keep receiving Error - AttributeError: 'QuantumCircuit' object has no attribute 'save_statevector'

I am attempting to code a feed-forward simulation of a QECC in Qiskit. Qiskit (to my knowledge) does not directly support feed-forward simulation, so I attempted a work-around. I call the simulator ...
1
vote
0answers
44 views

Defining native gate dictionary in pyGSTi

In pyGSTi in order to construct Randomized Benchmarking circuits, we first need to define a pspec object that contains information about the number of qubits, basis ...
4
votes
3answers
179 views

Software tools to train quantum circuits with parameters

I want to play with the following problem. Given a unitary $U$ with parameters $\theta$ I want to optimize these parameters to make $U$ match some target unitary $V$, i.e. to find $\operatorname{...
2
votes
1answer
84 views

Encoding Numeric data as a quantum circuit in TFQ

I am working on a dataset where I have 6 input features that are numbers in the range of 1 - 1000 that need to be encoded as a quantum circuit. I am using TensorFlow Quantum for my research. While I ...
2
votes
0answers
82 views

Applying projectors with mid-circuit measurements

I am trying to apply a non-unitary projector (see image) to my two-qubit quantum circuit using mid-circuit measurements. $$ \begin{pmatrix} 0 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 &...
4
votes
1answer
76 views

Measure $\langle \hat{X}\rangle$ and $\langle \hat{Y}\rangle$ from counts

I'm confused about how I can measure $\langle \hat{X}\rangle$ and $\langle \hat{Y}\rangle$ using counts. Here's my code for X: x-basis: ...
0
votes
1answer
36 views

Apply a custom gate to qubits in separate quantum registers

Let there be a custom gate (simply called gate that takes $N$ qubits as input. Also, let $A$ of those qubits be in first_register...
0
votes
1answer
47 views

Cirq QAOA Tasks returns "iteration over a 0-d array" error

I'm trying to understand how to use Recirq for QAOA, and I tried to run the notebook for tasks: https://quantumai.google/cirq/experiments/qaoa/tasks. But it gives a "iteration over a 0-d array&...
1
vote
1answer
29 views

Print runtime of an optimizer

I want to find the runtime of my program, i.e. the time it is in the quantum computer without queue time. However, I am using an optimizer so the code is a little different. ...
2
votes
2answers
477 views

Is it true that the way we must program Quantum Computers is through Total functions only, if so why?

I have read that the way we must program Quantum Computers is through Total functions only. Why is this the case? Is it because quantum circuits are less forgiving in terms of logical errors? Could ...
0
votes
1answer
31 views

How to use backend.run() with a constant pulse shape in order to get the results of a measurement?

I have formed a constant pulse and then I ran a measurement on the pulse. Now, I want to run a job to access the results of the measurement. Attached is a picture of the pulse and measurement. Now, at ...
0
votes
1answer
39 views

How to re-order logical qubit location into desired state?

Now, I'm studying about qubit mapping. When the mapping is done, the logical qubit will be randomly mapped to physical qubit. But I want to move the logical qubit location into desired state. For ...
1
vote
1answer
44 views

Integer factorization using Shor's Alorithm

I have question about Shor's algorithm, from I know it's for factorize an integer and can factorize big number with ease. I using Qiskit to try make a simple factorization program (with local ...
1
vote
0answers
40 views

Transform Fermionic operators to quantum circuit in qiskit

I am trying to realize a modified version of the UCCSD algorithm, which consists of combining multiple fermionic opeators to form a unitary tranformation U to act ...
1
vote
1answer
36 views

How to re-ordering physical qubit location into desired one?

Suppose original quantum circuit have 4 qubits and some quantum operation. Also suppose the result of original quantum circuit state is '1100'. Then apply qubit mapping then mapping state is like ...
2
votes
2answers
87 views

How to Implement a noisy identity gate on qiskit?

I can successfully implement the U gate (single qubit) on qiskit, but when I am trying for the identity operation it is not showing any differences with the ideal one .
1
vote
1answer
36 views

Matplotlib graphs are being duplicated each time

Simple UI question. I have installed qiskit according to the instruction and try to implement some basic operations. I have the issue that anything I plot appears twice. I am not sure why this is ...
-5
votes
2answers
47 views

How does one even get started in Quantum Computing, specifically building qApps? [closed]

I want to build a quantum application, qApp if you will; how does one go about figuring out the right use-case and best framework to turn to, to start building these things? Quantum REPL? How do I ...
1
vote
1answer
42 views

Job ids retrieval from ID. Big set of jobs

I'm in the need of running a lot of jobs in the IBM backends. If one likes to run in parallel two jobs (say, with two different parameters), I have seen in the Jobs ...
1
vote
1answer
43 views

Pack Header Error when using QAOAProgram [closed]

I want to use QAOAProgram from Qiskit in the following way: ...
0
votes
0answers
21 views

How would you measure an X gate with qiskit.pulse.builder.measure?

I am using this link: https://qiskit.org/documentation/stubs/qiskit.pulse.builder.measure.html for reference. How would you use the measure command in order for an X gate to be measured within the ...

1
2
3 4 5
23