Questions tagged [circuit-construction]

For questions about the construction of complex circuits using elementary quantum gates.

Filter by
Sorted by
Tagged with
3
votes
1answer
29 views

What is the method to create arbitrary controlled circuits in Qiskit?

I am working on an implementation of an algorithm which uses ampitude estimation and amplification as a subroutine but we are not using qiskit but QuEST. QuEST doesn't have any direct method to ...
1
vote
0answers
24 views

How should I think about circuit metrics like "qubit count," "circuit depth," and "gate count" when dealing with the OpenQASM 3 `ctrl` modifier?

It seems like circuit metrics like qubit count, circuit depth, and gate count are pretty useful. Qubit count determines whether a it's even possible to run a program on resource-limited quantum ...
0
votes
0answers
18 views

How to perform controlled rotations similar to what is done in HHL

How does one do the conditional rotation based on a binary encoding of the input? The rotation of D_i^t has to be done in the image below and I know that similar rotations can also be found in HHL and ...
2
votes
2answers
68 views

Compute the output of this Approximate Quantum Cloning three-qubit circuit

Above is a circuit for "Approximate Quantum Cloning" The preparation state is given by $$|\psi\rangle =\alpha|0\rangle+\beta|1\rangle$$ The gates labelled $\theta_i$ denote single qubit ...
0
votes
2answers
57 views

How to multiply two vectors (kets) in qiskit?

Hi does anyone know how i could write a program to get the product of something like |1>|0>|0>?
2
votes
0answers
33 views

Could the Hamiltonian of a Rubik's Cube be simulated with a NISQ device?

Consider the four cells on each of the six faces of the 2x2x2 Rubik's cube (the pocket cube), with front, up, and right twists being labelled as $\langle F,U,R\rangle$. Each move uses fifteen SWAP ...
2
votes
1answer
32 views

How to Construct Swap Gates from Permutation Matrix?

This is a follow-up question from here. Let's say after an LUP decomposition, we have an 8x8 permutation matrix: $ P^{-1} = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ ...
4
votes
1answer
64 views

Is there a higher dimensional Fredkin gate?

The Fredkin gate is CSWAP gate. Given a control register in $0$ or $1$, the gate does nothing or swaps two target registers respectively. Is there a higher dimensional version of this gate? I have ...
0
votes
0answers
25 views

Measuring with a certain probability in Qiskit

I have the following quantum operation on two qubits: $$ \mathcal{E}(\rho) = p \mathcal{T} \circ \mathcal{U}(\rho) + (1-p) \mathcal{U}(\rho) ​$$ where $p$ is some probability, $\mathcal{U}$ is some ...
0
votes
0answers
11 views

FRQI wrong interpretation

I try to use FRQI https://qiskit.org/textbook/ch-applications/image-processing-frqi-neqr.html with the same circuit. Suppose I have the following image: and the flatten representation is [0 100 200 ...
0
votes
0answers
18 views

FRQI for 8x8 image

I read the paper A flexible representation of quantum images for polynomial preparation, image compression, and processing operations and found a scheme for 2x2 images which looks like this: I tried ...
1
vote
1answer
75 views

How to determine the basis state with maximum amplitude without measurement?

Suppose I have two quantum registers described respectively by the quantum states $| \psi_1 \rangle = \sum_i \alpha_i |i \rangle$ and $|\psi_2 \rangle = |0\rangle$. I would like to implement a CNOT ...
0
votes
1answer
47 views

Implement a square root of Swap gate in using qiskit [closed]

Does the √SWAP gate have a ready-to-use function on the Qiskit circuit library? If not, how to implement it?
1
vote
0answers
47 views

Eigenvalues and energy levels of 1D Heisenberg model using real Quantum Computers?

The 1D Quantum Heisenberg model is $$H_\textrm{Heisenberg} = -~J \sum_{\langle i\ j\rangle} \hat{S}_{i} \cdot \hat{S}_{j}$$ where each spin is an operator. For simple cases, for example, a system with ...
0
votes
0answers
40 views

Four-qubit error correction code

