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
2
votes
0answers
29 views

How to return phase angles as seen in IBMQ composer using qiskit?

I recently transitioned from using the IBMQ composer and am using qiskit in the IBM lab. To start, I wanted to learn how to reproduce the computational basis states, probabilities and phase angles as ...
1
vote
1answer
32 views

queueinfo() module in Qiskit

I want to know how to use queueinfo() module in IBM Qiskit. When I type job.QueueInfo(), it says "QueueInfo" is not defined. How to import it? I'm trying to use queueinfo() to know the time ...
1
vote
0answers
13 views

Openfermion state transformation from Bravyi-Kitaev basis to occupation number

I'm working in the Bravyi-Kitaev basis implemented by the openfermion.bravyi_kitaev() function to find the ground state of a fermionic operator in the BK ...
2
votes
1answer
56 views

What is the difference between Qiskit Terra, Aer, Ignis and Aqua?

I am going through the Qiskit tutorials and they have an article on each of the above 4. however, As a beginner, I am not very clear. Could anyone share some insights on these?
2
votes
1answer
35 views

How can I add readout error in constructing a quantum noise model?

I'm trying to construct a quantum noise model with readout error only: qiskit.providers.aer.noise.NoiseModel.add_readout_error. However, when I try to specify the ...
1
vote
0answers
13 views

Is there any software package tracking Pauli errors in stabilizing circuits with GUI?

I want to track the Pauli errors propagating in stabilizer circuits like surface code. I wonder whether there is any developed package that can do this elegantly. It will be better if it has GUI that ...
0
votes
0answers
42 views

AttributeError: 'UCC' object has no attribute 'set_max_evals_grouped' [closed]

I'm trying to run the VQE algorithm using an Aer backend simulator. However, whenever I run the algorithm I Receive this error: "AttributeError: 'UCC' object has no attribute '...
2
votes
1answer
84 views

VQE from scratch, what have I got wrong?

I've been working on a code to run VQE with a grouped measurement. For some reason, my expectation values are slightly off from those computed by pennylane, the software I decided to use for this ...
2
votes
1answer
51 views

Qiskit - Simpler way to create a Hamiltonian

I am looking for an efficient way to create a Hamiltonian in Qiskit. Following are my desired input and outputs input: 'ZZI' output: Z^Z^I, where Z and I are operators. Here is how I am doing it ...
1
vote
1answer
42 views

Tweak the parameter `p` of QAOA in qiskit

I am solving a QUBO using QAOA. It works flawlessly with default parameters for smaller instances of the problem, but my RAM is saturated when I try to solve a problem of size 15. I suspect this can ...
2
votes
1answer
33 views

Stim: is it possible to add comments when creating a circuit?

I'm trying to create a Stim.Circuit, given a list of qubits and operations on them. Does the API support adding comments to the circuit's string representation? I've tried using ...
2
votes
1answer
72 views

Reading a classical register in OPENQASM

The IBM OpenQASM program below clones a state selected from an orthogonal pair. It seems to work but there is a mystery. I declare the classical register as an array c[1] but when I try to test its ...
1
vote
1answer
31 views

Binary classification using a very simple Neural Net with Qiskit and Pennylane

I implemented a simple Neural Net with Pennylane and Qiskit for classifying two half moons: notebook for two half moons (GitHub). It works somehow (not overwhelmingly by any means): I tried running ...
1
vote
1answer
50 views

QUBO defined in Qiskit/DOcplex: how to solve it using Pennylane?

I have a complex Integer Linear Programming model defined in DOcplex/Qiskit representing a combinatorial optimization problem. Using the Qiskit utils, it is possible to covert it to either an Ising ...
1
vote
1answer
27 views

Simulating readout errors on aer simulator

I'm trying to simulate quantum experiments using a customized noise model. Here's my code: ...
0
votes
0answers
14 views

Qiskit- Building an oracle to test on Qiskit's Grover

I want to build an oracle with multiple state solutions. For example: For n=4 qubits, I want the state solutions to be 1111, 1101, 1110 and 1100. So, as you can see, in all solutions, there are two ...
1
vote
0answers
19 views

Plots of the result for the qiskit HHL tutorial

Could anyone make explicit the code which gives the two plots at the end of the HHL tutorial. They show the results of the jobs on a real IBM quantum device.
2
votes
0answers
41 views

