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
1
vote
0answers
12 views

Applying QPE on a large matrix on amazon-braket

I'm running a QPE algorithm on the amazon-braket but it can only apply on a 22 or 44 matrix, when I want to expand it into a 5*5 or more, it will come an error. As I know, there is no theoretical ...
1
vote
1answer
36 views

How could I choose cost function in Qiskit TwoLayerQNN?

So here is the problem, I've found that in a TwoLayerQNN, the backward gradient is only to minimize the expectation of observable I've chosen. But I'm not going to minimize the predict of the input, ...
2
votes
0answers
13 views

Phase Oracle in Qiskit Solving Satisfiability Problems using Grover's Algorithm Section

In Qiksit Textbook, there is a section on solving satisfiability problems using Grover's Algorithm. For the 3SAT instance they construct the following phase oracle: Is there any reasoning behind ...
3
votes
1answer
104 views

How call from IBM Q Experience (Jupyter Notebook) cplex

I have the latest version of cplex (12.9) installed on my computer. I use it very well with Jupyter notebook, but in IBM Q Experience, I did not get way to call it. IBM Q Experience warns me that the ...
0
votes
0answers
8 views

Quantum PCA in qiskit

How do I implement QPCA in Qiskit. I have a machine learning algorithm where I want to apply QPCA.
3
votes
1answer
74 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() ...
2
votes
1answer
62 views

Replace Gate with Known Identity in Quantum Circuit

I have a quantum circuit with 3 two-qubits gates XX, YY, and ZZ (as defined in the qiskit circuit library) with arbitrary angles on each gate. I'd like to replace the YY and ZZ gates with XXs. I know ...
0
votes
0answers
49 views

Get_counts() method in qiskit [closed]

The method get_counts seems to work in both ways: get_counts() or get_counts(qc). is the argument optional here? and does it take the QuantumCircuit defined earlier in the code. URL:https://qiskit.org/...
2
votes
0answers
28 views

Computing specific observable for a Clifford circuit

Given a clifford circuit, how can I simulate it efficiently to get the 2-RDM (reduced density matrix) $D^2=\langle a_i^\dagger a_j^\dagger a_k a_l\rangle$ in the presence of deplorizing error? The ...
5
votes
2answers
416 views

Can I initialize only one qubit in a 4-qubit circuit?

I wonder if there's a way we can initialize the quantum state only for part of the qubits in a quantum circuit. Say if I have a quantum circuit defined as ...
0
votes
0answers
20 views

sample openqasm3.0 program

I am trying to get my first openqasm3.0 program and I am getting error messages that I cannot interpret. Here is my program: ...
1
vote
2answers
64 views

Setting the $\texttt{state_preparation}$ for $\texttt{AmplificationProblem()}$ in the scope of Grover's algorithm

I am having trouble setting the state_preparation parameter of AmplificationProblem() from ...
1
vote
1answer
25 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
2answers
149 views

How can I print out a state vector of a specific wire?

Suppose we start from 2 wires (q0 and q1) and through some quantum gates, suppose we measure q1 wire only. As we measure the q1 wire, the state vector of this quantum state would be determined ...
3
votes
2answers
123 views

Qiskit: Get approximate execution time

The IBMQ web interface shows both queue position and an approximate execution time for every pending job (see image below). Is there a way to retrieve this information via Qiskit? I know that ...
1
vote
1answer
41 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
1answer
56 views

No backends assigned to my Account

When I open my account on IBM Quantum Experience, I am shown 9 backends that are assigned to me. But when I open any of my circuits, I get the error that "This account has no backends assigned&...
1
vote
1answer
56 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 ...
1
vote
0answers
193 views

from qiskit.aqua import... ImportError: DLL load failed: The specified module could not be found [closed]

Dear team and developers. I am using qiskit on Python 36, windows 64bits I have the same identical problem of Import from qiskit-aqua error But the suggested solution (installing Numpy+mkl, I did it!) ...
2
votes
3answers
85 views

