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.

223 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
31 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 ...
2
votes
0answers
47 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
0answers
62 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 ...
2
votes
0answers
92 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 &...
2
votes
1answer
67 views

how can we save a model using qiskit_machine_learning?

How can we save a trained model using Qiskit Machine Learning library? I've built a VQC classification model and once finished, I'd like to save the different models to be loaded later. There is a <...
2
votes
0answers
23 views

Output of D-Wave LeapHybrid solver takes long to evaluate

we made the strange observation that the evaluation of the output in form of the dimod.SampleSet takes a long time to evaluate especially in comparison to the actual sampling step. Here is a minimal ...
2
votes
0answers
51 views

Issues in calculating exact runtime on ibmq_16_melbourne

I am working on calculating the exact runtime of a quantum circuit on the ibmq_16_melbourne device. I am using the API ...
2
votes
0answers
53 views

How do I construct a Breidbart gate in Qiskit?

Based on this : https://qiskit.org/textbook/ch-states/single-qubit-gates.html How do I construct a Breidbart gate (which is like the Hadamard gate but with $\pi/8$ instead of rotating by $\pi/4$)? I ...
2
votes
0answers
42 views

How to turn a 'term' in a QuantumError into a QuantumError?

A QuantumError class may have many terms, and we can use .error_term(position) to have a look at each term. But it returns a list instead of another QuantumError ...
2
votes
0answers
77 views

How accurate are Qiskit’s unitary and Statevector simulators for very large circuits?

Background: I wrote a code that takes a Qiskit circuit C as an input and outputs a random circuit C’ such that C and C’ have the same unitaries. I tested my code using Qiskit’s Statevector simulator ...
2
votes
0answers
89 views

is it possible to eliminate a certain possibility of an outcome of 3+ qbits

Let's say I have n qbits each in a superposition $\begin{pmatrix} \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} \end{pmatrix}$ so each possible outcome has a probability of $\frac{1}{2^n}$. Is it possible ...
2
votes
1answer
91 views

How to solve TSP problem with more than 3 nodes in the tutorial of Max-Cut and Traveling Salesman Problem?

I had to try the example of qiskit’s Traveling Salesman Problem with 3 nodes and executing it at IBM backend called simulator_statevector.Can execute and get the result normally. But when trying to ...
2
votes
1answer
139 views

How fast is qiskit to_gate() method, which is used to convert circuit to gate?

I have prepared a quantum circuit, which is using 13 qubits. Now, I am converting this circuit to gate but it is taking around avg. 35s for conversion. It would have have been fine, if I require only ...
2
votes
0answers
69 views

Why there're two axis of rotation when I'm trying to visualize this time-evolution?

This is a follow-up question of the problem I posted earlier. The following diagram illustrates my question: I'm trying to perform the time evolution of a random Hamiltonian. The green vector ...
2
votes
0answers
32 views

What would be a real-life example of using a quantum workflow oriented tool/environment, such as through Orquestra?

Recently, a unified quantum software and hardware platform, Orquestra was released. My question is, what could be a real-life (step by step) example of using this kind of workflow? As existing quantum ...
2
votes
0answers
87 views

Is qiskit documentation about determining $|0\rangle$ and $|1\rangle$ incorrect?

I'm using pi-pulse pulses on qubit Armonk for determining 0 and 1 by Machine Learning. But when I run the code from https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-pulse.html. I get ...
2
votes
3answers
86 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
73 views

Calculating exact expectation values on ibmq_qasm_simulator

In order to calculate the exact expectation value of a Pauli operator in some state using local qasm_simulator, I do ...
2
votes
0answers
81 views

Qiskit CircuitStateFn.eval() on more than 16 qubits

The definition of Qiskit CircuitStateFn.eval() is as follows: ...
2
votes
0answers
65 views

Getting Choi-matrix of a subsystem

In Qiskit, for a given QuantumCircuit object, you can compute its Choi-matrix via the corresponding Choi object, for example: <...
2
votes
0answers
47 views

How to implement the Maximum or Minimum Searching Algorithm (QUMMSA) circuit in Quirk?

I am Java and Python programmer who started self-learning Quantum Computing a couple of months back. The journey has been thus far very tough. I have been using QisKit and Quirk to learn by in ...
2
votes
0answers
48 views

How to implement the Mixer of Quantum Alternating Operator Ansatz for Max-Independent-Set

I am trying to implement the Mixer of the Max-Independent Set from The Quantum Alternating Operator Ansatz. From this paper: https://arxiv.org/pdf/1709.03489.pdf in Chapter 4.2 page 15 to 17. For ...
2
votes
1answer
275 views

