Questions tagged [quantum-gate]

For questions regarding usage, performance, implementation, application or theory related to quantum gates.

Filter by
Sorted by
Tagged with
33 votes
5 answers
9k views

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

In a three-qubit system, it's easy to derive the CNOT operator when the control & target qubits are adjacent in significance - you just tensor the 2-bit CNOT operator with the identity matrix in ...
ahelwer's user avatar
  • 4,048
12 votes
3 answers
4k views

How to approximate $Rx$, $Ry$ and $Rz$ gates?

Quantum Inspire is a quantum computing platform provided by QuTech. It consists of two real quantum processors - Starmon-5 and Spin-2. Whereas it is possible to use rotation gates $Rx$, $Ry$ and $Rz$ ...
Martin Vesely's user avatar
47 votes
4 answers
13k views

How do I add 1+1 using a quantum computer?

This can be seen as the software complement to How does a quantum computer do basic math at the hardware level? The question was asked by a member of the audience at the 4th network of the Spanish ...
agaitaarino's user avatar
  • 3,777
8 votes
3 answers
1k views

Can I find the axis of rotation for any single-qubit gate?

Suppose I have an arbitrary qiskit $U_3$ gate: $U_3(\theta,\phi,\lambda)$. Is there a way I can find which axis the gate is rotating around? In other words, given any real numbers $\theta,\phi,\lambda$...
ZR-'s user avatar
  • 2,378
28 votes
4 answers
11k views

How can I implement an n-bit Toffoli gate?

I want to create a Toffoli gate controlled by n qubits, and implement it in QISKit. Can this be done? If so, how?
Ali Javadi's user avatar
  • 1,612
14 votes
2 answers
5k views

Given a decomposition for a unitary $U$, how do you decompose the corresponding controlled unitary gate $C(U)$?

Suppose we have a circuit decomposition of a unitary $U$ using some universal gate set (for example CNOT-gates and single qubit unitaries). Is there a direct way to write down the circuit of the ...
M. Stern's user avatar
  • 2,522
12 votes
2 answers
1k views

Understanding Google's “Quantum supremacy using a programmable superconducting processor” (Part 1): choice of gate set

