Questions tagged [programming]

For questions relating writing code to be executed on a quantum computer. For questions using or about a specific programming language, consider using also a more specific tag.

Filter by
Sorted by
Tagged with
2
votes
1answer
24 views

Change the position of a gate in Qiskit for better representation

I'm using Qiskit to demonstrate some circuits, and I want to change the position of some gates for better representation. For example, look at this circuit: I'd like for the last $R_x(\frac{-\pi}{2})$...
2
votes
1answer
27 views

Qiskit: Error when importing libraries for ADMM optimizer

I would like to try and ADMM optimizer as shown in Qiskit Tutorial in Quantum Lab. Firstly, I imported necessary libraries (copy/paste from the Tutorial): ...
2
votes
0answers
33 views

Simulate a random quantum state time evolution in Qiskit Aqua

I am trying to evolve a quantum state through a PauliTrotterEvolution in aqua and I'm trying to do so by initializing a random state, by using ...
1
vote
0answers
22 views

When are the quantum processors expected to enter the world of enterprise computing? [closed]

Nearly a year ago, Google announced achieving quantum supremacy and a few days ago IBM unveiled a roadmap of quantum computing up to 2023. Can someone kindly explain whether there is, at least, a ...
2
votes
1answer
52 views

How to perform a time evolution of a quantum state with Qiskit Aqua?

How can we perform a time evolution of a quantum state for a given Hamiltonian with qiskit Aqua operator flow? I'm interested in it due to its higher efficiency.
1
vote
2answers
20 views

Can I get the job variable from the job_id?

Suppose I run the following code: job = execute(qc, backend = backend, shots = 1024, optimization_level = 0) Then the job takes a long time to run. We know that ...
1
vote
1answer
36 views

Why does job appear to be stuck in queue on IBMQ backend?

I have submitted a batch of circuits to ibmq_vigo using the IBMQJobManager and the batch is correctly split properly into ...
0
votes
1answer
30 views

Inconsistency in Qiskit Aqua CircuitSampler from Operator Flow

I am trying to wrap my head around Qiskit Aqua Operators and I stumbled upon this: My code ...
0
votes
2answers
42 views

How to get the CNOT error rate between 2 qubits on a given IBMQ Backend?

How can the CNOT gate error between 2 qubits as shown on visual qubit coupling map on the IBMQ Dashboard be retrieved in Qiskit using the BackendProperties....
-1
votes
0answers
23 views

Qiskit density_matrix simulator and memory_profiler

I use jupyter notebook to simulate quantum dummpy code with 'density_matrix' method. Following is my code. Now, I want to check memory usage of it. So I use %memit operation to each functions. ...
1
vote
1answer
45 views

Unable to instantiate provider for research account locally

When I run IBMQ.load_account(). I have the error information: ...
0
votes
1answer
28 views

Converting 'string' to a function/gate in QisKit

I want to give a list of Quantum gates in a .txt file from user an apply them to a Quantum circuit but the gates in notepad .txt file have 'string' type while in Qiskit I need functions/methods. For ...
0
votes
1answer
17 views

How to re-execute failed jobs in qiskit?

When executing a batch of circuits using the IBMQJobManager and attempting to combine all the results of all jobs with combine_results I get the ...
0
votes
0answers
42 views

Different result between Q# and Qiskit

I'm running a search program with custom initial state. I wrote a program in Q# and one in Qiskit but I get different results even if the code seems to be peforming the same operations. The Q# result ...
-1
votes
1answer
51 views

Qiskit implementation for MPS

Now, I'm implementing Matrix product state method with QasmSimulation in Qiskit. following code The problem arise when I set number of qubits. When running it with 27qubits is very fast but, for 24, ...
0
votes
1answer
24 views

Why does job execution time vary significantly across different IBMQ Backends?

I have run a batch of a few thousand random 2-qubit QuantumCircuits on multiple different IBMQ Backends, and the execution times seem to significantly vary across ...
0
votes
1answer
21 views