Quantum Error Correction implementation in Qiskit, OpenQASM or other languages based on Python

Where can we find example(s) of implementation code in a programming language of Quantum Error Correction, whether with the standard method of measurement or the automatic method without measurement (...
2
votes
0answers
31 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 ...
2
votes
2answers
115 views

Need some help with simulating molecules with VQE

I have studied the example of the simulation of LiH molecule in Learning Quantum Computation using Qiskit. It is available on this link: https://qiskit.org/textbook/ch-applications/vqe-molecules.html#...
1
vote
1answer
79 views

How do I get sate vector for each shot running on a quantum computer?

I was running this code on a quantum computer how can I generate a state vector for each shot while running on a quantum computer? qikit code ...
2
votes
1answer
63 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
40 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 ...
2
votes
1answer
85 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 ...
3
votes
1answer
64 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
103 views

Long running time at job

I try to launch QSVM algorithm (from Qiskit example ) on all real quantum devices (that is IBM Q) and get running time 5-30 seconds on one job. But if I use ...
1
vote
1answer
290 views

ERROR_RUNNING_JOB with 32 qubit circuit running on ibmq_qasm_simulator backend

I recently made a quantum circuit that uses 32 qubits and try to run it on IBM Q Experience qasm_simulator backend. But it always ends with ERROR_RUNNING_JOB. ...
2
votes
0answers
16 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, ...
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. ...
1
vote
0answers
14 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 ...
3
votes
5answers
250 views

How do I get the Unitary matrix of a circuit without using the 'unitary_simulator'?

I am using jupyter notebook and qiskit. I have a simple quantum circuit and I want to know how to get the unitary matrix of the circuit without using 'get_unitary' from the Aer unitary_simulator. i.e.:...
3
votes
1answer
198 views

API error when trying to access IBM Quantum Computer using IBMQ API Token

I'm trying to write a code so that if the token exists then it loads the account or else it asks the user for the API token. Below is the code for reference: ...
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: ...
2
votes
1answer
73 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
103 views

Grover's algorithm with matrix_product_state method

I implemented Grover algorithm with matrix_product_state method in qiskit. But I found something strange. I designed the oracle part come out $|1111\rangle$ but, real output was $0011\rangle$. I check ...
2
votes
1answer
55 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
45 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
225 views

Qiskit - Renormalize the qubit after measurement

I have a 2 qubits system, maximally entangled, and I performed measurement on one of the qubit. ...
1
vote
1answer
32 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 ...
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 ...
1
vote
1answer
51 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 ...
2
votes
1answer
46 views

How to write a code to made envelope function equal to $\pi$ to result in an X gate?

$$ \hat U_d = \exp\Big( -i\underbrace{\frac{Q}{2}\int_0^T A(t^\prime)\mathop{dt^\prime}}_{\Theta(t)} \hat\sigma_x \Big) $$ This equation is a Unitary transformation applied to a qubit from time $t = 0$...
0
votes
1answer
62 views

How to create a quantum circuit to implement the same operations but acting on different qubits?

I want the draw the quantum circuit of the following Hamiltonian: $$H = - 4 \times X\otimes X\otimes X\otimes X - 4\times Z\otimes Z\otimes Z \otimes Z$$. I have been able to draw the circuits of $ - ...
0
votes
1answer
90 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: ...
0
votes
1answer
71 views

Qiskit package installed locally, but not running in jupyter notebook

I believe I have installed qiskit on my computer. Running pip list or pip3 list in terminal returns: ...
1
vote
1answer
29 views

Simulating readout errors on aer simulator

I'm trying to simulate quantum experiments using a customized noise model. Here's my code: ...
5
votes
1answer
181 views

Two qubit gate decomposition in using Qiskit

I am writing some python code to be able to optimise the total error in two qubit gate decomposition. I am using the Qiskit module qiskit.quantum_info.synthesis.two_qubit_decompose My question relates ...

1
2 3 4 5
24