$\newcommand{\ket}[1]{\left|#1\right>}$ Consider the following 4-qubit code which allows you to detect a bitflip and/or a phaseflip. The logical 0 and 1 are encoded as: \begin{align*} \ket{0}_{...
4
votes
2answers
117 views

Why isn't $Ry(\pi/2)$ gate equivalent to Hadamard gate?

I've been experimenting with quantum circuits and can't quite fathom how the difference between states comes together. Speaking in terms of simulations using qiskit,...
1
vote
1answer
41 views

How many single and double qubit gates are required to create a uniform superposition of vertices of a Johnson Graph J(n,r)?

Can I in $\tilde{O}(r)$ number of gates (single and double qubit) create a uniform superposition of vertices of Johnson Graph $J(n,r)$? I would like to create a state $|\psi\rangle = \frac{1}{\sqrt{n \...
5
votes
1answer
50 views

Why do we care about the number of $T$ gates in a quantum circuit?

When reading this question and quickly reading some of the linked papers, I wondered why was the number of $T$ gates specified along the number of controlled-$X$ gates. I've often read that ...
1
vote
1answer
48 views

What is the syntax for general control gate in stim

For a stabilizer code with the stabilizers in canonical form, an encoding circuit has the form that's a product of hadamard gates and general control gates : $H_i C_i(U_i)$. For example for the $[[5,1,...
0
votes
0answers
60 views

How can I create a Qiskit function producing a quantum circuit such that $\langle Z^{\otimes n}\rangle=J_{n-1}/2^{n-1}$?

Problem: Create a function circ(n) that returns an $n$-qubits quantum circuit that, when measured in the $Z^{\otimes n}$ basis, should yield the following ...
1
vote
1answer
150 views

Getting non-Clifford after performing several Clifford gates in qiskit

I'm trying to test Clifford gates in qiskit according to the table in Fault-tolerant SQ, page 101. I tried 4 Cliffords in the test $$-X/2 - X -X/2,Y/2,X/2 - -X/2,Y/2,-X/2$$ using the following code <...
0
votes
1answer
38 views

Equivalent matrix for operators in qiskit

What is eqivalent matrix to qc.rx(np.pi, 0): ...
3
votes
1answer
68 views

How to implement a quantum array

I'm trying to implement a quantum array. That is one that stores qubits and can be indexed via qubits. I can create one that handles setting values fairly easy. Have two registers, one for the ...
1
vote
1answer
86 views

Is it possible to perform $z$ rotation in Qiskit with just $x$ and $y$ rotations?

Is it possible to perform $z$ rotation in Qiskit with just $x$ and $y$ rotations? I tried the following: ...
7
votes
2answers
293 views

Minimum number of 2 qubit gates to build any unitary

Any unitary $U$ acting on $N$ qubits can be decomposed in a finite product $U=U_1U_2...U_n$ where every $U_i$ acts on only 2 qubits, for example through decomposition in CNOT, phase shifts and 1 qubit ...
2
votes
2answers
253 views

What is the circuit for grover's algorithm if N is not a power of 2?

From the literature it seems that grover's algorithm works if $N$ is not a power of $2$. For instance, https://en.wikipedia.org/wiki/Grover%27s_algorithm and https://arxiv.org/abs/quant-ph/0005055 I ...
2
votes
4answers
470 views

How is a Toffoli gate built without using T gates?

Can someone tell me how to make a Toffoli gate without using T gates? Can we use $R_x$ and $R_y$. If yes, then how? I tried many circuits but I was unable to create the CCNOT gate out of $R_x$, $R_y$ ...
3
votes
1answer
351 views

Controlled Z gate using Pauli rotation operators and Z tensor product Z

I am trying to construct a controlled Z gate using elementary gates. This is what I have so far: \begin{pmatrix} -i & 0 & 0 & 0\\ 0 & -1 & 0 & 0\\ 0 & 0 & 1 & 0\\ ...
3
votes
1answer
160 views

Qiskit's QFT not returning the expected state

I'm currently going through the lab problems for the Qiskit course here. I'm trying to finish lab set number 3 on QPE but I can't seem to get the desired output, even from the solution notebook. I'm ...
1
vote
0answers
59 views

What is the right way to teleport qubits on a real quantum computer?

I've been using the teleportation protocol to teleport qubits and then using Qiskit state tomography for reconstructing my qubits. Using this circuit using open qasm I regularly obtain fidelity 0.9. ...
5
votes
1answer
132 views

BHT algorithm implementation

Summary of Method Amplitude Amplification Summary The BHT algorithm uses amplitude amplification, a nice generalisation of Grover's algorithm, where there is a subset $G\subset X$ of good elements in ...
1
vote
0answers
72 views

Quantum Circuits for Time-Series Data

I am currently working with a dataset with autocorrelated features, i.e, x(t) affects the value of x(t+1) which affects the value of x(t+2). Suppose this is the circuit representing x(t): Does ...
1
vote
1answer
129 views

How to generate a quantum circuit from the quantum state $|1000\rangle+|0100\rangle+|0010\rangle+|0001\rangle$?

I am trying to understand the steps of how make a state preparation circuit from a quantum state. For making my question more clearer, for example, for the state is $\frac{|00\rangle+|11\rangle}{\...
5
votes
1answer
356 views

Implement a projection operator as a quantum circuit

Let the state $|\Psi\rangle\equiv a|0\rangle\otimes|\psi_0\rangle + b|1\rangle\otimes|\psi_1\rangle$, where $|\psi_0\rangle$ and $\psi_1\rangle$ belong to a multi-qubit register $R$ and the ...
3
votes
3answers
755 views

Why do we have to measure the circuit before sending it to the real quantum computer?

If I want to run a circuit on a real quantum computer, I have to measure it before running it. For example: ...
0
votes
1answer
60 views

How to perform a plot histogram for a circuit?

I have created a circuit and I don't know how to plot a histogram. I tried to plot a histogram but it gives me output for 0000 case only, how to get to know the probability for all of the cases. The ...
2
votes
0answers
30 views

Managing memory while running a high depth circuit simulation (amplitude amplification) using Qiskit

I am running an instance of amplitude amplification using Qiskit (v 26) on Google Colab. The circuit is approximately 17 qubits in space and $O(ck)$ in depth where $k \in \left \{1,2,3....,22 \right \...
4
votes
1answer
84 views

How do you represent a Hadamard gate as a product of $R_x$ and $R_y$ gates?

I'm looking for a representation of Hadamard gate that uses only $R_x(x)$ and $R_y(y)$ gates. The values $x$ and $y$ may be the same, but they don't necessarily need to be.
0
votes
2answers
100 views

How to assemble two quantum circuits whose qubit mapping states are different each other?

I uploaded similar question before, but the answer was not I want. I think I should show you in more detail about my question. I use SABRE algorithm which can do qubit mapping for executing quantum ...
5
votes
1answer
122 views

What is the correlation between Toffoli and a more generic rotation shown in qiskit textbook

Can someone help me understand the correlation between the 2 diagrams in the qiskit textbook.
0
votes
1answer
92 views

How to build and visualize circuit from matrix?

In paper Efficient quantum algorithm for solving travelling salesman problem: An IBM quantum experience, the authors use gate $U_j$ and its decomposition $$ U_j = \begin{pmatrix} \mathrm{e}^{ia} &...
3
votes
1answer
74 views

Data encoding in the quantum perceptron model

In this paper, this figure shows the perceptron model used for quantum neural network. When realizing the inner product between weight vector and input vector, it defines a unitary transformation $U_W$...
2
votes
0answers
80 views

Two possible ways how to implement Shor's Algorithm

Among many paper describing circuit solving period finding problem and discrete logarithm problem (DLP) (for simplity, let's say $g \equiv x^r$ (mod n) and try to find $r$), there are two variants ...
1
vote
0answers
81 views

Circuit state preparation using amplitude encoding

I am following an example of preparing an input state using amplitude encoding from this book. How to calculate $\beta_1^1$ using given formula above? In my understanding, $\beta_1^1 = 2\arcsin(\frac{\...
4
votes
0answers
65 views

An algorithm to perform Gram-Schmidt orthogonalization of linearly independent state vectors

In the first paragraph of the 2nd section of this article, it is stated that given a set of linearly independent $n$-qubit state vectors, Alice can perform the Gram-Schmidt procedure to obtain ...
2
votes
0answers
36 views

Marginal output probability of first bit for constant-depth circuits

Consider a constant depth $1\text{D}$ quantum circuit, which is applied to the input state $|0^{n}\rangle$, and whose output is measured in the standard basis. You can assume that the gates of the ...
7
votes
2answers
232 views

Complexity of $n$-Toffoli with phase difference

I'm interested in the $n$-Toffoli gates with phase differences. I found a quadratic technique in section 7.2 of this paper. Here's the front page of the paper. Here's an image of the section that I'm ...
3
votes
1answer
142 views

Understanding Grover’s Oracle for 3-SAT

First of all I'm very new to the quantum computing world so this might seem trivial to you, but it's a hump I was unable to get over for days now. So I'm talking about the version that Qiskit has ...
2
votes
1answer
67 views

Is there an efficient way to create entangled states using Qiskit?

I am trying to implement Grover's search using Qiskit. And I would like to create entangled states so I could search for the index of a specific value in a list. For example, if the third element in ...
3
votes
1answer
69 views

Can an arbitrary circuit be represented using two commands (qsel package)?

I was watching this entertaining video by David Bacon (as in "Bacon-Shor code", Cirq, ...) : video of talk where he mentions the package he wrote: (qsel), that describes simulating quantum ...

1
2 3 4 5
10