Grover algorithm in Q#

I have this program derived from Microsoft Quantum Kata for quantum search (Grover algorithm) (see here) ...
1
vote
1answer
36 views

How to optimize my HHL algorithm on qiskit?

I am following this HHL tutorial to solve the $Ax=b$ problem and have been using the general (inefficient) approach with the BasicAer simulator that they describe in section 4a. I would now like to ...
0
votes
1answer
33 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 ...
2
votes
0answers
40 views

What is the best way to use loop statements on a quantum computer?

I am interested in solving a time dependent linear partial differential equation of the form $Ax=b$ which, in classical computing, would amount to looping over solutions of $Ax=b$ where $b$ is updated ...
0
votes
2answers
56 views

Custom Gate/Instruction with classical bits in Qiskit

In Qiskit, I need to define a custom gate or instruction that, once decomposed, turns into a series of basis gates, including measurements and classically controlled gates (this is the part that I can'...
1
vote
1answer
42 views

Quadratic optimization in Qiskit: Error when QuadraticProgram with quadratic constraint converted to QUBO

I prepared a quadratic optimization task with binary and integer variables and linear and quadratic constraints. I fed it into QuadraticProgram in Qiskit. After ...
0
votes
2answers
33 views

Implementing Partial Trace in IBMs quantum computer

I am trying to implement the partial trace operation on IBMs quantum computer. I am simulating the depolarising channel with the following code ...
-1
votes
1answer
24 views

Implementing Cirq Coding Gates

Can someone please help me making these gates on CIRQ programming: Decrement Gate (-1) Splitter Gate (If possible) I was having trouble implementing these and was not sure if it's possible either. ...
1
vote
1answer
49 views

Hadamard gate for three qubits; inconsistency between IBM and Matlab

I am trying to build a large and quite complex three qubit quantum circuit on IBMs quantum computer. I have a specific unitary which I am trying to implement and I am building a circuit following the ...
2
votes
2answers
53 views

My IBMQ job hangs forever?

I am running a very simple script just to learn how to use IBMQ, but my job will hang indefinitely and I am forced to terminate it. ...
0
votes
1answer
53 views

How to get state vector from QasmSimulator in Qiskit

I'm currently able to get state vector in Qiskit using state_vector backend using something like : ...
2
votes
1answer
42 views

Why running time of qasm simulator is significantly smaller in comparison with quantum machines?

I ran a 3-qubit measurement circuit on QASM simulator as well as on IBM Q Melbourne, Santiago and Vigo machines. The running time on the simulator is in few milliseconds (400-800) while in the case of ...
-1
votes
1answer
128 views

Implementing a circuit that returns $|01\rangle$ and $|10\rangle$ with equal probability

Using Python how can I implement a quantum circuit that returns $|01\rangle$ or $|10\rangle$ using only $CX$, $RX$ and $RY$ gates, starting with random parametric gates as parameters and optimizing it ...
0
votes
1answer
48 views

How to code a projector operator in qiskit?

I'm new to qiskit and I want to know how do I define a projector operator in qiskit? Specifically, I have prepared a 3 qubit system, and after applying a whole lot of gates and measuring it in a state ...
2
votes
1answer
60 views

Test equivalence of circuits exactly on qiskit

I have two circuits that I believe are equivalent. How can one check this on qiskit? Currently, I am executing both circuits and verifying that the counts are close (which they are) but I would like ...
1
vote
1answer
31 views

Is there a way to generate random circuits in qiskit with only certain allowed gates?

It seems like I can use https://qiskit.org/documentation/stubs/qiskit.circuit.random.random_circuit.html but I would like to control the gates that are allowed. What is an efficient way to make random ...
-1
votes
0answers
38 views

Why are there 2 different versions of qiskit installed in anaconda?

When running pip show qiskit-ibmq-provider in the Anaconda Prompt I get the following: ...
1
vote
1answer
30 views

What is the significance of varying the number of shots while running a circuit in a quantum machine and qasm simulator?

what is the significance of varying the number of shots while running a circuit in a quantum machine and qasm simulator? Does more number of shots give better/accurate result? I am running a simple 2 ...
0
votes
1answer
21 views

Is the combine_results method deprecated in qiskit v0.20.0

According to the ManagedResults Documentation the class has a combine_results method, however when attempting to use it as follows: ...
0
votes
2answers
29 views

How many shots are executed when using the IBMQJobManager?

When using qiskit execute it is possible to stipulate the number of shots for each experiment/...
-1
votes
1answer
22 views

Qiskit job not giving the right result after execution

Here is my code ...
1
vote
2answers
80 views

Running Google Cirq example code from their webpage — where do I find information about PROCESSOR_ID?

I'm just ttrying to run the simple example code in Google's Cirq startup page: https://cirq.readthedocs.io/en/stable/google/engine.html I think I have the access authorized correctly via Google's ...
2
votes
1answer
35 views

What is the connection between $RX$ gates and $X$ gates (similar for $Y$ and $Z$)?

I am new to quantum gates but do not understand the connection between the $RX$ and $X$ gates. I know that $$R X(\theta)=\exp \left(-i \frac{\theta}{2} X\right)=\left(\begin{array}{cc} \cos \frac{\...
0
votes
2answers
145 views

How to initialise a qubit in the state $\frac{1}{\sqrt2}(|0\rangle+|1\rangle)$ in qiskit?

In qiskit, how can I initialise a qubit in a complex state, specifically in the state: $$\left|q\right> = \frac{1}{\sqrt2} \left|0\right> + i \frac{1}{\sqrt2} \left|1\right>$$
1
vote
2answers
37 views

How to execute many circuits on an IBMQ backend?

I attempted to execute a list of $3200$ QuantumCircuits in Qiskit, each with the max_shots ...
2
votes
1answer
26 views

Qiskit: Add a standard gate to circuit from a string

Given a circuit, if one wishes to add a gate, it is done through a line like the one below mycircuit.cx(0, 1) Here, we have added a control-X gate on the 0 and 1 ...
2
votes
1answer
35 views

Qiskit: Get gates from circuit object

Is there a way in Qiskit to take a circuit object and return a list of tuples where each tuple consists of a gate and the qubit(s) they act on? The list obeys some partial order since the gate order ...
1
vote
1answer
27 views

Error while running Qiskit code on real quantum hardware

I started to learn Qiskit, so sorry if my question is very basic. So far I used qasm_simulator or state_vectorsimulator, ...
0
votes
1answer
37 views

QiskitError: 'No statevector for experiment

This is the code that I have used. Why can't i use get_statevecto when i use quantum computer. I got a state_vector when i have used qasm_simulator. ...
0
votes
0answers
36 views

qiskit - MCMT - base gate acting on only one qubit

I want to reduce the depth of a ucrz gate acting on multiple qubits with ancilla qubits in qiskit. One way to do this could be the mcmt implementation with ...
0
votes
1answer
38 views

How do I compute the fidelity on the IBM Q using qiskit without the statevector simulator?

I want to compare the fidelity of a circuit implemented on IBMQ Santiago with the ideal circuit simulated using the statevector backend. Is there a way to do this? So far I have only seen examples ...
0
votes
2answers
32 views

How to remove last n layers of Quantum Circuit in Qiskit?

Let's say I have a QuantumCircuit with depth $d$ layers. How can I generate a new ...
1
vote
1answer
24 views

Getting an error running a program in IBM Q Experience Quantum lab

Running the program in Quantum Lab, it shows error. I am looking for solution. Here is a code I run: ...
3
votes
1answer
52 views

Implement U2 and U3 gate in Q#

I know that U1 equivalent gate of Qiskit in Q# is R1, but I would like to implement U2 and U3 gate of Qiskit in Q#, what is the best way ? Thank you.

1
2 3 4 5
11