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.

206 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
12
votes
0answers
190 views

Does the Curry-Howard correspondence have a quantum-specific type system?

In Wikipedia we can read that the Curry–Howard correspondence is a correspondence between formal proof calculi and type systems for models of computation. In particular, it splits into two ...
7
votes
1answer
216 views

Gradient boosting akin to XGBoost using a quantum device

I am currently trying to implement a boosting algorithm akin to XGBoost with a quantum device. The reason is that I want to make use of a quantum device to train weak classifiers. However, as far as I ...
6
votes
0answers
76 views

AWS Braket Backend for Qiskit?

Is there a working AWS Braket backend provider for Qiskit 0.29 that can be used with the MinimumEigenOptimizer interface? The qiskit-aws-braket-provider package is unfortunately not working.
5
votes
1answer
65 views

Enforcing a particular layout mapping in Qiskit

I would like to ask how to set a particular layout during transpiling. I guess that the layout can be set by the initial_layout parameter in the transpiler. However,...
5
votes
1answer
152 views

Two qubit gate decomposition in using Qiskit

I am writing some python code to be able to optimise the total error in two qubit gate decomposition. I am using the Qiskit module qiskit.quantum_info.synthesis.two_qubit_decompose My question relates ...
5
votes
0answers
111 views

Inequality constraints on D'Wave (using PyQUBO)

Inequalities cannot be directly converted into a qubo form 0⩽ Expression ⩽ N We can introduce a slack variable and convert it to an equality problem: ⟹ Expression + s = N where: s ∈ Z, s ∈ [0,N] Since ...
5
votes
0answers
351 views

How to build a quantum circuit representing the Ising Model?

Can someone explain to me how to build a quantum circuit representing the Ising Model? I just want to understand how to represent the Ising Model for the purposes of quantum state label classification....
4
votes
0answers
54 views

Extract the Crosstalk noise of a circuit in Qiskit

I'm new to Quantum Computing. How to extract the cross-talk noise of a quantum circuit using qiskit? Can someone provide an example code for this?
4
votes
1answer
60 views

Trying to simulate Weak Value Amplification using QuTiP

Weak Value Amplification is a procedure in which one consider a bipartite Hamiltonian of the form $H = g A \otimes B$, where $A$ is called system, $B$ is called meter and $g$ is the extremely small ...
4
votes
1answer
200 views

Simulation of a helium molecule using Qskit

I am trying to compute the ground state energy of He-He using VQE. For this purpose I have utilized Qskit and have written the following script: ...
4
votes
0answers
73 views

Run VQE for parametrized quantum circuit with ancilla qubits

Let's say we have the following circuit (picture and code shown below), and now the $q_0$ is an ancilla qubit. If the system of interest has only two qubits, Is there a way to use only $q_{1,2}$ as my ...
4
votes
1answer
263 views

Is there a function in Qiskit to measure tensor products of Pauli operators?

Is there a function in Qiskit similar to this function in Q# which measures strings of Pauli operators applied to different qubits?
4
votes
0answers
152 views

General mixed integer linear programming problem with quantum computers

