Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [programming]

For questions relating to the process of assembling quantum programs that can be executed on a quantum computer. For questions using or about a specific programming language, consider using a more specific tag

Filter by
Sorted by
Tagged with
2
votes
2answers
74 views

How to prepare a specific initial state of three qubits?

I would like to prepare the following initial state for variational quantum algorithms: $$ \sin\theta_1 \sin\theta_2 \sin\theta_3 |000\rangle + \sin\theta_1 \sin\theta_2 \cos\theta_3 |001\rangle + \...
4
votes
1answer
59 views

Resources in Spanish to start learning quantum computing and quantum programming (Qiskit)

I’m starting an engineering degree in computer systems and I’m starting to get really interested in quantum computing. First of all, I don’t know where or how to start and I would really like to learn ...
3
votes
0answers
41 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 ...
1
vote
0answers
40 views

'ERROR: QasmSimulator: Circuit cannot be run using available methods.'

I used the following code. Can anyone say what that error is about? ...
2
votes
0answers
44 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 ...
1
vote
1answer
34 views

ResetAll with adjoint auto

...
3
votes
3answers
84 views

How to plot custom gate labels in Qiskit?

How can I create a custom gate in qiskit that is plotted using latex formatting (or another type of formatting)? For example the following code generates a circuit diagram ...
1
vote
3answers
89 views

How many classical registers are there on (IBM) quantum computers?

I have a circuit where I only use 3 qubits but need to utilize hundreds of classical registers. My questions are: what is the maximum number of classical bits on the current IBM Qs? What is the ...
2
votes
2answers
99 views

How to unpickle a Result object returned by an IBMQ experiment?

I have executed an experiment using IBMQ and receive a Result object. I am writing the ASCII repr of the result with f.write(res)...
-2
votes
1answer
78 views
2
votes
1answer
72 views

Newbie Project: Calculate a Mersenne Prime with Quantum Computing

I am new to the quantum world and wondering the bounds of which the technology is at the current state of the art: specifically in computing prime numbers. I would like to, if possible, create a ...
2
votes
3answers
142 views

How do I start as a quantum computing programmer?

How do I learn Q#? What languages should I know prior to learning Q#? How do I get started with quantum computing?
2
votes
0answers
47 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: <...
1
vote
1answer
53 views

Backend Warning: The skip Qobj validation does not work for IBMQ provider. Disable it

I am using QAOA to solve the max-cut problem. On my machine, 10 qubits already takes a minute or two to simulate. I'm hoping that the ibmq-qasm-simulator could simulate 32 qubits faster than my laptop ...
1
vote
1answer
37 views

Question on using the Collect2qBlocks() and ConsolidateBlocks() optimizations

I'd like to run the optimizations from Qiskit's level 3 transpiler pass on some example programs for benchmarking, but when I try to include the Collect2qBlocks() and ConsolidateBlocks() passes I get ...
3
votes
2answers
114 views

Big Endian vs. Little Endian in Qiskit

I've noticed that Q# favors Little Endian. Meaning that most operations are designed for this type of encoding. Is is it the same with Qiskit?
2
votes
1answer
46 views

How do these alternative Q# algorithms produce the same set of Bell states?

