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 [quantum-gate]

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

2
votes
1answer
25 views

How should we interpret these quantum logic gates as physical observables?

In quantum mechanics each operator corresponds to some physical observable , but say we have the operators $X,Y,Z,H, CNOT$. I understand how these Gates act on qubits, but what do they actually ...
1
vote
1answer
29 views

Why do we need reversibility

Suppose we have qubit $|a\rangle$. and we want to implement quantum addition say adding $|a\rangle$ and $|a\rangle$. When drawing the circuit for this operation one of the outputs that we get is ...
2
votes
2answers
48 views

What is the tensorial representation of the quantum swap gate?

I need to write the tensorial representation of the Controlled Swap Gate, what i have written is $\operatorname{CSWAP}=|0\rangle\langle0|\otimes I\otimes I+|1\rangle\langle1|\otimes U$, where U is ...
3
votes
1answer
46 views

Reversible crypto systems for use in the Grover's algorithm

I'm working on some papers (here and here) that use the Grover algorithm to crack krypto systems like AES and SHA. I had already asked a first question here. Now, however, a new question has arisen ...
4
votes
1answer
67 views

Controlled unitary from the HHL algorithm – practical implementation using Qiskit

I have a question about the implementation of the controlled unitary $e^{iAt}$, from the paper Demonstration of a Quantum Circuit Design Methodology for Multiple Regression, using the Qiskit framework....
2
votes
1answer
116 views

Quantum addition and modulo operation using gates

I have a matrix equation $X_{\text{new}}=AX_{\text{old}}$, where $A=\begin{bmatrix}1 & 1 & 1\\ 2 & 3 &2\\ 3&4&4 \end{bmatrix}\bmod 64$, and $X_{\text{old, new}}\in \{1,2,...64\}...
1
vote
1answer
474 views

Preparing odd integers using quantum computation

This is just a basic question. I need to output odd integers till $15$, i.e $1,3,5,7,9,11,13,15$. Since $15$ requires $4$ bits, I prepare initial state by using Hadamard gate on initial $|0\rangle$, i....
3
votes
1answer
132 views

Quantum Toffoli gate equation

I was reading a research article on quantum computing and didn't understand the tensor notations for the unitary operations. The article defined two controlled gates. Let $U_{2^m}$ be a $2^m \times 2^...
3
votes
1answer
98 views

How to prove universality for a set of gates?

Which of the following sets of gates are universal for quantum computation? {H, T, CPHASE} {H, T, SWAP} And how do we prove it?
2
votes
1answer
43 views

Calculating entries of unitary transformation

Let $U$ be a unitary $n$-qubit transformation that applies a Hadamard on the $k$-th qubit and the identity on all the others. How would I go about calculating $U_{ij}=\langle i | U | j \rangle$ in ...
3
votes
1answer
71 views

Are there any other published quantum factoring algorithms that are simpler or more efficient than Shor’s?

How many qubits and what is the minimum number of gate operations needed to factor an n-bit integer? Are there any other published algorithms that are simpler or more efficient?
3
votes
2answers
70 views

What are the individual probabilities after √SWAP gate?

Say, qubit $\left|a\right\rangle = \alpha_1|0\rangle + \beta_1|1\rangle$ and $|b\rangle = \alpha_2|0\rangle + \beta_2|1\rangle$. After $\sqrt{\text{SWAP}}$(a,b) what are new probability amplitudes of ...
4
votes
4answers
129 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&...
1
vote
1answer
31 views

Is there an inherent difference in need for error correction between quantum annealing and gate based methods?

When I read about computing using gate based methods, I mainly read about the difficulties with error rates, circuit depth (and connectivity) and not enough qubits. With computing using quantum ...
2
votes
1answer
78 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 \...
5
votes
2answers
482 views

How to prove that the query oracle is unitary?

