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

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

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
30 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
19 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
60 views
1
vote
0answers
23 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
14 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
52 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 ...
-2
votes
0answers
62 views
1
vote
0answers
44 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
31 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
53 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
51 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
461 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
70 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 ...
4
votes
1answer
59 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
140 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?
1
vote
1answer
28 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-...
2
votes
0answers
46 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
30 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 ...
3
votes
1answer
59 views

About the Qiskit draw function

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

How to define custom controlled unitaries in OPENQASM 2.0?

According to the OPENQASM 2.0 documentation, it's possible to define custom unitary gates using the format: gate name(params) qargs { body } where the optional ...
6
votes
1answer
246 views

Defining qubit operator from scratch

I'm a beginner with Qiskit and the Python language at all. Here is my question: One of the VQE function arguments is qubit operator (qubitOp). I saw some examples ...
1
vote
0answers
101 views

How to run quantum SVM algorithm from Qiskit in real IBM Quantum Computer using IBMQ?

I'm trying to run QSVM algorithm in IBMQ experience, want to run in one of those real quantum computers. ...
1
vote
0answers
19 views

How to plot decision boundary with support vectors when running quantum SVM algorithm?

I'm working on QSVM to know the difference between SVM and QSVM. How much better quantum machine learning can do when compared to classical machine learning algorithms? Part of my code: ...
3
votes
3answers
170 views

How to quickly calculate the custom U3 gate parameters $\theta, \phi$ and $\lambda$ for any unitary?

In IBM Qiskit and Quantum Experience, the custom U3 gate is defined as $$ U(\theta, \phi, \lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -e^{...
0
votes
1answer
131 views

How do I translate a quantum circuit for computing x + y mod 8 into a program?

I have made the above quantum circuit that gives the mod $8=2^3$ operation between $|x\rangle$ and $|y\rangle$. Now I want to write its corresponding program using some language. Where can I do that i....
2
votes
1answer
49 views

How to prepare a statistical mixture of $|0,0\rangle $ and $ |1,1\rangle $ in QuTiP?

A QuTiP novice here. It's easy to prepare a pure state in QuTiP. For example, to prepare $\frac{1}{\sqrt{2}}(|0,0\rangle + |1,1\rangle)$: ...
5
votes
1answer
73 views

How does measurement calibration work?

One of the possible ways to improve the results of an experiment on the IBM machine using the Qiskit language is to use the measurement calibration methods. This is the link to the documentation. I ...
1
vote
1answer
60 views

Order of controls and targets of cnx gates in Qiskit (Python)

In the following piece of code: cnx(qwc, q[0], q[1],q[2],q[3]) in what order control qubits and target qubit are? Which qubit is inverted for which values of ...
3
votes
1answer
100 views

How does the cnx gate work in Qiskit (Python)?

Could somebody explain the cnx operator, and how it operates on its qubit parameters to flip the target qubit in Qiskit (Python)?
1
vote
1answer
50 views

Default value for a state created by QuantumRegister

What's the default value for a state created by QuantumRegister(1,'name_of_the_register')? Is it a $|0\rangle$ or a $|1\rangle$?
2
votes
1answer
36 views

How to draw a multiple qubit controlled NOT gate using qasm2circ?

In Example 6, the case of multiple qubit controlled custom $U$ gate is covered, but I want to reuse the standard NOT symbol i.e. $\bigoplus$. Say I want to draw this circuit, but with a $\bigoplus$ ...
3
votes
1answer
86 views

Counting in Q#: number of solutions

I have this program derived from Microsoft Quantum Katas for counting (see here): ...
3
votes
1answer
78 views

Drawing tangent vectors to the Bloch sphere with qutip

I need to plot drawings of qubit dynamics on the Bloch sphere. I know QuTip allows to do such drawings but I specifically need to represent evolution velocities on the Bloch sphere so I need to draw ...
2
votes
1answer
110 views

Grover's algorithm returns skewed probability distribution

I wrote an implementation of Grover's algorithm that looks like this: ...
4
votes
0answers
120 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....
2
votes
1answer
108 views

Experiment runtime on IBMQ

I have been trying to get the runtime of my experiment on IBM's quantum computer. I am using the classic stuff, i.e ...
1
vote
1answer
61 views

How do you start a simulation with a random initial state in Cirq?

How do you create a random initial state by modifying the $2^{n}$ vector amplitudes instead of starting every simulation at $|0000...000\rangle$?
5
votes
0answers
57 views

Graphing the decoherence of qubits being used to perform an algorithm

How would I be able to graph the decoherence of qubits being used to perform an algorithm? I'm working with the IBMQ Qiskit framework and I'm trying to write a program that allows me to find the ...
1
vote
0answers
56 views

Exception encountered while running quantum-enhanced support vector machines

I am trying to run the code of the notebook example aqua/artificial_intelligence/qsvm_kernel_classification.ipynb. I save it in a python file and I have an exception at runtime the display of ...
2
votes
1answer
51 views

How do I do printf debugging in Q# in a convenient way?

When initially writing an operator in Q#, I often want to see intermediate values of registers during the computation. This allows me to check that I haven't made ...
1
vote
1answer
82 views

(name of gate) is not in the list of basis operations

I'm trying to define a custom gate for my computations. I decided to copy the structure in one of the files in qiskit.extensions.standard package. Here is the code ...
2
votes
1answer
89 views

Qiskit DAG circuit - print information about individual gate/node by number

I created a DAG circuit in Qiskit and don't really understand how to see which gate is which. I want to call a function like dag_circuit.gate_info(gate_number), ...
1
vote
1answer
55 views

Using latest (GitHub) version of Qiskit as Python library

I just started working in Qiskit and want to use some of the new functions available to Qiskit on Github. Unfortunately, I don't know how to implement the latest GitHub version into my Anaconda ...
2
votes
0answers
45 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 ...