Skip to main content

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
16 views

Reference Implementation for Circuits in 1801.01081 [HIGH PERFORMANCE QUANTUM MODULAR MULTIPLIERS]

I am currently working on my own quantum arithmetics project and I cannot seem to get my version of Fig. 5 and Fig. 6 from https://arxiv.org/pdf/1801.01081 to work. (And it's not because of the ...
LukasM's user avatar
  • 53
1 vote
1 answer
15 views

generate_preset_pass_manager and Sampler API usage in IBM-Qiskit

I am trying to migrate my code to the latest version of qiskit>=1.0. Below is the sample code I made using the ...
Manu's user avatar
  • 89
1 vote
0 answers
29 views

Reducing Estimator time for calculating expectation values

I have a circuit with $2N + 1$ qubits and with depth $2t + 2$, where $t$ is essentially the number of trotter steps, or the number of times a fixed block of gates repeats itself in the circuit. After ...
Soumyadeep sarma's user avatar
1 vote
0 answers
29 views

Why is my mutual information negative in Python, and how can I accommodate that?

I'm calculating the mutual information between two 1 qubit subsystems in a quantum state using Python. Theoretically, mutual information should always be non-negative. However, I'm encountering very ...
Ceasar's user avatar
  • 47
1 vote
1 answer
51 views

How to save and retrieve results of m3_mitigator.cals_from_system API

I am stuck with a problem while trying to run the code on quantum hardware. What I have learned through video lectures is that you can save the job id when you run job on hardware and from job id ...
Manu's user avatar
  • 89
0 votes
1 answer
41 views

Determine if an operator is in the stabilizer group

I was working on error correction algebraically but I now want to use some computational method. I have a set of generators of a stabilizer group which I represent as a rectangular matrix over $\...
池田隼's user avatar
1 vote
1 answer
81 views

Finding the violating bound of CHSH using the first level of NPA hierarchy on MATLAB

I've been trying to implement the NPA hierarchy in MATLAB using CVX library. To start off with, I thought of finding the bound of CHSH using the first level of NPA hierarchy. I represented my gram ...
Karthik Nambiar's user avatar
1 vote
0 answers
37 views

SparsePauliOp' object has no attribute 'primitive_strings' warning for a max-cut problem using QAOA and MinimuEigenOptimizer

I am using Qiskit to implement QAOA for a max-cut problem. I am using inbuilt qiskit implemetation of QAOA and, the MinimuEigenOptimizer. The MinimuEigenOptimizer.solve() throws the warning. ...
Atharva Hingane's user avatar
-1 votes
0 answers
31 views

Building QRNN Model Using Qiskit

I'm trying to build a QRNN model as described in this paper (arxiv). The code that I have been able to design so far is as follows: ...
KAUSHIKI's user avatar
-1 votes
0 answers
19 views

Plotting problem

Hello, I am having trouble plotting the results of Grover's algorithm. I tried multiple attempt but could not get what is wrong with it. I don't know what else I can do with it, in some cases I get an ...
Early Jun Tagsip's user avatar
1 vote
0 answers
55 views

How can I become a better quantum software developer? [closed]

How can I become a better quantum software developer? I would like to open source program and such. I'm dedicated and consistent. I'm learning Qiskit right now and I'm planning to learn rust. How ...
Hope Alemayehu's user avatar
-1 votes
0 answers
16 views

IBMBackendValueError: 'Number of circuits, 1024 exceeds the maximum for this backend, 300)'

I'm trying to train my hydrib network with real quantum hardware but I get this error: IBMBackendValueError: 'Number of circuits, 1024 exceeds the maximum for this backend, 300)' ...
Michele Morelli's user avatar
0 votes
1 answer
79 views

How does qiskit implement a given superposition in the actual quantum computer?

My question is phrased in 2 parts: Is there a quantum circuit to implement the following 4-qubit state: $$\frac{1}{2}(|1000 \rangle + |0100 \rangle + |0010 \rangle + |0001 \rangle)$$ When we use the ...
Soumyadeep sarma's user avatar
2 votes
0 answers
71 views

Is there a theoretical method to achieve a positive semi-definite density matrix in QST?

The problem of encountering negative eigenvalues in the density matrix during Quantum State Tomography (QST) is well-explained in this Quantum Computing Stack Exchange post. However, I am seeking ...
Ceasar's user avatar
  • 47
0 votes
0 answers
28 views

Qiskit's Integer Comparator

Does the IntegerComparator from qiskit.circuit.library works fine, or am I doing something wrong in understanding it's working? I'm working with this simple ...
Another Random Guy's user avatar
0 votes
2 answers
77 views

partial trace of a unitary matrix over the zero state of ancilla qubit

I was going through a paper in which it is written that $\tilde{A}$ is the partial trace of $U$ over the zero state of the ancilla space. https://arxiv.org/pdf/2205.00081 \begin{equation*} U|\phi\...
Manu's user avatar
  • 89