The query oracle: $O_{x}|i\rangle|b\rangle = |i\rangle|b \oplus x_{i}\rangle$ used in algorithms like Deutsch Jozsa is unitary. How do I prove it is unitary?
4
votes
1answer
95 views

Understanding quantum circuit diagrams: a circuit that compares two states $|YX\rangle$ and $|AB\rangle$

I have a quantum circuit which I would like to understand, which compares two standard basis states $|YX\rangle$ and $|AB\rangle$. It operates on the corresponding bits in each of the two states: i.e.,...
2
votes
0answers
35 views

N&C quantum circuit for Grover's algorithm

In the chapter about the Grover algorithm, it is suggested that the gate which executes the phase shift is given in the following form: Now I have looked at this gate in detail and come to the ...
5
votes
3answers
81 views

Summing states of two qubit registers

I'm addressing the implementation with gates of an algorithm where there is the need of creating a qubit register $|\Psi\rangle$ starting from two input qubit registers $|a\rangle$ and $|b\rangle$, ...
1
vote
1answer
40 views

Explanation of the function of the circuit

I once experimented with the tool "quirk" and came to a gate, whose function I can not properly tap into. I'm working in the circuit with 4 bits, the last bit is negated, so from 0 to 1. On all 4 bits ...
2
votes
2answers
67 views

How do I embed classical data into qubits?

How do I embed classical data into qubits? I have a classical data [0 1] and I want to encode it as quantum amplitude to a superposition? What are the gates used to achieve that? I am a beginner to ...
0
votes
0answers
28 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
179 views

How to understand the operators for watermarking schemes?

Note: Cross-posted on Physics SE. I am reading a research article based on quantum image watermarking (PDF here). The authors have defined some unitary transforms for the watermarking schemes, which ...
4
votes
1answer
174 views

How to complete this teleportation circuit? How to create a copy of $|\psi〉$?