I was recently going through the paper titled "Quantum supremacy using a programmable superconducting processor" by NASA Ames Research Centre and the Google Quantum AI team (note that the paper was ...
Sanchayan Dutta's user avatar
13 votes
2 answers
782 views

Quantum XNOR Gate Construction

Tried asking here first, since a similar question had been asked on that site. Seems more relevant for this site however. It is my current understanding that a quantum XOR gate is the CNOT gate. Is ...
user820789's user avatar
  • 3,302
7 votes
2 answers
777 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-...
DaftWullie's user avatar
  • 55.7k
5 votes
1 answer
1k views

How to perform Quantum Process Tomography for three qubit gates?

I am trying to perform Quantum process tomography (QPT) on three qubit quantum gate. But I cannot find any relevant resource to follow and peform the experiment. I have checked Nielsen and Chuang's ...
Pralekh Dubey's user avatar
5 votes
1 answer
1k views

How can you decompose Grover's diffusion operator into gates?

I know how Grover's diffusion operator works ($U_s = 2|s\rangle\langle s|-I$) with the inversion around the mean. However, I want to implement it in simpler gates, to use the algorithm. How can I do ...
BrockenDuck's user avatar
24 votes
1 answer
6k views

How to interpret a quantum circuit as a matrix?

If a circuit takes more than one qubit as its input and has quantum gates which take different numbers of qubits as their input, how would we interpret this circuit as a matrix? Here is a toy example:...
Archil Zhvania's user avatar
21 votes
4 answers
3k views

Why are quantum gates unitary and not special unitary?

Given that the global phases of states cannot be physically discerned, why is it that quantum circuits are phrased in terms of unitaries and not special unitaries? One answer I got was that it is just ...
wdc's user avatar
  • 417
19 votes
2 answers
14k 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 ...
Lucas Myers's user avatar
18 votes
4 answers
10k views

Implementing "Classical AND Gate" and "Classical OR Gate" with a quantum circuit

Quantum cNOT Gate (Classical XOR Gate) A "Controlled NOT (cNOT) Gate" flips the 2nd qubit if the 1st qubit is $\left|1\right>$, and returns the 2nd qubit as-is if the 1st qubit is $\left|0\right&...
Siu Ching Pong -Asuka Kenji-'s user avatar
15 votes
3 answers
10k views

How to construct matrix of regular and "flipped" 2-qubit CNOT?

When constructing the matrices for the two CNOT based on the target and control qubit, I can use reasoning: "If $q_0$==$|0\rangle$, everything simply passes through", resulting in an Identity matrix ...
Thomas Hubregtsen's user avatar
9 votes
3 answers
3k views

How to implement the "Square root of Swap gate" on the IBM Q (composer)?

I would like to simulate a quantum algorithm where one of the steps is "Square root of Swap gate" between 2 qubits. How can I implement this step using the IBM composer?
JanVdA's user avatar
  • 1,148
9 votes
2 answers
5k views

Expressing "Square root of Swap" gate in terms of CNOT

How could a $\sqrt{SWAP}$ circuit be expressed in terms of CNOT gates & single qubit rotations? CNOT & $\sqrt{SWAP}$ Gates Any quantum circuit can be simulated to an arbitrary degree of ...
user820789's user avatar
  • 3,302
8 votes
1 answer
552 views

Understanding the Group Leaders Optimization Algorithm

Context: I have been trying to understand the genetic algorithm discussed in the paper Decomposition of unitary matrices for finding quantum circuits: Application to molecular Hamiltonians (Daskin &...
Sanchayan Dutta's user avatar
7 votes
1 answer
578 views

Quantum XOR Linked List Construction

After getting help here with XNOR & RCA gates I decided to dive into XOR Swaps & XOR linked lists. I was able to find this explanation for quantum XOR Swapping which seems sufficient for the ...
user820789's user avatar
  • 3,302
6 votes
1 answer
786 views

Understanding Google's “Quantum supremacy using a programmable superconducting processor” (Part 3): sampling

In Google's 54 qubit Sycamore processor, they created a 53 qubit quantum circuit using a random selection of gates from the set $\{\sqrt{X}, \sqrt{Y}, \sqrt{W}\}$ in the following pattern: ...
Sanchayan Dutta's user avatar
6 votes
1 answer
2k views

How to interpret a 4 qubit quantum circuit as a matrix?

This is part of Simon Algorithm (Initial state + some Oracle function) There is a post that explains how to interpret circuits (How to interpret a quantum circuit as a matrix?), but I'm not sure how ...
Felipe Rojo Amadeo's user avatar
6 votes
1 answer
666 views

Quantum Ripple Carry Adder Construction

There is an excellent answer to How do I add 1+1 using a quantum computer? that shows constructions of the half and full adders. In the answer, there is a source for the QRCA. I have also looked at ...
user820789's user avatar
  • 3,302
6 votes
2 answers
486 views

Can we rotate Bloch vectors for qudits like we do with qubits in the Bloch sphere?

I have been looking into the Bloch vectors for qudits and have been wondering if we can do rotations that are similar to the rotations in the qubit Bloch sphere. Like, once we create a Bloch vector ...
Parmeet Singh EP 066's user avatar
4 votes
1 answer
414 views

Help Identifying a Gate In Nielsen and Chuang

I am seeking help to identify the oracle gates listed in this example. I understand that the right-most one is a toffoli gate, but what are the other ones? Specifically, I do not understand what a ...
rkoni's user avatar
  • 49
3 votes
2 answers
2k views

How is the no-cloning theorem compatible with the fact that fan-out gates work?

I have some difficulty with understanding no-cloning theorem. Simply speaking, according to the theorem, it is not possible to copy a quantum state. On the other hand, CNOT gate can be used as so-...
Martin Vesely's user avatar
40 votes
2 answers
7k views

What is quantum gate teleportation?

Quantum state teleportation is the quantum information protocol where a qubit is transferred between two parties using an initial shared entangled state, Bell measurement, classical communication and ...
Kiro's user avatar
  • 1,935
39 votes
8 answers
6k views

If all quantum gates must be unitary, what about measurement?

All quantum operations must be unitary to allow reversibility, but what about measurement? Measurement can be represented as a matrix, and that matrix is applied to qubits, so that seems equivalent to ...
auden's user avatar
  • 3,399
30 votes
6 answers
12k 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}{...
Nillmer's user avatar
  • 715
22 votes
3 answers
9k views

How to calculate circuit depth properly?

Is the circuit depth the longest sequence of gates applied on one of the qubits? Or is it something more complicated?
C-Roux's user avatar
  • 848
17 votes
1 answer
1k views

How are gates implemented in a continuous-variable quantum computer?

I've mostly worked with superconducting quantum computers I am not really familiar with the experimental details of photonic quantum computers that use photons to create continuous-variable cluster ...
Mark Fingerhuth's user avatar
14 votes
1 answer
5k views

General parametrisation of an arbitrary $2 \times 2$ unitary matrix

From Nielsen & Chuang's Quantum Computation and Quantum Information (QCQI): Since $U$ is unitary, the rows and columns of $U$ are orthonormal, form which it follows that there exist real numbers $...
Tech Solver's user avatar
10 votes
3 answers
3k views

What is the relation between these two forms of a single-qubit unitary operation?

I want to understand the relation between the following two ways of deriving a (unitary) matrix that corresponds to the action of a gate on a single qubit: 1) HERE, in IBM's tutorial, they ...
Mathist's user avatar
  • 495
8 votes
1 answer
1k views

Practical implementation of Hamiltonian Evolution

Following from this question, I tried to look at the cited article in order to simulate and solve that same problem... without success. Mainly, I still fail to understand how the authors managed to ...
FSic's user avatar
  • 839
7 votes
1 answer
2k views

Physical implementation of gates on IBM Q

There is a lot of quantum gates in IBM Q Composer, however, only few are implemented physically while others can be composed of them. When one looks at description of a quantum processor in IBM Q ...
Martin Vesely's user avatar
4 votes
1 answer
436 views

Building a state with parallel execution

I'm trying to implement the main algorithm described in the Quantum Recommendation Systems paper. In order to do this, I have to create a quantum state $|x\rangle$ corresponding to a real vector ...
Tristan Nemoz's user avatar
3 votes
3 answers
425 views

How does one create the unitary sending $|0\rangle$ into a target quantum state?

The Hadamard gate allows us to construct an equal superposition of states. If one wants to construct an arbitrary superposition e.g. $\alpha\vert 0\rangle + \beta\vert 1\rangle + ..$, how does one ...
bg827's user avatar
  • 33
34 votes
1 answer
13k views

How are quantum gates implemented in reality?

Quantum gates seem to be like black boxes. Although we know what kind of operation they will perform, we don't know if it's actually possible to implement in reality (or, do we?). In classical ...
Sanchayan Dutta's user avatar
22 votes
3 answers
3k views

Toffoli gate as FANOUT

I was searching for examples of quantum circuits to exercise with Q# programming and I stumbled on this circuit: From: Examples of Quantum Circuit Diagrams - Michal Charemza During my introductory ...
D-Brc's user avatar
  • 413
18 votes
1 answer
3k views

If quantum gates are reversible how can they possibly perform irreversible classical AND and OR operations?

Quantum gates are said to be unitary and reversible. However, classical gates can be irreversible, like the logical AND and logical OR gates. Then, how is it possible to model irreversible classical ...
Sanchayan Dutta's user avatar
16 votes
6 answers
13k 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. ....
Dyon J Don Kiwi van Vreumingen's user avatar
15 votes
1 answer
1k views

Why do we use the standard gate set that we do?

The typically used gate set for quantum computation is composed of the single qubits Cliffords (Paulis, H and S) and the controlled-NOT and/or controlled-Z. To go beyond Clifford we like to have full ...
James Wootton's user avatar
13 votes
3 answers
850 views

Superposition of quantum circuits

Given a quantum circuit $C_1$ that generates a state $\vert\psi\rangle$ and another circuit $C_2$ that generates $\vert\phi\rangle$, is there a way to construct a circuit that outputs $$\frac{1}{\sqrt{...
Kolp's user avatar
  • 133
12 votes
1 answer
2k views

How to implement a matrix exponential in a quantum circuit?

Maybe it is a naive question, but I cannot figure out how to actually exponentiate a matrix in a quantum circuit. Assuming to have a generic square matrix A, if I want to obtain its exponential, $e^{A}...
FSic's user avatar
  • 839
9 votes
2 answers
1k views

Is the Kraus representation of a quantum channel equivalent to a unitary evolution in an enlarged space?

I understand that there are two ways to think about 'general quantum operators'. Way 1 We can think of them as trace-preserving completely positive operators. These can be written in the form $$\...
Quantum spaghettification's user avatar
9 votes
1 answer
1k views

Understanding Google's “Quantum supremacy using a programmable superconducting processor” (Part 2): simplifiable and intractable tilings

In Google's 54 qubit Sycamore processor, they created a 53 qubit quantum circuit using a random selection of gates from the set $\{\sqrt{X}, \sqrt{Y}, \sqrt{W}\}$ in the following pattern: ...
Sanchayan Dutta's user avatar
8 votes
3 answers
3k views

Square root of Pauli operators: is there a common convention to define them uniquely?

There exists many different matrices square root. For instance I can define either of the two for square root of $X$: $$\sqrt{X}^{(1)} \equiv \frac{1}{\sqrt{2 i}} \begin{pmatrix} 1 & i \\ i & ...
Marco Fellous-Asiani's user avatar
8 votes
2 answers
2k views

What are theta, phi and lambda in cu1(theta, ctl, tgt) and cu3(theta, phi, lam, ctl, tgt)? What are the rotation matrices being used?

I was reading the documentation for qiskit.QuantumCircuit and came across the functions cu1(theta, ctl, tgt) and ...
Sanchayan Dutta's user avatar
5 votes
3 answers
699 views

How do I write the matrix for a CZ gate operating on nonadjacent qubits?

I'm working on a teleport protocol and I need to open the matrix of each operator, however, there's a CZ gate between q0 and q2 at the end of it and I don't know how to write the matrix for it and ...
Ziri's user avatar
  • 51
5 votes
1 answer
1k views

What is the $\lambda$ parameter in the $U3$ gate used for?

The most general single qubit gate is $\mathrm{U3}$ given by matrix $$ \mathrm{U3}= \begin{pmatrix} \cos(\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ \mathrm{e}^{i\phi}\sin(\theta/2) & ...
Martin Vesely's user avatar

1
2 3 4 5
7