Questions tagged [programming]

For any questions whose answer is expected to require code or programming notions. For questions about a specific programming language, please also include a more specific tag.

Filter by
Sorted by
Tagged with
3
votes
1answer
19 views

Are job IDs unique across backends?

Are job IDs unique across backends, or is it possible that two jobs on two different backends have the same job ID? I'd like to use the job ID as primary key in a database. Thanks in advance!
2
votes
1answer
46 views

Why qiskit transpiler makes different results everytime? (Non-deterministic)

I tried to do qubit mapping called 'SABRE' and execute transpiled quantum circuit. I use FakeTokyo backend which has some noise because it is mock version of IBMQ 20-Tokyo. I know using this backend ...
1
vote
1answer
48 views

IBMQ.load_account() is failing

When I try IBMQ.load_account or IBMQ.delete_account gives an error in the ubuntu machine and the error is, ...
2
votes
0answers
32 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 ...
5
votes
2answers
65 views

Cascade/Feedforward quantum circuits

I would like to know if it is possible implement the following situation in Qiskit (either using the simulators or real quantum computers). Consider this illustrative toy example: The arrows ...
2
votes
1answer
43 views

How can I write unit tests for a pennylane circuit?

I have several mixing unitary circuits written using Pennylane to be used in the QAOA algorithm. Furthermore, I'd like to write unit tests for these mixing circuits to ensure that the code is doing ...
2
votes
1answer
62 views

How to find the expectation value of several circuits using Qiskit aqua operator logic?

I am using the method from this SE answer to calculate the expectation value using qiskit aqua operator logic which works well for a single circuit. Here is a simplified code snippet to demonstrate ...
2
votes
2answers
101 views
+50

Transpilation on restricted topology does not yield an equivalent circuit in Qiskit

Here is an MWE: a simple circuit on three qubits with a CNOT acting on qubits 0 and 2. The coupling map prohibits a two-qubit gate between qubits 0 and 2 and so qubit 1 must get involved. ...
3
votes
1answer
52 views

Qiskit: total number of parameters after composing parametrized circuits

I'm trying to use the .compose() method to join two parametrized circuits, specifically TwoLocal instances from the ...
1
vote
0answers
48 views

Are inconsistent results between different VQE runs justified?

I made this post a while ago, where I learned I could use qiskit's VQE to calculate (or approximate) the Transverse Field Ising Hamiltonian and other similar Hamiltonians. After working with my code ...
4
votes
1answer
88 views

Is a black-box gate whose output is conditional on the value of an input amplitude possible?

Suppose we have a qubit in the state $|q\rangle = a |0\rangle + b |1\rangle$, and another ancilla qubit $= |0\rangle$. I wish to have the following black-box gate: ...
2
votes
0answers
36 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
1answer
51 views

Qiskit: set_frequency workaround in PulseSimulator

I am trying to run exercise 4 from the recent IBM Quantum Challenge using a PulseSimulator since the device used in the challenge is not available for public use. A snippet of what I am trying to run ...
2
votes
1answer
55 views

IF statement in OpenQASM2.0 on IBM Quantum Experience — error

I have written the following toy .qasm file, which has some adaptive measurements: ...
3
votes
1answer
52 views

How do I identify a VQE job run in real hardware?

I am running a VQEUCCFactory for H2 on a real hardware device. ...
1
vote
0answers
47 views

How to calculate Alpha and Beta values for QAOA Max-cut problem manually?

I'm new to Quantum Computing. I came across solving the Max-cut problem using QAOA. For example, if I have a $U3$ gate with parameters $U3(0,0, \gamma_{XYZ})$ gamma parameter at $p=X$ between logical ...
1
vote
1answer
66 views

Qiskit - lesson 3 - with Abe

Coding for Qiskit I watched this video: https://www.youtube.com/watch?v=RrUTwq5jKM4 Using Mac OS Big Sur Using Jupyter 2.0.8 Using Python 3.8 The below code did not work and therefore installed ...
3
votes
1answer
129 views