-3 votes
1 answer
84 views

Can a math major get into quantum computing? [closed]

I was wondering if by doing a math major I could get into quantum computing and no, doing a degree in physics is not an option sadly. I also want to know if being a software engineer would be a better ...
Quantum PT's user avatar
1 vote
1 answer
75 views

Different notations for measurement gates: what is meant by $0$ after a measurement?

I am relatively new to quantum computing I am confused with different notations for measurement gates in quantum computing as shown below https://arxiv.org/pdf/2205.00081 I really donot understand ...
Manu's user avatar
  • 89
0 votes
1 answer
34 views

inverse function in qiskit not generating inverted circuits

I am struggling with the inverse function of qiskit. https://www.youtube.com/watch?v=SiPF2SVb7xc The inverse function works for the example shown in the video but it is not working for the circuit I ...
Manu's user avatar
  • 89
2 votes
0 answers
34 views

Creating a cross resonance pulse in qiskit and running

I have a simple circuit in qiskit which is designed to exploit a $ZZ$ interaction between qubits: ...
idislikecoding's user avatar
1 vote
0 answers
33 views

How to run Shor's algorithm on real quantum hardware with Qiskit?

I am trying to factor 15 with Shor's algorithm and want to find the period for $a^x$ mod $15$ on real quantum hardware with Qiskit. I took the code from the Qiskit Textbook and managed to run it on ...
quantum_interested's user avatar
0 votes
0 answers
30 views

(PyTket) Trouble with RoutingPass.apply() running forever -- seems to hang

I am attempting to route a circuit with 3 qubits, each connected via a 2 qubit gate that is defined using the Unitary2qBox. This sequence is repeated several times. So there are 3 choose 2 gates or 3 ...
Jack Ethridge's user avatar
0 votes
1 answer
31 views

Getting a Hermitian operator from a Quantum circuit, and taking its expectation value

I have a circuit $C$, which acting on a state $|\psi \rangle$ is equivalent to a Unitary $U$ acting on the state: $$C(|\psi \rangle) = U|\psi \rangle$$ Now, this circuit is just a Hamiltonian ...
Soumyadeep sarma's user avatar
0 votes
1 answer
26 views

Reading QuantumClifford.jl MixedDestabilizer state from a .csv file

This is more of a coding question, related to the Julia package QuantumClifford.jl. Hopefully this is the right place to ask. I am trying to prepare a specific stabilizer state, and in order to not ...
momiamfine's user avatar
2 votes
1 answer
49 views

General number of classical bits: recycles qubits

I am trying to write a Qiskit routine to perform qubit recycling for Shor's algorithm. This is a procedure by which the M-bit control register is replaced by a single quantum register, and the ...
Robert Singleton's user avatar
0 votes
0 answers
39 views

Tests of entanglement between one and many qubits

I have a 5-qubit state $|\psi \rangle$, which has a physical interpretation that the middle qubit is the "impurity" with spin $s_{imp} = 1/2$. The rest 4 qubits highlight the presence of ...
Soumyadeep sarma's user avatar
2 votes
2 answers
81 views

Can non-linear operations be implemented as a circuit on a quantum computer?

Suppose I have a Quantum circuit, which gives an output state $|\psi \rangle$ let's say. I wish to obtain the reduced density matrix by tracing out subsystem B, i.e. $\rho = |\psi \rangle \langle \psi ...
Soumyadeep sarma's user avatar
1 vote
0 answers
27 views

Error code 1217: "Session has been closed"

I am currently studying algorithms related to VQA. I have built a circuit to calculate the cost function and optimized it using a classical optimizer. During the initial optimization iterations, ...
MrEightL's user avatar
2 votes
0 answers
36 views

Are qiskit and qiskit aer identical or very similar in syntax?

I can't afford a IBM full access account, and can't learn an entire programming language with only ten minutes of run time a month. Are the qiskit lessons on YouTube/ github transferable given that I ...
diddyDANK's user avatar
2 votes
1 answer
53 views

Optimizing SymPy Implementation of prime factorization in form of QUBO

I'm trying to reproduce a paper on Prime Factorization. This paper converts the problem into a QUBO form, which then we can map it to an Ising Minimizer. I've basically done everything, and I've ...
Amirhossein Rezaei's user avatar
1 vote
2 answers
165 views

How to implement a quantum multiplier in Qiskit 1.0

I am looking at the homepage of Qrisp, and they have an example of how to multiply two registers with Qiskit: ...
Amir Naveh's user avatar
0 votes
1 answer
40 views

Obtaining and Applying XX and ZZ Parity in Stim for Controlled Paulis

