Questions tagged [circuit-construction]

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

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

Find a circuit implementing a 3-qubit unitary matrix preparing $|b\rangle\simeq(0,c,c,c,c,c,c,0)$ with $c=1/\sqrt6$

I am trying to find a circuit to represent a 3 Qubit unitary matrix such that $U|0\rangle = |b\rangle$ for $b = \left[0~c~c~c~c~c~c~0\right]$, where $c = 1/\sqrt{6}$. Although I am working in Qiskit, ...
2
votes
1answer
49 views

Representing Qubit Operator in Circuit

I am trying to represent a quantum circuit schematically with some operators in QISKIT. I know I can create some operator with Operator() in quantum_info from a ...
2
votes
1answer
41 views

Multiplication using nearest neighbour quantum gates

Let $A$ be an $n \times m$ matrix, and $x$ be an $m \times 1$ vector and $q$ be a number such that $q$ is polynomial in $n$. Let us be given both $A$, $q$, and $x$ as input and let us also have a 2D ...
2
votes
1answer
56 views

Which backends implement the if-else operation?

On which backends (Basic, AER, Simulation, IBMQ) is the qiskit.circuit.controlflow.if_else Operation implemented currently? I want to create a circuit depending on qubit states, e.g.: ...
0
votes
1answer
35 views

Encoding a block unitary matrix in a quantum circuit

My goal would be to implement the unitary matrix $M=\begin{bmatrix}U_{1} &0\\0&U_{0}\end{bmatrix}$ as a circuit for arbitrary $N \mathrm{x} N$ unitary matrices. It is trivial to show that if ...
1
vote
2answers
49 views

Is it true that $Ry(\pi/2)\sigma_zRy(-\pi/2)=\sigma_x$?

I saw in a qiskit document that said $Ry(\pi/2)\sigma_zRy(-\pi/2)=\sigma_x$ To confirm this I decided to create the matrix representations of these operations and multiply them together to see if I ...
4
votes
1answer
53 views

Native Gate Decomposition

TL;DR: I've got a very small set of gates to use and need to find efficient decompositions for $R_y$ and controlled $R_y$ gates. Does anyone have any better ideas than what I have? I'm looking to ...
3
votes
0answers
57 views

How to impliment Projector Control-Not in Qiskit?

I want to impliment Projector Control-Not in Qiskit just like in this , which is a $|0\rangle\langle 0|$ projector found in the paper "Grand Unification of Quantum Algorithm" page 7. Also, ...
4
votes
1answer
65 views

Confusion with the number of CNOTs in a circuit

I am a bit puzzled on the following circuit. According to this Quantum Computing SE thread it holds that $$ e^{i(Z\otimes Z)t} = {\rm CNOT} (I\otimes e^{iZt}){\rm CNOT} \qquad (1) $$ As a result we ...
2
votes
1answer
50 views

Simulating the Ising-like model as a quantum circuit

We are interested in simulating the 1d Ising model Hamiltonian using a Quantum Circuit (QC). A similar question was posted before with no answers. Here we will assume, for simplicity, 3 lattice sites ...
1
vote
1answer
46 views

How to implement general 2-qubit gate in n-qubit system?

I am trying to implement a general 2-qubit gate in an n-qubit system (not using qiskit or cirq). Example: Consider 4 qubits. Assume we want to act a CX on qubit 2 as control and qubit 3 as target. The ...
1
vote
0answers
35 views

How to create this feature map?

In this paper, the following feature map is used: $$x \to \vert\phi(x)\rangle = \frac{1}{\sqrt{2^k}}\sum_{i=0}^{2^k-1}\vert x\cdot g^i\rangle$$ But no circuit is provided. A theoretical description of ...
2
votes
1answer
32 views

Can the ancilla for Qiskit's mcx with mode="recursion" be dirty?

I think their implementation is close to the one from here which does use a dirty ancilla, but I just want to make sure
4
votes
2answers
286 views

Does there exists an algorithm to construct a quantum circuit given an arbitrary unitary?

Suppose there exists an algorithm that takes as input an arbitrary unitary matrix and produces as output a quantum circuit representing that matrix. Then in theory that algorithm could construct any ...
7
votes
2answers
147 views

What quantum gates admit a basis-independent interpretation of their action?

The SWAP gate swaps the state of the two qubits so that in the computational basis $|01\rangle \rightarrow |10 \rangle$ with a matrix representation given by: \begin{bmatrix} 1 & 0 & 0 & 0 ...
4
votes
1answer
144 views

Given a $|W_8\rangle$, perform a CCCZ using stabilizer operations

I know it's possible to perform a CCZ operation using only stabilizer operations (Cliffords + Pauli measurements + classical feedback) by consuming a $|CCZ\rangle$ state, and that a $|W_4\rangle$ ...
3
votes
2answers
64 views

How to create superposition of states with fixed parity with a quantum circuit?

I'm searching for a circuit to generate, starting from the $|00\, ...\,0\rangle$ state, an arbitrary superposition of all states with either even or odd parity. The gate choice is irrelevant for now, ...
3
votes
1answer
77 views

How to create a Bell state with asymmetric amplitudes using single-qubit and CNOT gates?

Is there a systematic way - in terms of a quantum circuit with single qubit and CNOT gates - to create a bell state with asymmetric amplitudes, e.g., $$ \alpha |00\rangle + \beta|11\rangle $$ where $\...
4
votes
1answer
38 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
31 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
29 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
80 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
81 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
56 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
40 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
74 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
27 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
18 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
21 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
81 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
56 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?
2
votes
0answers
64 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
44 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}_{...
5
votes
2answers
170 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
42 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
60 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
55 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
61 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
154 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
43 views

Equivalent matrix for operators in qiskit

What is eqivalent matrix to qc.rx(np.pi, 0): ...
3
votes
1answer
73 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
105 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: ...
8
votes
2answers
392 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
261 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
531 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
438 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
206 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
60 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
141 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
76 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
2 3 4 5
10