Transpilation into custom gate set in qiskit

In qiskit, I can transpile a given circuit into a some predefined gate set as follows (just an example) ...
5
votes
1answer
99 views

Use one_body_integrals to know which orbitals to freeze in ElectronicStructureProblem

In exercise 5 of the this year's IBM Quantum Challenge, you need to use the FreezeCoreTransformer (along two_qubit_reduction and ...
2
votes
1answer
136 views

quantum label classification using qiskit

I am generating points for classification. Some will be above the main diagonal, while others will be below (blue or red). ...
1
vote
1answer
53 views

Superposition of a subset of integers

I am trying to do the superposition of a subset of integers using qiskit. For instance: $|13\rangle + |14\rangle + ... |N\rangle$ (uniform superposition) without the part $|0\rangle + |1\rangle + ... +...
3
votes
1answer
151 views

How do I send a quantum circuit to IBM for execution?

I have, let's say, the following quantum circuit: The QASM code of this quantum scheme has the following form: ...
6
votes
2answers
249 views

Apply readout error mitigation to mid-circuit measurement

I'm trying to construct a quantum circuit with 3 mid-circuit measurements, here's an example: ...
2
votes
1answer
56 views

QPE Circuit test on Quantum Computer ('ibmq_16_melbourne')

After several atempts, I cannot mitigate the error when running the code on a NISQ, via the qiskit library (more specifically on the 'ibmq_16_melbourne'). I've already mapped the connected qubits and ...
2
votes
1answer
32 views

How does the pulse.Shiftphase instruction in Qiskit Pulse work? [closed]

I have some questions regarding the mechanism of Qiskit pulse.ShiftPhase instruction: Does it work like a Phase Shift $P(\theta)=\begin{bmatrix} 1 & 0 \\0 &...
3
votes
2answers
366 views

How can I specify the qubits on quantum computers that I want to use?

Suppose I have the following 2-qubit quantum circuit: ...
1
vote
1answer
70 views

(solved(?)) Quantum circuit in a loop increasing qubit ids throughout despite attempts to reset

I have a parameterized circuit attempting to classify a set of features for various samples. I need to reencode the features per sample, but through the epochs, the computations slow down considerably ...
1
vote
1answer
43 views

How to map an arbitrary Fermionic operator to Spins (Qubits)?

There are several Tutorials from Qiskit demonstrating the use of PySCF driver. Usually, it takes as input the geometric structure of the molecule -> second quantised-operators -> JW or Parity ...
1
vote
0answers
36 views

What is the kernel used in the IBM Qiskit's source code?

I want to redefine the QSVM code for a different kernel. But what is the kernel actually used in the IBM Qiskit's source code? And where is it defined, exactly. QSVM on Qiskit.
3
votes
1answer
31 views

Decomposition of gate $R_{y}$ into specific basis

How can I decompose gate $R_{y}(\theta)$ into gate $R_{x}(\alpha)$ and gate $R_{z}(\beta)$. And how to perform it on Qiskit, is there any function to do it.
1
vote
1answer
29 views

What are standard/most popular data formats to represent quantum circuits including hardware specifications?

On an abstract level one draws a circuit diagram with wires and gates. Different software frameworks like qiskit, circ etc. ...
2
votes
1answer
65 views

Implementing quDit algorithms in Qiskit using quBit

How do you implement any $d$-dimensional qudit circuit in qiskit using qubits to simulate on an actual quantum computer?
3
votes
1answer
94 views

What explains my anomalously scaled up VQE?

I am trying to implement VQE from the Qiskit to obtain the ground state of a very specific Hamiltonian that has been generated via a docplex minimized quadratic ...
2
votes
1answer
76 views

Does Qiskit Statevector has actual speed up for Grover Search?

From Qiskit document, the Statevector can be used to specify the oracle of Grover Search. After seeing the source code of the operators, it seems a statevector is converted to a rank-1 projector ...
3
votes
1answer
98 views

