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
12 views

How to run qiskit transpile in parallel in window?

I want to execute qiskit transpile function in parallel. My experiment environment Os is Window and Qiskit version is 0.29.1. I already asked one question here, and I also changed file configuration <...
0
votes
1answer
47 views

Expected outcome of adding two PauliOp

first of all, I would probably report this as a bug if I was confident enough in my QC abilities. As it stands, I've just started out, so I'm phrasing it as a question. From what I can tell, adding ...
0
votes
0answers
14 views

Exacting specific results in running a list of tomography circuit

I run a test on tomography of two circuits like this: ...
5
votes
1answer
53 views

Enforcing a particular layout mapping in Qiskit

I would like to ask how to set a particular layout during transpiling. I guess that the layout can be set by the initial_layout parameter in the transpiler. However,...
-1
votes
0answers
47 views

No such file or directory: '/home/jovyan [closed]

I am trying to run a QML code on the IBMQ lab. When importing my own data from my pc with os.path.abspath(rC...) I get: FileNotFoundError: [Errno 2] No such file or directory: '/home/jovyan/C:... ...
0
votes
2answers
45 views

qiskit transpile initial_layout determination

So, I am fairly new to Qiskit, and I've been following Qiskit textbook recently. In the chapter 7, where the QC lab exercises are located, in the first lab when working on the real hardware it is ...
2
votes
1answer
69 views

Qiskit's QFT not returning the expected state

I'm currently going through the lab problems for the Qiskit course here. I'm trying to finish lab set number 3 on QPE but I can't seem to get the desired output, even from the solution notebook. I'm ...
0
votes
1answer
61 views

Error when running a VQE circuit in IBMQ backends

I want to run a VQE circuit of 4 qubits for a simple Hamiltonian with Qiskit. The circuit run smoothly in simulators. However, when I try to implement it on real IBM' quantum computers it gives me the ...
1
vote
0answers
32 views

Callback in VQC does not return correct float value for objective function evaluation

The callback for the VQC class is defined as: callback (Optional[Callable[[ndarray, float], None]]) – a reference to a user’s callback function that has two ...
3
votes
1answer
65 views

How is quantum transpilation scaled?

While thinking about a quantum transpiler's working I had a pretty basic doubt. Say that we are trying to transpile an $n$ qubit circuit where $n > 100$. What transpiler does is that it first tries ...
1
vote
1answer
36 views

Can I use `job_manager` to get memories for 3 parts of the experiment?

Here's part of the code I'm working on: ...
1
vote
0answers
23 views

What is the input for the interpret of Quantum Variational Regressors?

I'm trying to implement my first variational regressor using qiskit. I would like to understand how the interpret of a CircuitQNN works. I need to define an interpret that works on the amplitudes of a ...
1
vote
1answer
48 views

Qiskit: How did they use Haar measure in random_statevector?

I have read this article to understand sampling state vectors from Haar measure: Understanding the Haar Measure. Qiskit uses Haar measure to sample state vectors, but when I looked at the source code ...
2
votes
1answer
62 views

What is difference between qasm_simulator and ibmq_qasm_simulator?

There are many ways how to simulate a quantum circuit on IBM Q. However, in partiuclar I am interested in a difference between qasm_simulator and ...
1
vote
0answers
20 views

Generate certain depth Clifford random circuit by qiskit

To obtain knowledge about the pattern of errors occur in quantum circuits, random Clifford circuits are a good paradigm to use in that these kind of circuits can be efficiently simulated by a ...
1
vote
1answer
46 views

Passing arrays to operations/functions in Q# Jupyter Notebooks

In order to pass inputs to Q# operations/functions with Jupyter Notebooks, one uses the magic command, %simulate, and writes out the inputs as key-value pairs, <...
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
49 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
39 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
432 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
41 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
35 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
60 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
25 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
39 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
37 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
74 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
28 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
53 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
108 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
50 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
92 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
155 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
55 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 ...
1
vote
0answers
40 views

Source code for Hybrid-HHL algorithm

How can I get a source code from this paper Hybrid quantum linear equation algorithm and its experimental test on IBM Quantum Experience? I want to implement this algorithm but I do not know how does ...
6
votes
0answers
60 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
96 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
64 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
81 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
34 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
69 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
117 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
59 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
38 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
174 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
64 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 ...

1
2 3 4 5
23