Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [gate-synthesis]

For questions about finding (short) gate sequences to implement a specific unitary operation, for example decomposing a complicated multi-qubit gate into a sequence of basic gates. It might apply to optimizing circuits with respect to length or depth or finding gate sequences to implement an algorithm.

1
vote
0answers
19 views

Controlled controlled adder gates involved

Let's say I have a circuit that given in the figure As we can see that this circuit consists of $2$-Toffoli gates and $4$ C-NOT gates, and to construct this entire circuit using only single qubit ...
6
votes
1answer
57 views

How to decompose a controlled unitary $C(U)$ operation where $U$ is a 2-qubit gate?

In the vein of this question, say I have a 2-qubit unitary gate $U$ which can be represented as a finite sequence of (say) single qubit gates, CNOTs, SWAPs, cXs, cYs and cZs. Now I need to implement a ...
5
votes
2answers
126 views

Transform matrix into a combination of simple quantum gates

I am trying to transform this matrix into a combination of quantum gates but I cannot find any such functionality on Qiskit or anywhere else. I have tried to use Quirk but I do not understand it. $$\...
5
votes
1answer
119 views

Nielsen and Chuang's proof for 'approximating arbitrary unitary gates is generically hard'

The following statement is found on the page 199 of Nielsen and Chuang's book (10th Anniversary Edition) in the proof for the fact that 'approximating arbitrary unitary gates is generically hard': ...
1
vote
0answers
48 views

Transferring classical OR gate in a quantum gate

I would be interested to know how to transform the classic OR gate into a quantum gate. I thought a little about myself. The OR gate can also be rewritten as a NAND gate: So, I have now tried to ...
3
votes
2answers
86 views

Minimal quantum OR circuit

The quantum OR circuit between $|a\rangle$ and $|b\rangle$ can be made out of 1 Toffoli and 2 CNOT gates, 1 ancillary qubit. Is there any other implementation? Or is this the minimal in the sense of ...
2
votes
1answer
30 views

Making a maximally mixed 2-qubit state in the IBM Q

I am trying to make a 2-qubit maximally mixed state $\mathbb{I}/4$ where $\mathbb{I}$ is the identity $4\times 4$ matrix. I know that, for a maximally mixed 1-qubit state I can use a Hadamard gate, ...
8
votes
2answers
306 views

How is it possible to implement unitary operator when its size is exponential in inputs?

A quantum circuit can use any unitary operator. Its matrix is exponential in the number of input bits. In practice how can this ever be possible (aside from operators which are tensor products), i.e. ...
2
votes
1answer
84 views

Implementing these $N×N$ matrices on $\log N$ qubits

Consider $n$ qubits and the $N=2^n$ states that I label \begin{equation} |k \rangle = \sum_{i=0}^{n-1} 2^i q_i, \end{equation} i.e. $|q_{n-1}\cdots q_0 \rangle \rightarrow |k\rangle$, where $q_j \in \...
0
votes
0answers
29 views

How are multi-qubit gates extended into larger registers? [duplicate]

Implementing a single-qubit gate in a multi-qubit register is relatively easy. For example, this gate: This is equivalent to $I \otimes H \otimes I$. If the $H$ gate was on the first bit, it would be ...
5
votes
2answers
122 views

Implement Fredkin gate with square root of swap

I would like to implement a Fredkin gate based on square root of swap and one-qubit gates. In particular, I was hoping to find the exact gate named "?" in this circuit: In addition, I want to avoid ...
4
votes
1answer
72 views

Rewrite circuit with measurements with unitaries

In quantum physics, because of the no-cloning theorem, lots of classical proofs of cryptographic problems cannot be turned into quantum proofs (rewinding is usually not possible quantumly). A dream ...
2
votes
1answer
49 views

Optimise implementation of a quantum algorithm when an input is fixed

I need to implement a quantum comparator that, given a quantum register $a$ and a real number $b$ known at generation time (i.e. when the quantum circuit is generated), set a qubit $r$ to the boolean ...
2
votes
1answer
121 views

Building an N-qubit Controlled S Gate