I am attempting to perform a CNOT between two surface code qubits in Stim, based on this paper by Daniel Litinski and Felix von Oppen. The CNOT they perform is shown in the figure below (Figure 3 from ...
decaf's user avatar
  • 25
0 votes
1 answer
34 views

Error 400 on Variation Quantum Algorithm

As the title suggests, I am trying to optimize a cost function in a VQA (Variational Quantum Algorithm) code using a classical optimizer to obtain the best parameters. In my initial optimization ...
MrEightL's user avatar
1 vote
1 answer
85 views

For CHSH game, why does the mathematica program gives 75% as the best winning rate when sharing 2 EPR pairs?

In the CHSH game , the optimal quantum winning rate should be approximately 85% when Alice and Bob share the EPR states and this winning rate holds the same when they share arbitrarily many EPR states....
qmww987's user avatar
  • 211
1 vote
1 answer
41 views

How can I control multiple gate at once (qiskit)

I have the following circuit in qiskit: ...
Clamore's user avatar
  • 13
2 votes
1 answer
97 views

Finding Eigenvectors of a Unitary in a Quantum circuit

I have a unitary gate $U$, which is applied on some $n$-qubit quantum circuit ($n=7$ for my scenario). I wish to find the $n$-qubit state, which is the eigenvector (and possibly eigenvalues) of this ...
Soumyadeep sarma's user avatar
1 vote
2 answers
93 views

Hamiltonian Simulation: What's the meaning of t in $\exp(iAt)$?

My main goal is to find eigenvalues of some hamiltonian matrix $A$. When implementing Quantum Phase Estimation, I need to provide my circuit with informations about $A$. From what I have seen so far, ...
Max's user avatar
  • 13
1 vote
0 answers
48 views

is this a novel approach to visualization of qubits?

I am currently working on my Bachelor's Thesis and would love to hear your opinions about my project. The idea is to visualize the Binary parts of complex qubit states. White lines represent binary 0, ...
Mathias Pichler's user avatar
1 vote
1 answer
26 views

qiskit_aer.aererror.AerError: 'unknown instruction: ccry'

I'm trying to use qiskit_aer_gpu 0.14.2 with qiskit 1.1.0 I defined the class CCRYGate() y another script gate.py ...
ozark's user avatar
  • 31
1 vote
1 answer
29 views

having REPEAT with circuit append

In Stim's domain specific language, you can reapetdly add a code clock, as following REPEAT 10 { # code block } Is there a way to add that with ...
reza's user avatar
  • 11
2 votes
2 answers
57 views

The result of qiskit calculating T-depth and its calculation method

I have encountered doubts when using qiskit to calculate T-depth. I am not sure whether it is a problem with the way the code is written, or I am still a little vague about T-depth, so I would like to ...
Dona's user avatar
  • 21
0 votes
1 answer
53 views

Qiskit error: too many subscripts in einsum when calling DensityMatrix.evolve(Operator)

Minimal details: My density matrix is of dims=(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)). I want to use DensityMatrix.evolve(qc) to evolve this DM with a quantum circuit qc. Below is the code ...
tomek's user avatar
  • 137
0 votes
1 answer
45 views

How to understand the matrix representation of the Toffoli produced by qiskit?

I would like to ask about the results of running the Toffoli gate matrix and circuit diagram on colab Possible reasons for inconsistent results with the following correct matrix results. I would also ...
Dona's user avatar
  • 21
2 votes
1 answer
35 views

How to apply gates on a subspace of a superposition of qubits?

Let us say that I have the state $a|00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$. I wish to apply a one-qubit unitary (a $2\times2$ matrix) U on the subspace spanned by $|01\rangle$ and $|10\...
Soumyadeep sarma's user avatar
0 votes
1 answer
53 views

What is TICK layer in stim

I'm trying to simulate a circuit in stim and I get the following error in my stack trace. ...
Palash Goiporia's user avatar
0 votes
2 answers
777 views

Where do I create my first circuit?

I want to get the result of this code: ...
Ritvik Chowdary's user avatar
4 votes
3 answers
286 views

Solving quantum equation using qiskit

I am struggling to solve the mathematical equations using qiskit in the below paper. https://arxiv.org/pdf/2205.00081 The mathematical equation I tried to solve is below: I tried solving it using ...
Manu's user avatar
  • 89
1 vote
1 answer
93 views

Pauli Strings on the same qubit?

I am working on solving a Max-Cut problem using fewer qubits via efficient encoding methods of more classical information onto a single qubit.Using the method of The original problem has the ...
Another Random Guy's user avatar
1 vote
0 answers
29 views

Custom classical control in qiskit

I'm generating a qiskit circuit and want to add an X gate to a qubit if the sum of some previous measurements modulo 2 is equal to 1. In cirq, I could just use a sympy expression that would look ...
Palash Goiporia's user avatar
0 votes
0 answers
17 views

Particle number expectation value in QuTip

I am learning now to use QuTiP by going through their documentation site. I am trying to understand what does the argument - particle number expectation value in thermal density matrix do? How does it ...
CuriousMind's user avatar

1
2 3 4 5
34