In the "Superposition" Microsoft quantum katas (https://github.com/microsoft/QuantumKatas/blob/master/Superposition/ReferenceImplementation.qs) the solution for Task 7 looks like this: ...
1
vote
1answer
48 views

How to understand run_algorithm() inputs in qiskit

I'd like to better understand the Max-Cut algorithm from the qiskit tutorials. Particularly, the run_algorithm function inputs. The inputs are two dictionaries, but I can't find any documentation or ...
5
votes
2answers
88 views

What is the point of building arithmetic circuits in a quantum computer?

My question simply is the following: is there any interests in building arithmetic circuits such as adders or multiplier on a quantum computer? I'm asking this because it seems that classical ...
1
vote
0answers
15 views

Error message for Classical Probability coding in Python

strong textHi guys I am doing a coding exercise for probabilities in vectors. Exercise 2 (1 point). As you recall, we may also write the probability distribution as a stochastic vector p⃗ =[p0p1]p→=...
3
votes
1answer
79 views

(Quantum Computing/Machine Learning) Estimate of the absolute value of the probability amplitude of |0⟩ in the superposition?

You are given a source of an unknown qubit state. You make measurements in the computational basis, that is, your measurement is $\{|0\rangle \langle0|,|1\rangle \langle 1|\}$. You observe that you ...
1
vote
2answers
109 views

Software for Quantum Computing

From what I read classical computing evolved so quickly because of the funding-applications cycle. Even though the cost to make denser IC's was increasing rapidly, the applications were also getting ...
0
votes
1answer
34 views

Q#: dynamically assigning (or updating) multidimensional Qubit arrays

Question: how to dynamically assign qubits to variables? e.g., say I want to represent a matrix of qubits: $matrix := \{\vec{v_1}, \vec{v_2}, ..., \vec{v_r}\}$ where each vector consists of $dim$ ...
1
vote
2answers
64 views

Q#: How to setup a project correctly (on Linux, command line)?

When setting up projects with Q# I used to start with the given Quick-Starting Guide. Following the tutorial I am able to setup the example problem and the program works well. However, there seems to ...
0
votes
0answers
73 views

Why does Qiskit swap gate accept registers, but cswap doesn't?

In Qiskit, I am trying to perform controlled-Swap (cswap) of two registers, but an error occurs: ...
-2
votes
2answers
120 views

The most important quantum question , how to force a superposition qubit to collapses to an exact value? [closed]

Note: forcing a superposition qubit to collapses to 1, means cancel the other value 0 to get 1 appear Question details step by step: ...
0
votes
2answers
93 views

How to reset classical register on QISKit

I want to do a feedforward on a quantum circuit using the simulator of Qiskit. For example, measure qubit_1 to bit 1 and do some operator on qubit_2 if the result of measuring qubit_1 is 0 and if ...
2
votes
1answer
33 views

Hamming with prefix oracle

I'm doing the Q# quantum katas and I'm stuck on an oracle in the Deutsch-Josza algorithm katas. Let $|x\rangle=|x_0x_1\dots x_{n-1}\rangle$ be a qubit array and $r$ be bit string of $k\leq n$. The $...
0
votes
3answers
114 views
1
vote
0answers
31 views

Encoding Binary Data into Quantum Basis

I am working on implementing a paper on QNNs. I have successfully been able to resize a MNIST digit to be able to meet the size of quantum circuit. But I am not clear of how to convert the resized ...
2
votes
0answers
51 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 ...
3
votes
0answers
18 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
1answer
81 views

How to do randomised benchmarking for non-Clifford gates on Qiskit?

For my summer research internship I'm looking to randomized benchmark (RB) non-Clifford gates for a single qubit. Since I found out that Qiskit ignis allows for the RB of Clifford gates, naturally I ...
1
vote
0answers
61 views

Having trouble communicating with the IBM Q Experience REST API

I have started using IBM's Q Experience and I am trying to obtain an access token in order to communicate with the REST API. I understand that I can use my API token to obtain authorization by sending ...
2
votes
0answers
39 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 ...
1
vote
2answers
61 views

How to represent $|+\rangle$ in Python?

I am using state vectors and operator matrices to test out my knowledge in a Python program. How would I represent the state $|+\rangle$ in Python? I want to then perform several operations in a ...
3
votes
0answers
56 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 ...
3
votes
2answers
480 views

How to compute the inverse of an operation in Q#?

I want to implement amplitude amplification using Q#. I have the operation $A$ that prepares my initial state and I need to compute $ A^{-1} $ to implement the algorithm. Is there an easy way to do ...
3
votes
1answer
118 views

Implementing a complex circuit for a Szegedy quantum walk in qiskit

Problem definition I'm implementing a quantum circuit in qiskit for a Szegedy quantum walk, (reference, Fig 21.). It uses two registers of dimension $N$ ($N=3$) each one. The challenges I'm facing ...
3
votes
1answer
71 views

How to find a common eigenstate of commuting operators?

I have multiple different operators in matrix form and I need to find their common eigenstates. The challenge is that the common eigenstate is in a superposition of multiple states and isn't just a ...
2
votes
1answer
49 views

Eliminating a term of a superposition state

Is there a way of eliminating a term of a superposition state? Let's say I have the state $$\frac{1}{\sqrt 2}|00\rangle + \frac{1}{2}|01\rangle + \frac{1}{2}|10\rangle$$ What operation would I do to ...
8
votes
2answers
177 views

How to program a controlled Hadamard-Hadamard gate?

I'm trying to program a controlled gate as the figure below in Qiskit. Should it be sufficient to separate and control individually the Hadamard gates?
2
votes
1answer
40 views

Perform quantum gate operations using state vectors and matrices

I am getting confused as to how to perform gate operations using matrices and am hoping someone will help me walk through this example. Say I want to perform a Pauli-X gate on the 3rd qubit in a 3-...
3
votes
0answers
52 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
1answer
100 views

Plotting Bloch sphere in QuTiP

Is there anyone who reproduced the Bloch sphere given in the paper QuTiP: An open-source Python framework for the dynamics of open quantum systems by J. R. Johansson, P. D. Nation, Franco Nori? I am ...
4
votes
1answer
191 views

About the Qiskit draw function

Where does Qiskit put the rendered figure created by circuit.draw(output='mpl')?
3
votes
0answers
107 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
1answer
210 views

Can't draw figures with Qiskit in Visual Studio

I'm using Qiskit in Visual Studio 2019. I want to draw quantum circuits, but it only shows their sizes with text instead of figures. The output on the interactive window is like this. ...
4
votes
1answer
48 views

How to see the QASM code corresponding to compiled Q# function?

I'm learning Q#. Is there any way to see the QASM code of a Q# function I write, the same way I can see the disassembly of a C# function?
5
votes
1answer
202 views

How to calculate the fidelity of a certain gate of a IBMQ device in Qiskit using randomized benchmarking/tomography?

For example, I want to calculate the fidelity of a 1-qubit and 2-qubit gates (similar to the result shown in figure 2 in this paper). Is there any way to do that in Qiskit? I've gone through the ...