I've been beating my head against this problem for three days now and I just can't seem to crack it. To construct an N-qubit controlled Unitary gate, I can do something like this (note I'm using ...
2
votes
1answer
89 views

If CNOTs and single qubit gates are universal then why do we need to prove that controlled U operations can be composed by them as well?

In the book by Chuang and Nielsen they prove that controlled U operations can be made out of CNOTs and single qubit gates. But then they go on to prove that they are universal by showing that every n ...
2
votes
1answer
281 views

Decompose a general two-qubit gate into general controlled-qubit gates

We often seek to decompose multi-qubit unitaries into single-qubit rotations and controlled-rotations, minimising the latter or restricting to gates like CNOTs. I'm interested in expressing a general ...
2
votes
1answer
85 views

How to implement a $\frac{\theta}{2}$ rotation from $\theta$ rotation?

Is there a way to create a rotation gate which has half the angle of some implementable gate? I am looking to implement a gate on Quirk which allows for standard time-dependent rotations $$R_x(\...
3
votes
0answers
77 views

Decomposition of any 2-level matrix into single qubit and CNOT gates

I saw an example which takes a 2 level matrix. Which is a $8\times8$ matrix that acts non trivially only on 2 levels of only states $|000\rangle$ and $|111\rangle$. The way they do it is by using a ...
4
votes
2answers
432 views

Composing the CNOT gate as a tensor product of two level matrices

I don't understand, why is the control not gate used so often. As far as I understand it, if you apply two 2 level operations on two qubits then you get a 4 x 4 matrix by the tensor product. So how ...
1
vote
1answer
80 views

Proof that $2^n \times 2^n$ operator be decomposed in terms of $2 \times 2$ operators

What is the proof that any $2^n\times 2^n$ quantum operator can be expressed in terms of the tensor product of $n$ number of $2\times 2$ quantum operators acting on a single qubit space each?
5
votes
3answers
486 views

Is there any method of adding two operators in a circuit?

I am trying to reconstruct the time evolution of a Hamiltonian on the quantum computing simulator, quirk. Ideally I would like to generalise this to any simulator. The unitary matrix is $$U(t)=e^{-...
4
votes
3answers
87 views

Hadamard gate as a product of $R_x$, $R_z$ and a phase

I am having problems with this task. Since the Hadamard gate rotates a state $180°$ about the $\hat{n} = \frac{\hat{x} + \hat{z}}{\sqrt{2}}$ axis, I imagine the solution can be found the following ...
1
vote
1answer
63 views

Creating a time dependent custom gate in Quirk

I have created a $16\times 16$ unitary operator using a Hamiltonian by finding its exponential $$U=\exp(-iH\delta t)$$ If I set $\delta t=1$ then I can take this matrix and input it into quirk using ...
1
vote
1answer
94 views

Gate sequence for exponential of product of Pauli Z operators

I want to compile $$\exp(-i \theta \sigma_i^z \sigma_j^z)$$ down to a gate sequence of single qubit rotations and CNOTs. How do I do this? What is the general procedure for compiling a unitary $U$ to ...
10
votes
3answers
568 views

Approximating unitary matrices

I currently have 2 unitary matrices that I want to approximate to a good precision with the fewer quantum gates possible. In my case the two matrices are: $$G = \frac{-1}{\sqrt{2}}\begin{pmatrix} i &...
5
votes
4answers
493 views

How do I build a gate from a matrix on Qiskit?

I'm creating a gate for a project and need to test if it has the same results as the original circuit in a simulator, how do I build this gate on Qiskit? It's a 3 qubit gate, 8x8 matrix: $$ \frac{1}{...
4
votes
1answer
136 views

Construction of ${R_n(\theta)}$ using only the Hadamard and ${\pi/8}$ gates

In the "Quantum Computation and Quantum Information 10th Anniversary textbook by Nielsen & Chuang", they claim that Eqn(4.75) is a rotation about the axis along the direction ( ${cos(\pi/8)}$, ${...
3
votes
2answers
166 views

Implementing gate with two parameters using Qiskit in Python

I am trying to implement the HHL algorithm (for solving $Ax=b$). I am assuming $A$ to be unitary and Hermitian so that I can find the Hamiltonian simulation for it easily. For any $A$ to be Hermitian ...
6
votes
2answers
337 views

How to obtain Y rotation with only X and Z rotations gates?

Let's say you have a system with which you can perform arbitrary rotations around the X and Z axis. How would you then be able to use these rotations to obtain an arbitrary rotation around the Y axis? ...
4
votes
2answers
206 views

Measuring the Hamiltonian in the VQE

I am trying to implement VQE in pyQuil and am dumbfounded by how to measure the expectation value of a general Hamiltonian on $\mathbb{C}^{2^n}$ i.e. determine $\langle\psi , H \psi\rangle$ on a ...
5
votes
2answers
87 views

Clarification needed: “Simulation” of $e^{-iHt}$ and its time complexity

On page 3 here it is mentioned that: However, building on prior works [32, 36, 38] recently it has been shown in [39] that to simulate $e^{−iHt}$ for an $s$-sparse Hamiltonian requires only $\...
3
votes
0answers
69 views

Circuit to construct a $n$-qubit state which is a superposition of states with only a single qubit being $\lvert1\rangle$ [duplicate]

So the question came up in a book I am working through. Given a circuit with $n$ qubits, construct a state with only $n$ possible measurement results, each of which has only $1$ of $n$ qubits as $1$, ...
2
votes
1answer
131 views

How to construct a quantum gate producing 1 if r divides x, 0 otherwise?

If you have two registers in the state $\frac{1}{2^{n/2}} \sum_{x = 0}^{2^{n/2} - 1} |x\rangle |0\rangle$, how could you construct a gate that produces a superposition of states $|x\rangle|1\rangle$ ...
0
votes
2answers
89 views

How does the stated Pauli decomposition for $\operatorname{CP\cdot A\cdot CP}$ arise?

I'm having a bit of trouble understand @DaftWullie's answer here. I understood that the $4\times 4$ matrix $A$ $$ \frac{1}{4} \left[\begin{matrix} 15 & 9 & 5 & -3 \\ 9 & 15 & 3 &...
5
votes
2answers
323 views

Simulation vs Construction of Fredkin gate with Toffoli gates

I'm working my way through the book "Quantum computation and quantum information" by Nielsen and Chuang. (EDIT: the 10th anniversary edition). On chapter 3 (talking about reversibility of the ...
6
votes
2answers
156 views

Is there a general method to implement a 'greater than' quantum circuit?

I am interesting in finding a circuit to implement the operation $f(x) > y$ for an arbitrary value of $y$. Below is the circuit I would like to build: I use the first three qubits to encode $|x⟩$, ...
2
votes
1answer
112 views

What quantum gate is XNOR equivalent to?

The standard way to implement a reversible XOR gate is by means of a controlled-NOT gate or CNOT; this is the "standard quantum XOR operation". Physics.Stackexchange Is there a "standard quantum XNOR ...
5
votes
1answer
104 views

How can I decompose a gate into $\{\mathrm{CNOT}, \mathrm{H}, \mathrm{P}(\theta)\}$?

I am working with the set $\{\mathrm{CNOT}, \mathrm{H}, \mathrm{P}(\theta)\}$ where $\mathrm{H}$ is the Hadamard gate, and $\mathrm{P}(\theta)$ is the phase gate with angle $\theta$. I want to build ...
10
votes
3answers
528 views

How to derive the CNOT matrix for a 3-qbit system where the control & target qbits are not adjacent?

In a three-qbit system, it's easy to derive the CNOT operator when the control & target qbits are adjacent in significance - you just tensor the 2-bit CNOT operator with the identity matrix in the ...
5
votes
1answer
308 views

Decomposition of an arbitrary 1-qubit gate into a specific gateset

Any 1-qubit special gate can be decomposed into a sequence of rotation gates ($R_z$, $R_y$ and $R_z$). This allows us to have the general 1-qubit special gate in matrix form: $$ U\left(\theta,\phi,\...
7
votes
1answer
384 views

Decomposition of arbitrary 2 qubit operator

As you know, universal quantum computing is the ability to construct a circuit from a finite set of operations that can approximate to arbitrary accuracy any unitary operation. There also exist some ...
16
votes
0answers
307 views

Explicit Conversion Between Universal Gate Sets

I'm interested in the conversion between different sets of universal gates. For example, it is known that each of the following sets is universal for quantum computation: $\{T,H,\textrm{cNOT}\}$ $\{H,...
12
votes
2answers
446 views

Automatic compilation of quantum circuits

A recent question here asked how to compile the 4-qubit gate CCCZ (controlled-controlled-controlled-Z) into simple 1-qubit and 2-qubit gates, and the only answer given so far requires 63 gates! The ...
9
votes
6answers
2k views

How to construct a multi-qubit controlled-Z from elementary gates?

For the implementation of a certain quantum algorithm, I need to construct a multi-qubit (in this case, a three-qubit) controlled-Z gate from a set of elementary gates, as shown in the figure below. ....
7
votes
2answers
191 views

Minimum number of CNOTs for Toffoli with non-adjacent controls

I want to decompose a Toffoli gate into CNOTs and arbitrary single-qubit gates. I want to minimize the number of CNOTs. I have a locality constraint: because the Toffoli is occurring in a linear array,...
6
votes
2answers
1k views

How do you implement the Toffoli gate using only single-qubit and CNOT gates?

I've been reading through "Quantum Computing: A Gentle Introduction", and I've been struggling with this particular problem. How would you create the circuit diagram, and what kind of reasoning would ...
4
votes
2answers
285 views

How do we code the matrix for a controlled operation knowing the control qubit, the target qubit and the $2\times 2$ unitary?

Having n qubits, I want to have the unitary described a controlled operation. Say for example you get as input a unitary, an index for a controlled qubit and another for a target. How would you code ...
7
votes
2answers
197 views

Number of gates required to approximate arbitrary unitaries

If I understand correctly, there must exist unitary operations that can be approximated to a distance $\epsilon$ only by an exponential number of quantum gates and no less. However, by the Solovay-...
5
votes
1answer
116 views

Arbitrary powers of NOT and SWAP

The square-root of not and square-root of swap gates are often singled out for discussion of gates displaying important properties relating to quantum computers. How do I define arbitrary (non-...
7
votes
2answers
215 views

Is it possible to realize CNOT gate in 3 dimension?

CNOT gates have been realized for states living in 2-dimensional spaces (qubits). What about higher-dimensional (qudit) states? Can CNOT gates be defined in such case? In particular, is this possible ...