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. If your question is about installation or any specific framework error, consider posting it in https://stackoverflow.com/ instead.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

Implementing a Quantum Recurrent Neural Network

I want to implement a Quantum Recurrent Neural Network and use it for time series forecasting. As a starting point, I chose to implement it using the architecture given in this paper: https://arxiv....
MoBlufiz's user avatar
0 votes
0 answers
5 views

QISKIT Metal Saves Error Generating Python Code

Background I'm testing out the ability of the Metal GUI to save a simple circuit but it keeps generating code that gives rise to various errors. In the below code for example generates an error show ...
Shadow43375's user avatar
1 vote
1 answer
19 views

Is qiskit.pulse.SamplePulse deprecated?

I'm currently following along the book "Learn Quantum Computing with Python and IBM Quantum Experience" by Rodert Loredo and I am at chapter 8 - Generating pulse schedules on hardware. The ...
Johannes Jyrgenson's user avatar
1 vote
0 answers
31 views

Are there libraries based on qiskit that can trace over unentangled qubits?

Suppose I have a QuantumCircuit object qc, which contains some unentangled qubits, and a Hamiltonian whose expectation value I ...
squareroottwo's user avatar
2 votes
0 answers
35 views

Create a superposition among the basis states of G for the hidden subgroup problem, implementing $\frac{1}{\sqrt{|G|}}\sum_{g\in G} | g,0\rangle$

I’ve been studying Simon’s problem and developing simulation models using Mathematica to extend the problem to other abelian groups and hidden subgroups of order $\geq 2$. I can now obtain the $h^\...
Phillip Dukes's user avatar
1 vote
1 answer
36 views

Simulator able to run SwitchCase in qiskit?

I am trying to run my circuit which is the following on a simulator. However, when I want to execute this on almost all the simulators the following error pops up: "The control-flow construct '...
Navid Elyasi's user avatar
1 vote
0 answers
43 views

Is there a publicly available compiler for OpenQasm3?

Today (Nov 2023) using OpenQasm3 in the IBM ecosystem can only be done by exporting OpenQasm3 programs to python QuantumCircuit object via qiskit.qasm3.load and qiskit.qasm3.loads or by exporting ...
Radu M.'s user avatar
  • 292
2 votes
1 answer
101 views

If_test() - Dynamic Circuits in qiskit

I am trying to run a dynamic circuit by having mid-measurement in my code as follows: ...
Navid Elyasi's user avatar
1 vote
0 answers
66 views

How to explain the output as $|-\rangle$

I am a complete newbie to quantum computing and qiskit. I am trying to implement $H$ gate in Measurement-Based QC architecture based on a paper "Qiskit As a Simulation Platform for Measurement-...
user27306's user avatar
2 votes
1 answer
80 views

How to measure in $\sigma_x$ basis in Qiskit? [duplicate]

As we know, Qiskit can give us the results of our measurements in computational or, better to say, $\sigma_z$ basis. However, I am courageous about measuring the qubit in, for instance, $\sigma_x$ ...
Navid Elyasi's user avatar
1 vote
1 answer
52 views

Phase shift on qiskit quantum teleportation simulation

I wonder in Qiskit why the phase shift occurred in my simulation and how I can turn it off. I posted another question regarding the same simulation here, and while I tried to solve this on my own, I ...
quantum_quantum's user avatar
2 votes
1 answer
56 views

Consecutive phased X rotation gates simplification

I have two consecutive phased X rotation (see cirq PhasedXPowGate gate definition), how to find both t' and p' angles (according to previoux cirq definition) so that two consecutive PhasedXPowGate are ...
user12910's user avatar
  • 429
1 vote
0 answers
121 views

Is there a way to implement a noisy CNOT gate using CUGate in Qiskit

Wondering if there's a way to implement the noisy version of CNOT (or CX) gate via CUGate using qiskit library for a given fidelity p?
codeit's user avatar
  • 69
0 votes
2 answers
36 views

Converting a dictionary to a statevector in Qiskit