Getting the density matrix of a noisy state in Qiskit

Currently, it seems that qiskit can only compute the density matrix for a pure state. On the other hand, for noisy state, the known way to deal with it is to do sampling, which can induce great cost. ...
0
votes
0answers
24 views

Using opflow, CircuitStateFn and CircuitSampler, is there any way to submit the expectation values for multiple, distinct states in the same IBMQ job

I am trying to find the expectation of a Hamiltonian w.r.t different states. I am creating my states using CircuitStateFn. Then, I am using ListOp() of CircuitStateFn. But this is giving me an error - ...
0
votes
2answers
57 views

How to multiply two vectors (kets) in qiskit?

Hi does anyone know how i could write a program to get the product of something like |1>|0>|0>?
1
vote
0answers
42 views

Ground state compute issue by qiskit

I use the following code to calculate the ground state for the LiH molecule in an active space. I come across two problems. The first is I found that the Hartree Fock state gave energy that is far ...
0
votes
0answers
25 views

Measuring with a certain probability in Qiskit

I have the following quantum operation on two qubits: $$ \mathcal{E}(\rho) = p \mathcal{T} \circ \mathcal{U}(\rho) + (1-p) \mathcal{U}(\rho) ​$$ where $p$ is some probability, $\mathcal{U}$ is some ...
3
votes
0answers
29 views

Is it possible to construct a QuantumCircuit object which only shows the 5 qubits and the classical bit where I store the measurement outcome?

I have a 5-qubit circuit on Qiskit, which applies some unitary. Then I have a second circuit which basically measures whether all the qubits are 1, and it does so through a 5-CNOT on an ancilla qubit, ...
2
votes
1answer
48 views

is there such things as Quantum Operating system?

Wikipedia informed me about quite a lot of language that exist for quantum computing, with diverse low or high level language, but I don't know about specific operating system made for specific ...
1
vote
2answers
43 views

Create your own n-qubit quantum gate in Qiskit

I need to create the 2-qubit gates that are not supported by Qiskit (Ex: Controlled - F gate). Is there any way to create a class/object and use it as other basic gates? Example: ...
2
votes
0answers
32 views

How to convert code from QISKIT to QuEST using QASM

I have been working on this project which requires a lot of qubits. Originally we have made the whole project in QISKIT as we have been using it for a long time. But the maximum number of qubits that ...
0
votes
1answer
67 views

Is there a quantum circuit builder package that allows you to import/export a circuit as a JSON?

I've done a superficial search in each of the qiskit, cirq, and braket open source repositories for such a feature, but can't find any explicit examples of this functionality. I'm wondering if anyone ...
1
vote
2answers
38 views

Qiskit's PauliTrotterEvolution yields weird gates

I am trying to work with Qiskit's PauliTrotterEvolution() module, but the resulting circuits contain weird gates that I know nothing about. Here is a simple example: I want to implement the fermionic ...
2
votes
2answers
63 views

How can I initialize a state like, $|00\rangle$ or $|01\rangle$ or $|10\rangle$ or $|11\rangle$ in Qiskit?

Many thanks in advance for your help. I am a beginner in Qiskit. I want to implement a circuit that uses the position of an element/item, of the form (x,y) and I would like to represent it as a state $...
2
votes
0answers
15 views

Any simulator packages for quantum annealing/adiabatic quantum computation?

Are there any simulator packages for quantum annealing/adiabatic quantum computation, like Qiskit Aer but for quantum annealing? There seems to be only classical heuristics in D-Wave Ocean package, ...
0
votes
0answers
30 views

Problems when computing the two-electron reduced density matrix (2-RDM) by qiskit

The definition of a 2-RDM is $D_{ijkl}=\langle\psi|a_i^{\dagger}a_j^{\dagger}a_k a_l|\psi\rangle,i,,j,k,l\in[0,N-1]$, where $N$ is the number of qubits/ orbitals in the quantum system.I am trying to ...
0
votes
0answers
47 views

Correct implementation of Qiksit QAOA

I've been dealing with a QAOA implementation of a QUBO problem. In order to do this, I converted my QUBO matrix to a QuadraticModel. Once done, I have used ...
1
vote
1answer
30 views

QASM Files on Jupyter Notebook

Is it possible to run qasm files on jupyter notebook (like with the qasm_simulator)? I downloaded one code file and I would like to play around with it on jupyter notebook.
1
vote
1answer
46 views

