Stack Exchange Network

Stack Exchange network consists of 174 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 [quantum-gate]

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

1
vote
1answer
30 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$ ...
4
votes
2answers
60 views

What happens when I input two qubits starting at state $|00\rangle$ into a hadamard gate

I was watching the following video https://www.youtube.com/watch?v=IrbJYsep45E And around 3 minutes in, they do an example computation with two qubits. The qubits started off in the state $|00\rangle$...
0
votes
1answer
27 views

Solving a circuit implementing a two-level unitary operation

The circuit below implements the following two-level unitary transformation: $\tilde{U}$ is a unitary matrix: $\tilde{U} = \left[\begin{matrix} a & c \\ b & d \end{matrix}\right]$ where $a, ...
1
vote
1answer
15 views

Applying Group Leaders Optimization to Quantum Belief Systems

Context: I am particularly interested in quantum cognition & would like to use a tool like pyZX to perform the following types of optimizations. In Preparing a (quantum) belief system they "...
0
votes
2answers
17 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 &...
3
votes
3answers
84 views

What is the matrix for the operator that implements a function to tell the parity of its argument?

$\newcommand{\qr}[1]{|#1\rangle}$ I gave myself the task of building an operator that implements the following function: $f(0) = 0$, $f(1) = 1$, $f(2) = 1$, $f(3) = 0$. I restricted myself to $x$ up ...
4
votes
3answers
53 views

What's an example of building a circuit $U_f$ that implements a simple function $f$?

I'd like to be able to program simple functions into simulators such as QCL. I read that any function $f$ can be implemented, but I don't know how to get say a unitary matrix that implements $f$. $\...
1
vote
2answers
40 views

Why does a rotation of $\pi/2$ on $|1\rangle$ yield $i|1\rangle$?

$\newcommand{\q}[2]{\langle #1 | #2 \rangle} \newcommand{\qr}[1]{|#1\rangle} \newcommand{\ql}[1]{\langle #1|}$ It seems $V(\pi/2, \qr{1}) = i \qr{1}.$ I didn't expect that. To me $\qr{1}$ points ...
4
votes
1answer
62 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 &...
2
votes
3answers
76 views

Calculating measurement result of quantum swap circuit

Consider the following circuit, where $F_n$ swaps two n-qubit states. If the inital state is $|0\rangle \otimes |\psi\rangle \otimes |\phi\rangle = |0\rangle|\psi\rangle|\phi\rangle$, the state ...
5
votes
2answers
56 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
3answers
64 views

$R_z$ gate representations

Why is the $R_z$ gate sometimes written as: $$ R_{z}\left(\theta\right)=\begin{pmatrix}1 & 0\\ 0 & e^{i\theta} \end{pmatrix}, $$ while other times it is written as: $$ R_{z}\left(\theta\...
2
votes
0answers
45 views

Simulating Read only QRAM (constructing an oracle)

In many algorithms an array that stores a classical data or quantum data is crucial. The QRAM (quantum random access memory) that stores classical data in the circuit has been done. My question ...
4
votes
1answer
57 views

Applying CNOT With Local Operations and Two EPR Pairs

Suppose Alice and Bob hold one qubit each of an arbitrary two-qubit state $|\psi \rangle$ that is possibly entangled. They can apply local operations and are allowed classical communication. Their ...
5
votes
1answer
61 views

How to apply the outer product operator?

$\newcommand{\q}[2]{\langle #1 | #2 \rangle} \newcommand{\qr}[1]{|#1\rangle} \newcommand{\ql}[1]{\langle #1|} \renewcommand{\v}[2]{\langle #1,#2\rangle} \newcommand{\norm}[1]{\left\lVert#1\right\...
2
votes
1answer
49 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
59 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 ...
4
votes
1answer
122 views

Qutrit Teleportation

I'm working through Scott Aaronson's Quantum Information Science problemsets, and I'm having trouble with a specific problem. Specifically the following problem: Here's what I've done: after applying ...
6
votes
1answer
51 views

How to say “apply CNOT on q-bit 1 controlled by q-bit 2”?

Say you have $2$ q-bits, namely $q_1, q_2$. What's the right language for saying apply CNOT on $q_1$ and $q_2$ where $q_1$ is the control bit and $q_2$ is the target? For instance, can I say "apply ...
6
votes
1answer
110 views

How would one implement a quantum equivalent of a while loop in IBM QISkit?

I'm writing a simple multiplication algorithm that uses the Quantum Fourier Transform to repetitively add a number (the multiplicand) to itself and decrements another number (the multiplier). The ...
3
votes
1answer
67 views

How to create a condition on only one classical bit when we have a total of 2 classic bits in the system

I am trying to make a quantum circuit with one qubit and 2 classical bits for each measurment in the system below: I want to make condition on the first bit: if the first collapse to zero so x ...
6
votes
1answer
144 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 ...
4
votes
2answers
61 views

Symmetry in Conditional Phase Shift Gates and Realizing CNOT through HCZH

Why are conditional phase shift gates, such as CZ, symmetrical? Why do both the control and target qubit pick up a phase? Furthermore, assuming that they are symmetrical, when using a CNOT gate as an ...
4
votes
1answer
44 views

What is the significance of recent demonstration of a passive photon–atom qubit swap operation?

In reference to this recent nature article: https://www.nature.com/articles/s41567-018-0241-6 Specifically, does this warrant a new type of gate?
5
votes
1answer
43 views

Classical XOR gate in Quantum Circuit

Can we use classical XOR gate in a quantum circuit? Or are there any alternatives for XOR gate?
12
votes
0answers
130 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,...
9
votes
2answers
115 views

State of the art gate speeds and decoherence times

I am interested in the state of the art gate speeds and decoherence times for the qubit types I know are being pursued by companies presently: superconducting qubits, ion trap qubits, photonic qubits....
10
votes
2answers
190 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 ...
8
votes
6answers
234 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
3answers
167 views

What does it mean for a quantum computer to have $X$ qubits?

I want to preface with a disclaimer that I am a physicist with minimal knowledge of computer hardware. I have a solid understanding of quantum information from a theoretical standpoint but zero ...
6
votes
2answers
111 views

Just want to confirm: Do two CNOT gates cancel each other?

I see somewhere that this happens: But I wonder if this is just identity.
5
votes
3answers
405 views

Advantange of Hadamard gate over rotation about the X axis for creating superpositions

When I look at most circuits (admittedly small sample as I'm a beginner), the Hadamard gate is used a lot to prepare a superposition from say the $\mid0\rangle$ state. But upon a little reflection, we ...
6
votes
2answers
169 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 ...
6
votes
2answers
115 views

Is there a tool that can give you the unitary representing a quantum circuit from just a string?

Say I have a string representing the operations of a quantum circuit. I want to have the unitary operator representing it. Is there a tool for doing so in Python or else?
3
votes
2answers
100 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 ...
5
votes
2answers
394 views

Incorrectly Calculating Probability Amplitudes for 3-qbit Circuit

I’m trying to calculate the probability amplitudes for this circuit: My Octave code is: ...
6
votes
2answers
334 views

Possibility of a “reset” quantum gate

I wish to have a "reset" gate. This gate would have an effect to bring a qubit to the $\mid0\rangle$ state. Clearly, such a gate is not unitary (and so I'm unable to find any reliable implementation ...
4
votes
2answers
162 views

Shorthand notation for the sign flip gate

I need to use the following matrix gate in a quantum circuit: $$\text{Sign Flip}=\left[\begin{matrix}0 & -1 \\ -1 & 0\end{matrix}\right]$$ $\text{Sign Flip}$ can be decomposed as (in terms ...
5
votes
0answers
81 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-...
7
votes
1answer
364 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 ...
8
votes
3answers
183 views

Does conditional gate collapse controller's superposition?

I've created a simple circuit in Q-Kit to understand conditional gates and outputted states on each step: In the beginning there is clear 00 state, which is the input The first qubit is passed ...
5
votes
1answer
64 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-...
6
votes
2answers
145 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 ...
9
votes
2answers
564 views

CNOT Gate on Entangled Qubits

I was trying to generate Greenberger-Horne-Zeilinger (GHZ) state for $N$ states using quantum computing, starting with $|000...000\rangle$ (N times) The proposed solution is to first apply Hadamard ...
3
votes
1answer
73 views

Doing maths with controlled-half NOTs

In Quantum Computation with the simplest maths possible there is a section titled "Doing maths with a controlled-half NOT" which covers a reversible-(N)AND circuit with controlled-half NOTs. What ...
9
votes
3answers
734 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 ...
5
votes
0answers
134 views

Error: Simulation of “Quantum algorithm for linear systems of equations” for $4\times 4$ systems on Quirk (without SWAP) - Global phase

Following @DaftWullie's answer I tried to simulate the circuit given in Fig. 4 of the paper (arXiv pre-print): Quantum circuit design for solving linear systems of equations (Cao et al, 2012), on ...
6
votes
1answer
113 views

SWAP gate(s) in the $R(\lambda^{-1})$ step of the HHL circuit for $4\times 4$ systems

Context: On the 5th page of the paper Quantum circuit design for solving linear systems of equations (Cao et al, 2012) there's this circuit: Schematic: A brief schematic of what's actually ...
7
votes
2answers
171 views

Matrix representation of continuous-variable gates

In the introduction to continuous-variable quantum computing by Strawberry Fields (Xanadu), it lists the primary CV gates (rotation, displacement, squeezing, beamsplitter, cubic phase) along with ...
3
votes
1answer
73 views

How the joint state of these qubits is derived?

Can someone show to me the steps to derive the joint state at the bottom of this image, please? I tried to follow his explanation but I didn't get the same results… This is taken from the lecture ...