Suppose we have a dictionary of computational basis states and their amplitudes: {'01':0.5, '10':0.5, '11':0.5, '00':0.5} How do I convert this (or any arbitrary ...
Bard's user avatar
  • 325
1 vote
0 answers
40 views

Quantum Lookup Table circuit

I am trying to use the paper "A Realizable GAS-based Quantum Algorithm for Traveling Salesman Problem (2022)". However, it never explains how the index converter works, beyond it being a ...
MrStealYourFrog's user avatar
3 votes
1 answer
66 views

Single-shot error correction for the surface code with measurement errors

I am trying to implement a single-shot error correction for the surface code with data + measurement errors (both with prob. p), using the (build-in) BP+OSD decoder. I am mostly following these papers:...
David Dentelski's user avatar
1 vote
0 answers
55 views

How to discard one of the states in a product state in qiskit?

Suppose I have a state in qiskit which is a product of states, for example: $| \psi \rangle = \left(\frac{ \sqrt{2} | 000 \rangle + |111 \rangle} {\sqrt 3}\right) \...
Bard's user avatar
  • 325
1 vote
0 answers
34 views

How to use parameters in QuTiP?

I am working with QuTiP to do some calculations based on my proposed Hamiltonian. The Hamiltonian of my system has some coupling constants that show the strength of coupling between matter and light(...
Navid Elyasi's user avatar
1 vote
1 answer
60 views

Set the initial state of the QuantumCircuit using the Statevector object

Suppose we have a 4-qubit quantum state state which is a Statevector object: ...
Bard's user avatar
  • 325
0 votes
0 answers
56 views

Is it possible to simulate a quantum algorithm on a classical computer? [duplicate]

I am designing a quantum algorithm that I would like to simulate and test, but I need to be able to simulate it on a classical computer.
Mihir Macwan's user avatar
1 vote
0 answers
35 views

How can I pass multiple embeddings in my function?

I have a problem with my code. I would like to try multiple embeddings in my kernel (I'm using the adjoint method). My idea is to pass them to the function and use them depending on what I pass. ...
BootBootBoot's user avatar
1 vote
1 answer
69 views

How to collapse the subcircuits in a QuantumCircuit?

Suppose I have a QuantumCircuit object named FC, which explicitly contains the identity gate, and convert it into a gate using <...
Bard's user avatar
  • 325
1 vote
0 answers
42 views

How to create a 3-D state (array) of qubits in qiskit or cirq etc?

I want a 3-D cube-like array for state of qubits, on which I want further to implement different sets of rotations, etc, for cryptographic means. You can create a 2D grid qubit in cirq with ...
Syed Shahmir Kazmi's user avatar
0 votes
0 answers
38 views

Error: module 'rustworkx' has no attribute 'visit' when trying to execute a quantum circuit in a real quantum computer from IBM

I am trying to use a real quantum computer from IBM. I have the next code: ...
Marcos Quintas Pérez's user avatar
0 votes
1 answer
25 views

DeprecationWarning: Back-references to from Bit instances to their containing Registers have been deprecated

I have the following code for instruction, qargs, cargs in qc.data: qbit: qiskit.circuit.Qubit = qargs[0] print(qbit.register) print(qbit.index) the ...
Evan Camilleri's user avatar
2 votes
0 answers
34 views

Is there a Qutip equivalent of "expand_operator" for superoperators?

I want to calculate a superoperator for a small noisy subsystem consisting of $k$ qubits, and expand it to $n > k$ qubits, where the remaining $n-k$ qubits are not subject to any noise. ...
JoJo P's user avatar
  • 179
2 votes
0 answers
65 views

SLSQP optimizer(scipy.minimize) doesn't update parameters

I'm trying to find optimal parameters that minimize the cost functions. In cost function, it calculates the classical-fisher-information at a certain point(phi[0] = np.pi). Cost-function takes 3-...
Donguk kim's user avatar
2 votes
0 answers
93 views

Can D-Wave presently solve real-world problems that conventional computers cannot solve?

There are number of threads on this site about the ability of QCs solving real-world problems (see for example What are the practical applications of quantum computing in engineering by the year 2030?,...
Max's user avatar
  • 85
0 votes
1 answer
82 views

Is there any programming project that implements one quantum error correction code or demonstrates it?

A gigantic list of all the error correction codes(Classical Domain, Quantum Domain, Classical-quantum Domain), see https://errorcorrectionzoo.org/all There are lots of quantum error correction code. ...
138 Aspen's user avatar
  • 141
1 vote
1 answer
102 views

Create qnode with density matrix on pennylane

I'm using pennylane. What I want to do is Create a qnode with the 2*2 density matrix of a single qubit one. It has the parameter as phi Given density matrix: $$\...
Donguk kim's user avatar
0 votes
1 answer
102 views

Design a full adder to add two 4-bits integer and measuring on 4 quantum states

I am trying to implement a full adder with minimum of 8 qubits to add two 4 bit integers. Integer 1 will be added on q[0-3] while integer 2 will be added on q[4-7]. The output will be measured on q[0-...
Bob's user avatar
  • 1
0 votes
1 answer
198 views

Cannot import tensorflow_quantum module in Colab

I was trying to install the tensor flow quantum module using the one given in their official website but it is showing these errors while installing. ...
Siddharth Sethi's user avatar
2 votes
1 answer
112 views

Problems trying to plot the classical Fisher information with Pennylane

I'm working with pennylane. My goal is to plot CFI(Classical Fisher Information)with following quantum state. With the above equation I set gamma as 0. Then It becomes: If gamma is not equal to zero,...
Donguk kim's user avatar
3 votes
1 answer
55 views

Python code for D-Wave Annealer

In the below screenshot, I am aware of resolving the issue by reducing num_reads as the annealing time is exceeding my allowance. Although it works, my question ...
Sup's user avatar
  • 231
1 vote
1 answer
96 views

If Statement OpenQasm 2.0

in the documentation for OpenQasm 2.0 it says one can use an if statement like so: if(c_reg==int) Quantum Operation. However, I would like to execute the following: ...
Sam's user avatar
  • 31
2 votes
1 answer
236 views

New mode of Quantum and - or gate

I’m Aurelio, a computer engeneering student and I would propose a new quantum gate that maybe could be interesting to implement and use. I don’t know if such idea is already known but I have not found ...
Aurelio Marotta's user avatar
1 vote
2 answers
57 views

How do I find out which packages of qiskit are compatible with eachother?

In particular I try to find out which version of qiskit is compatible with which version of qiskit-ibm-runtime. In my setup ...
qcabepsilon's user avatar
1 vote
0 answers
106 views

Drawing circuit in pennylane

I am trying to draw the circuit in pennylane but even after my hours of trying I am completely unsuccessful. Below is my code. Any little guidance of yours can help me a lot. ...
Manu's user avatar
  • 53
1 vote
0 answers
86 views

Qiskit spends a lot of time on method acquire of thread.lock objects

I am trying to run VQE algorithm with Qiskit, using the following code: ...
QNA's user avatar
  • 141
1 vote
1 answer
21 views

The Qiskit code's output doesn't seem to be what I expected

...
Anees Ur Rehman's user avatar
1 vote
0 answers
37 views

How to add a value of -1/2 on the amplitude of a quantum state?

I have a quantum state which is in $ \cos(c*f(x) + \pi/4) |0\rangle + \sin(c*f(x) + \pi/4) |1\rangle$ by using bunch of RY gates. Now I want to measure the probability of getting the state at $|1\...
Another Random Guy's user avatar
2 votes
1 answer
51 views

What are the theoretical minimum times for quantum and classical logic gates?

I'm interested in better understanding the ultimate limits on how fast quantum and classical logic gates can be performed. Based on principles like the time-energy uncertainty relationship, there ...
Saul_better's user avatar
0 votes
1 answer
126 views

Cannot Download TensorFlow Quantum

Hey Quantum Computing community, I cannot get TensorFlow Quantum to work even though I am using pip install tensorflow-quantum I have TensorFlow already on Visual ...
Sid Meka's user avatar
1 vote
3 answers
206 views

Quantum Circuit not drawing?

I have coded this from a tutorial: ...
Sid Meka's user avatar
0 votes
1 answer
31 views

Displaying the circuit diagram associated to a circuit in Q#+Python

I am learning the Q# language, and my script is in Python (I am using the online Azure interface). I created an example quantum circuit on three qubits: ...
Marco Fellous-Asiani's user avatar
2 votes
1 answer
66 views

Does subtraction circuit have a class like full or half Carry adder circuit in qiskit? one subtraction circuit code-example in qiskit?

I need a subtraction circuit to calculate Laplacian in edge processing, but I didn't find any class in qiskit.Do I have to write the code myself?
f h's user avatar
  • 21
1 vote
0 answers
35 views

Converting Qubits to +-1/2 Spin System for Expectation Value Calculation

I have a quantum system that consists of spin states with eigenvalues of +-1/2. However, in quantum computing, qubits are typically represented as states |0⟩ and |1⟩. I want to calculate the ...
Hakan Akgün's user avatar
0 votes
1 answer
300 views

ImportError qiskit_ibm_runtime

When I try to import qiskit_ibm_runtime I get the following error: ...
Hakan Akgün's user avatar
0 votes
1 answer
94 views

Eigenstates differ between Qutip and Quspin

I am currently trying to adapt a code working well with Qutip to Quspin to optimize it. I managed to create what I believe are the same systems with both libraries, but I don't get the same ...
sebastien finor's user avatar
0 votes
0 answers
36 views

Tf.einsum vs matmul for computing density matrix from a set of Cholesky decomposed matrices

I am trying to construct a density matrix of shape 256x256 from a set of T matrices. These T matrices are all Cholesky-decomposed matrices. But I am not sure if the ...
Dimitri's user avatar
  • 53

1
2 3 4 5
31