This is a quantum circuit. M represents the act of making a measurement on the first two qubits. The circuit is supposed to transfer the state $|\psi\rangle = a |0\rangle + b |1\rangle$ ($a, b \in \...
2
votes
1answer
65 views

Implementing an oracle

Suppose $x$ is an $N=2^n$ elements database. Let's define a $2N$-bit database with $y \in \{0,1\}^{2N}$ indexed by $(n+1)$-bit strings $j=j_1\ldots j_n j_{n+1}$, where \begin{align} y_j=\begin{cases}...
2
votes
1answer
38 views

How to implement such a gate where one input bit is zero and the other is one and the output should be one?

I have created 10 qubits, where I have set 2 in superposition by applying Hadamard gate to each of the 2 qubits. So the 2 qubits state can be $|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle$. I ...
2
votes
1answer
77 views

How do you implement the gates for Grover's algorithm for more than 4 elements?

I am currently working intensively on the Grover algorithm and have understood the individual "building blocks" of the algorithm so far. There are also references in the literature to Nielsen, e.g. an ...
5
votes
2answers
58 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 ...
2
votes
1answer
49 views

Rotation operator on Pauli parity gates $XX$, $YY$ and $ZZ$

If we suppose that $XX$ is the tensor product of $X$ with $X$ such as $XX = X \otimes X$ How would we calculate the rotation operator of this $XX$ gate. Does this work? If so why? $$ R(XX)_\theta = ...
5
votes
1answer
70 views

Where is the factor of $-i$ in rotation gates coming from?

As I understand it the Pauli-X, Y and Z gates are the same as their rotational gates with a rotation of $\pi$. But given the expression for those gates, I find that there is a factor of $-i$ in each ...
4
votes
1answer
65 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 ...
1
vote
2answers
58 views

Why isn't the circuit performing a measurement in the Bell basis?

Nielsen and Chuang (on page 188 exercise 4.33) says that the circuit including CNOT and Hadamard is performing a measurement in the Bell basis. But I can't see how. The matrix representing the ...
2
votes
1answer
43 views

Computing with qutrits

I'm doing some calculations with qutrits and I need a unitary matrix $U$ that does the following: $$U|00\rangle = |12 \rangle - | 21\rangle $$ $$U|11\rangle = |20 \rangle - | 02\rangle $$ $$U|22\...
2
votes
1answer
62 views

The meaning of measurements in different bases

There are other similar questions. But I don't understand the answers. Suppose I express $a|0⟩+b|1⟩$ in the form $\frac{c}{\sqrt2}(|0⟩+|1⟩)+\frac{d}{\sqrt 2}(|0⟩−|1⟩)$ where $a,b,c,d∈\mathbb C$. ...
2
votes
2answers
58 views

How is $X^q$ equal to $RX(\pi q)$?

I've seen in google cirq that a $X^q$ gate is converted in openqasm to $RX(\pi q)$, why is that? Same for $S^q$ into $RZ(\pi q/2)$.
2
votes
1answer
60 views

What's the point of quantum gates being 'continuous'?

Besides the 'continuous' which I don't fully understand the term. It's all the time said that arbitrary gates can only be estimated but not necessarily be accurate. I don't understand the claim. So ...
2
votes
2answers
127 views

The relationship between entanglement of vector states to matrix operations

I don't understand something which is I believe pretty fundamental. It's said that an operation represented by a matrix A is an entanglement if A can't be written as a tensor product of other matrices....
2
votes
1answer
147 views

What is the meaning of the state $|1\rangle-|1\rangle$?

I don't understand it. But suppose you have a state of two qubits in superposition and it looks like $|10\rangle-|11\rangle$. Now you have in your circuits two gates one is a controlled-NOT from the ...
1
vote
0answers
31 views

Qiskit gates in LaTeX representation: notation meaning [duplicate]

I started working in Qiskit, and here is an example of how gates of a circuit are represented graphically in LaTeX format: Obviously, $R_y(\theta)$, is a y rotation by a certain angle. But all the ...
2
votes
1answer
80 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 ...
7
votes
2answers
101 views

Equivalent unitary transformations

Suppose $x \in \{0,1\}^n$. The standard way to make a query is with an oracle $O_x$ that given an input $|i,b \rangle $ returns $|i,b \oplus x_i \rangle$. Via the phase kick-back trick, this can be ...
2
votes
1answer
167 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
66 views

ProjectQ - In which part of the controlled gate object are the control bits scored

I've been trying to decompose the ProjectQ objects and I could manage to decompose non-controlled gates and daggered gates. But I noticed that the object of a controlled version of a gate is the ...
0
votes
1answer
86 views

Why does $|P_U − P_V |$ equal $\langle \psi |U^{\dagger} M U|\psi\rangle −\langle \psi |V^{\dagger} M V |\psi\rangle$?

In QC and QI by Chuang and Nielsen, they state that the $P_U$ of operation $U$ acting on $\psi$ can be reached by $\langle \psi |U^{\dagger} M U |\psi\rangle$. Where $P_U$ (or $P_V$) is the ...
6
votes
1answer
55 views

If $|\psi\rangle, U|\psi\rangle$ are known, how many pairs of such qubits are required to find the operator $U$?

Assume that we know a quantum state and the result of applying an unknown unitary $U$ on it. For example, if the quantum states are pure qubits, we know $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$ ...
2
votes
1answer
79 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
2answers
215 views

SWAP test inputs

I'm using the SWAP test circuit for implementing a qubit registers comparison From the documentation I could find I've understood it can be applied to input qubits |$\alpha\rangle$ and |$\beta\...
3
votes
0answers
48 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 ...
1
vote
3answers
132 views

Is it correct to say that we need controlled gates because unitary matrices are reversible?

I am new to quantum computing and saw this argument on this site but I don't understand it. First of all, I don't understand what is exactly meant by 'reversible'. Because even if you had a unitary ...
4
votes
2answers
320 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 ...