How to select the statevetor of a qubit in a multiqubit circuit in qiskit?

I need to use and plot the state of the first qubit in my multiqubit circuit, but the issue is that I need to use post selection - I want only the results of which the other qubits in the circuit are ...
1
vote
0answers
35 views

How can I get the results from simulating noise models?

I'm trying to run some simulations of my quantum circuits using qasm simulator. I first tried to import the noise data from a quantum device and then use that information on qasm. Here's part of my ...
2
votes
1answer
37 views

Measurement bitstrings to detection event bitstrings in stim

Does Stim have exposed functionality for converting a measurement outcome string into a detection event string? I.e. I feed stim a string of 0,1's corresponding to measurements in a circuit along with ...
2
votes
1answer
63 views

How to create known quantum state in Qiskit (or any other platform) comprising of two or more bits?

Is there there any way to create a known quantum state in Qiskit (or any other platform) comprising of two or more than two bit? For example if I want to create $\frac{1}{\sqrt{3}}[|00\rangle+|01\...
1
vote
0answers
32 views

Solving Particle in Box problem using Qiskit

I am new to quantum computing, I would like to ask how can I solve simple particle in box problem using qiskit which allows to compute the bound states in finite quantum well. Finite quantum well
1
vote
1answer
57 views

Difference between Aer.get_backend('aer_simulator') and AerSimulator()

In Qiskit, there are several ways to choose simulator: one is from qiskit import Aer backend = Aer.get_backend('aer_simulator') result = backend.run(circ).result() ...
0
votes
0answers
28 views

How to perform multi-class classification with qiskit's VQC?

I am following the tutorial given in qiskit's website Neural Network Classifier and Regressor. In the first part, classification, the third section refers to qiskit's VQC library. Everything works ...
3
votes
1answer
61 views

How can I run a VQE on one of IBMQ's Quantum Computers

I have implemented a VQE based on Qiskit's VQE function and want to run that on an actual quantum computer. My understanding was, that an IBMQ backend can be passed into the function as a Quantum ...
1
vote
1answer
30 views

How to add label to custom operator (from matrix) controlled gate?

So here is what I'm trying to accomplish: I have made a gate out of a matrix, with a control: ...
3
votes
1answer
369 views

What is the meaning of "shots" and "rounds" in Stim?

I'm running simulations using Stim to get logical error rate vs. physical error rates of some quantum error correcting codes (QECC). I looked into the documentation, but I'm confused about the meaning ...
0
votes
0answers
32 views

How does one get the right counts for the measurement of a single qubit in the presence of noise with qiskit?

I am using a single qubit in the IBM quantum lab running on ibm_armonk and it is simulated with real noise, however when I try to measure out a state where the coefficient of the 0 state is less than ...
0
votes
0answers
32 views

How to choose $\beta$ in Gaussian derivative component of DRAG pulse?

From definition of the DRAG pulse it is: $$f(x)=Gaussian+1j*\beta*(-(x-duration/2)/\sigma^2)Gaussian,$$ where $Gaussian(x, amp, \sigma)=amp*e^{-(1/2)*(x-duration/2)^2/\sigma^2}$. If I try it in ...
0
votes
0answers
22 views

How to train a Quantum Neural network for regression model in supervised learning

We want to train a parameterised circuit(which is our neural network - from this paper. Now our final circuit looks a little like Let's say there are n training cases. So I have n |gt> vectors ...
0
votes
0answers
24 views

Questions about OpenFermion

I have some questions about OpenFermion. I'm exploring the code, does anybody knows how to implement triatomic molecules like Li-H2? How should I set the number of orbitals? Last but not least, once ...
1
vote
2answers
49 views

Are we using the real-time error information in simulating noise on qasm?

I'm trying to run some quantum circuits on qasm simulator using the noise information from IBM Q quantum device: ...
1
vote
1answer
53 views

How to set hyper parameters for a Variational Quantum Classifier (qiskit)?

I am trying to implement a Variational Quantum Classifier using qiskit's VQC. I have set the feature map to ZZFeatureMap and am using the ...
0
votes
0answers
33 views

Two body integral calculation taking too long

I'm running the most recent version of qiskit and am trying to run H2 in the cc-pvtz basis. However, it is taking an incredibly long time. This is what my code looks like: ...

1
2 3 4 5
24