Setting initial state in Qiskit unitary simulator

I'm getting started in IBM quantum lab for quantum computing. My task is to put quantum state $|0\rangle$ on the 1st qubit and state $|1\rangle$ on second one. I tried using this method to initialize ...
4
votes
2answers
117 views

How to create the equivalent of the Qiskit rxx gate in Pennylane?

How can I create the Pennylane equivalent of: from qiskit import QuantumCircuit circ = QuantumCircuit(2, 2) circ.rxx(theta=0.3, qubit1=0, qubit2=1)
1
vote
2answers
85 views

Qiskit Pulse Notebook

When I downloaded the source code from Qiskit Notebook Accessing Higher Energy States and tried to execute it, the output and graph seem wrong in the step finding the frequency step which leads to the ...
2
votes
1answer
39 views

QAOA not returning solution for simple clustering problem

I am following University's of toronto QML course and there's a section where QAOA is applied to cluster a set of vectors by mapping the clustering problem into a Maxcut problem. Unfortunately qiskit'...
2
votes
1answer
66 views

IBM Quantum API for Java Developers

As far as I know, IBM Quantum provides two types of APIs: one for Qiskit, and the other for third-party uses (API for developers). In this question, there are several arguments about using the API for ...
0
votes
1answer
51 views

Things that I can compare between QDK and Qiskit

I am planning to write an article which compares QDK and Qiskit Mainly talking about the different interfaces, and difference in running few algorithms What all parameters should I compare and take ...
3
votes
2answers
67 views

Data embedding using IBM quantum composer

How do you use the IBM quantum composer to encode some data $(a,b,c,d)$ represented by a vector ket in which $a,b,c,d$ have been normalized to one? $a|00\rangle + b|01\rangle + c|10\rangle + d|11\...
3
votes
1answer
90 views

Saving vectorized circuits in Qiskit

Is there a way to save vectorized images in Qiskit? I am using circuit.draw('latex', filename='./file.pdf') They type of the image is a pdf, but it looks like a ...
0
votes
1answer
67 views

How to code density matrix in python? [closed]

how to do this in python using for loop $\rho = \sum_i p(x)|x\rangle\langle x|$ where $X = {x1,x2,....}$ and $P = {p1,p2,p3...}$ i have tried this loop but tis not working ...
2
votes
1answer
33 views

What may I read from DensityMatrix charts when running simple Qiskit code?

Let's say I am running this code and I obtain picture below using Qiskit DensityMatrix class. ...
3
votes
2answers
124 views

Sympy suddently does not work together with TFQ

I work with tensorflow-quantum and use sympy for parameter updating. Suddenly, without (manually) updating or changing anything this error comes up: ...
1
vote
1answer
41 views

Running qiskit on jupyter notebook certverification error: unable to get local user certificate

I have code which runs on the IBMQ website perfectly, however copying and pasting the same code (and including my API token) the same code does not run when I try and run it on a real quantum computer ...
0
votes
1answer
44 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: ...
2
votes
1answer
218 views

Add FreezeCoreOrbitals on ElectronicStructureProblem

I want to freeze core orbitals of my molecule and I know ElectronicStructureProblem has the possibility (es_problem = ElectronicStructureProblem(driver=driver, q_molecule_transformers=...
2
votes
1answer
84 views

Replacement of FermionicOperator from qiskit.chemistry in qiskit_nature

qiskit.chemistry.FermionicOperator here is very useful for converting fermionic operators to qubits operators. qiskit.chemistry ...
0
votes
0answers
46 views

How do you build the modified Toffoli gate using only local unitary and CNOT operations?

How do you build a circuit for a modified Toffoli gate using only local unitary operations and CNOT operations? The two-qubit unitary operation is given by: $\text{diag}\{1, 1, 1, e^{i\phi}\}$.

1
2 3 4 5
20