Qiskit BasicAer & Aer

While I'm simulating grover's algorithm, I found that with BasicAer backend it works well but with Aer it is not. What is the difference between ...
2
votes
0answers
104 views

Wrong Expectation value when implementing a VQE for the Heisenberg Hamiltonian

I tried to implement an extended Heisenberg-Hamiltonian as an extra exercise further than my homework. My Hamiltonian is the following: $H = \sum_{NN} \sigma_x\sigma_x + \sigma_z\sigma_z$ I try to ...
2
votes
1answer
99 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
1answer
203 views

Unable to retrieve result for Job Error during VQE simulation

I am attempting to run a VQE calculation on the 'ibmq_qasm_simulator'. The job is failing with a series of errors caused by: ...
2
votes
1answer
64 views

Qiskit IBMQ.load_account fails on version 0.20.0

So when trying to load my account I get this error: ...
2
votes
0answers
73 views

What is the maximum circuit depth for Qiskit Aer Simulator?

I'm running some simulator circuit on my computer, and I see that (using 3 qubits, and thousands of classical registers), the max cap seems to be about qc.depth() ...
2
votes
0answers
66 views

Defining a Grassmann Algebra in Python

I am trying to implement a Grassmann algebra in Python and was wondering if anyone could recommend any packages or suggest how to do so? I want to define the following multiplication rules over $\Bbb{...
2
votes
2answers
150 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 ...
2
votes
0answers
59 views

IBMQJob.result() returns KeyError: 'qObjectResult'

I'm running tomography job like I have done many times before. I send the job, and the job.status() is 'DONE'. But when I ask for ...
2
votes
0answers
82 views

A bug during CIRQ installation

I had the following problem with an installation of the Cirq. When I typed python -m pip install cirq, I got the following line: "Cannot uninstall 'sympy'. It is ...
2
votes
2answers
147 views

qiskit: IQFT acting on subsystem of reversed-ordered qubits state

I have a state psi as an ndarray of shape (2 ** 3,) s.t. psi[0]= amplitude of 000 ...
2
votes
0answers
216 views

How can I implement partial transpose on a variable in Picos (Python, trying to solve an SDP)?

I try to optimise a quantity via an SDP. I optimise over all PPT measurement operators and hence have the constraints $\Pi_k^{T_B} \succeq 0$ (PPT) for my measurement operators. The part of the code ...
2
votes
0answers
522 views

Decomposition of an arbitrary gate using given matrix in Qiskit

If I have an arbitrary non-unitary matrix of say $$ U = \begin{pmatrix} 1.5 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1.6 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ \end{...
2
votes
3answers
188 views

Pauli I in eoh procedure doesn't become a global phase gate in qiskit evolution_instruction method. Possible consequences

If one has two qubits in arbitrary stats and wishes to apply a controlled version of some global phase gate $P(\varphi) = \begin{pmatrix} e^{i\varphi} & 0 \\ 0 & e^{i\varphi} \end{pmatrix}$ ...
2
votes
0answers
136 views

Running HHL tutorial on real backend

I tried to follow the HHL tutorial. Since the 8x8 problem is not realistically simulable (I stopped after a few minutes), I tried to make it run on another backend, starting on the easiest example: <...
2
votes
1answer
226 views

Qiskit - Renormalize the qubit after measurement

I have a 2 qubits system, maximally entangled, and I performed measurement on one of the qubit. ...
2
votes
0answers
85 views

Modifying GRAPE for open quantum systems

This question requires the knowledge of GRAPE. More info can be found here and in this short presentation. I have tried to modify the grape_unitary() function in grape.py also to accommodate open ...
2
votes
0answers
997 views

How to run quantum SVM algorithm from Qiskit in real IBM Quantum Computer using IBMQ?

I'm trying to run QSVM algorithm in IBMQ experience, want to run in one of those real quantum computers. ...
1
vote
1answer
21 views

'Internal error. Error code 9999' when running job on IBMQ

I'm trying to run a series of circuits in a job and I keep getting this error message which I haven't been able to find the meaning of anywhere in qiskit's documentation, online, etc. The job appears ...
1
vote
0answers
58 views

QuTiP VS RK45: Which one gives the correct results for time-dependent systems?

I am writing a code for a quantum thermal machine which includes both coherent and dissipative time evolutions in its different stages of operation. However, evolving the system with "mesolve&...
1
vote
0answers
16 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
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 ...
1
vote
1answer
34 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
52 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
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.
1
vote
0answers
51 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 ...
1
vote
0answers
38 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 ...