I was wondering if anyone had a sample code for running a general MILP problem. I saw some coding for some very specific problems and I thought they were kind of far away from what we needed. $$ \text{...
4
votes
0answers
89 views

`execute()` hangs and eats memory

Used memory-profiler to check why I get memory spikes in what I though were small circuits. The circuit itself is constructed using ...
4
votes
0answers
90 views

Bell State 11 not working for parity curve

I am currently writing a script to automate the creation of parity curves for a 2 qubit bell state and then calculate fidelity and proving entanglement from that (inspired by this paper). It was going ...
4
votes
0answers
88 views

Grover search for basis states with complex coefficents and multiple marked states

I tried to run Grover's search for basis states with complex coefficients, including the marked basis (complex coefficients because the states are obtained from inverse QFT), but it could not amplify ...
3
votes
0answers
70 views

How exactly does the QuantumCircuit.decompose() method work?

From what I can understand from the source code, the circuit is converted into a DAG before the decomposition transpiler is performed onto the DAG circuit. How does converting to a DAG circuit help us ...
3
votes
1answer
126 views

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

I am running a VQEUCCFactory for H2 on a real hardware device. ...
3
votes
0answers
189 views

In Cirq, how do you display circuit diagrams that are "prettier" than the ones displayed by default?

This is a duplicate of a question that was asked on the Cirq issues page. I'm duplicating this question to increase it's visibility. The standard way to print circuits in Cirq is by calling ...
3
votes
0answers
102 views

Transpiler fails after 1000 iterations

I'm transpiling a set of quantum circuits using ibmq_5_yorktown. However, as the number of circuits gets larger, it shows me the following error message: ...
3
votes
0answers
33 views

Implementation of the "Quantum Verification of Matrix Products" algorithm

I would like to implement a Quantum Verification of Matrix Products, using Ambainis OR Burhman algorithm but I don't know how to start. There isn't much documentation about it, and no circuit in the ...
3
votes
0answers
134 views

Implemented QAOA returns wrong result

I try to apply QAOA algorithm to find minimal energy state of the Hamiltonian: $H_A = \frac{1}{2}\sigma_z^1 + \frac{1}{2}\sigma_z^1\sigma_z^2$ It is expected that with p=2 my variational should ...
3
votes
0answers
128 views

How can I measure a qubit on a generic axis on Qiskit?

I'm trying to prove Bell's inequality by following the one made by Wigner, that is: $P(+_a,+_b) \le P(+_a,+_c) + P(+_c,+_b)$ And that this proof is NOT satisfied for angles between the various axes $\...
3
votes
0answers
50 views

D-WAVE QUBO Matrix Form

I am trying to write down this problem (friend/enemy graph) in a polynomial matrix form in order to understand quantum annealing better, but it seems like the problem should actually be split into ...
3
votes
0answers
61 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 ...
3
votes
0answers
43 views

Simulating a Quantum Network over a real Classical Network Using Simulaqron

I'm trying to simulate a quantum network over a real classical network using the Simulaqron framework. I know the documentations says this is possible but I am having trouble finding examples of how ...
3
votes
1answer
158 views

VQE jobs do not appear in queue

I am trying to calculate the ground state energy of some simple molecules using 'MolecularGroundStateEnergy' tools in qiskit. When I run the calculations for very small molecules (e.g. H2, HeH+) the ...
3
votes
1answer
168 views

Installing Q# in jupyter

I have followed all steps described in https://docs.microsoft.com/en-us/quantum/install-guide/qjupyter But I am unable to get through part 3. It is showing syntax error in Python terminal in Jupyter ...
3
votes
1answer
164 views

Implementing QFT

I would like to know if there is a way to: Implement Quantum 'Functions' e.g the QFT of QFT* containing several single-qubit operations? Implement such operations on an arbitrary number of qubits and ...
3
votes
0answers
58 views

Does anyone have any really good quantum computing illustration packages or frameworks for visually teaching various aspects of QC?

I'm focusing on training non quantum physics / non math majors - software engineers to be specific (and the interested senior executive that wonders by) and am bewildered by the lack of adequate ...
3
votes
0answers
129 views

How does batching work in the optimizer loop of the VQC algorithm in Qiskit Aqua?

I've playing around with a binary classification problem with a dataset of size 1000 examples and 5 features. I'm using the VQC algorithm from the Qiskit package the that uses a feature map and a ...
3
votes
0answers
335 views

Grover's search for solving TSP

Consider the modified version of the Traveling Salesman Problem where you are searching for a path of length less than some $k$. We can solve this problem using Grover's search where we encode each ...
3
votes
0answers
74 views

How to define initial state $\rvert \Psi(0) \rangle \equiv \rvert 1, -1 \rangle \otimes \rvert 0 \rangle_{\text{cav}} $ of a system in QuTiP?

Say, we have a $\require{mhchem}\ce{^87Rb}$ atom having an electric dipole transition on the $D_{1}$ line and we have two hyperfine ground states, one on $F = 1$ and one on $F = 2$ level. So, we take ...
3
votes
0answers
22 views

Synchronous Interactions Between Quantum and Macroscopic Systems

Synchronous Interactions Between Quantum and Macroscopic Systems Lester Ingber This project calculates synchronous quantum systems and macroscopic systems with well-defined interactions. I would ...
3
votes
0answers
61 views

How to add states on the Bloch sphere from a master equation?

Can you please help me to find an answer to this question: I am using qutip for the study of quantum systems. suppose I have calculated the solution of the master equation using the ...
3
votes
0answers
135 views

Measurement inconsistency in Qiskit

I am using Qiskit in an algorithm. In the end, I am measuring exactly a register of 4 qubits but the histograms show states with 5 qubits. This is the code I used: ...
3
votes
0answers
73 views

How to calculate the $r^{\text{th}}$ digit of $\sum ^{j−1}_{p=i}d^p_{\pm k}$ using PyQUBO?

I am going to implement "turn circuit encoding" method of Coarse-grained lattice protein folding on a quantum annealer(Babej, Ing & Fingerhuth; 2018) using PyQUBO to run on the DWave qbsolv ...
3
votes
0answers
96 views

What are reasonable noise/dephasing parameters for QuEST to emulate state-of-the-art quantum computers?

The QuEST code allows for simulation of quantum computers taking dephasing and depolarizing noise into account via one and two qubit dephasing and depolarization. What are realistic parameters for ...
3
votes
0answers
542 views

Qiskit Python program cannot connect to QE API

I am just getting started with Qiskit and IBM Quantum Experience, so please forgive my newby question. I have a IBM Quantum Experience account and I generated an API token. I used the generated ...
2
votes
0answers
42 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
56 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
82 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
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
49 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
49 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
41 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
71 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
88 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
76 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
120 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 ...

1
2 3 4 5