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.

1
vote
0answers
8 views

Understanding CNOT gate for indirect measurement

I am trying to write a simple circuit to understand the process of finding the set of parameters such that the cost function of that circuit in question is minimized. For that I understand one has to ...
1
vote
3answers
36 views

Controlled Z gate acting on 3 qubits in matrix form

For a controlled Z gate $CZ_{1,2,3}$ acting on 3 qubits, which of the following is correct? If it is the first one then what is the difference between that and a CZ gate acting on qubits 1 and 3? $$I ...
3
votes
1answer
10 views

Bug in IBM backend?

I was trying to see what IBM would do under the hood with a CCNOT gate. Something appears to be erroneous with the run. The circuit above should produce state 11100 with 100% probability, as ...
5
votes
1answer
21 views

If the quantum Fourier transform efficient if only one control-phase is allowed in the gate set

I have seen Why can the Discrete Fourier Transform be implemented efficiently as a quantum circuit?. This is not a duplicate. I am familiar with the decomposition of the QFT from Nielsen&Chuang ...
1
vote
2answers
39 views

CX gate with Hadamard

Let's say we got a CX with a Hadamard gate on the control gate and any state at the target gate, will the target necessarily become a superposition of two states? Best.
3
votes
1answer
47 views

Implementing a complex circuit for a Szegedy quantum walk in qiskit

Problem definition I'm implementing a quantum circuit in qiskit for a Szegedy quantum walk, (reference, Fig 21.). It uses two registers of dimension $N$ ($N=3$) each one. The challenges I'm facing ...
10
votes
2answers
908 views

Is swap gate equivalent to just exchanging the wire of the two qubits?

Is swap gate equivalent to just exchanging the wire of the two qubits? if yes why not just switching the wire whenever we want to apply a swap gate?
1
vote
1answer
28 views

Perform quantum gate operations using state vectors and matrices

I am getting confused as to how to perform gate operations using matrices and am hoping someone will help me walk through this example. Say I want to perform a Pauli-X gate on the 3rd qubit in a 3-...
2
votes
2answers
50 views

How do I write a tensor product of conditional gates in matrix form?

I am writing a program where I need to find the eigenstates of an operator that is a Kronecker product of conditional quantum gates. I am wondering how I would compute this product in matrix form as ...
6
votes
0answers
33 views

Sequential circuit using quantum gates

Without feedback/loop how can we build a sequential circuit? The basic feature of sequential circuit is that is depends not only on the current inputs but also on the previous inputs/outputs. I've ...
3
votes
1answer
55 views

Quantum Fourier Transform without SWAPs

The Quantum Fourier Transform from Nielsen and Chuang chapter 5 is pictured here: In the textbook the author refers to "swap gates at the end of the circuit which reverse the order of the qubits". ...
2
votes
0answers
39 views

How can I express controlled unitary operation in QPE of this implementation of HHL?

I have found this implementation of HHL, and I don't understand why the controlled unitary operation is expressed in the form of $\exp(i t_0 A/2)$ and $\exp(i t_0 A/4)$. The rotation of $\pi$ and $\...
3
votes
2answers
67 views

Expressing CNOT in the eigenbasis of $X$ (Preskill lecture notes eq. 7.6)

In chapter 7, equation 7.6 says CNOT works as follows: CNOT: $\frac{1}{\sqrt{2}} (|0\rangle + |1\rangle )\otimes |x\rangle \rightarrow \frac{1}{\sqrt{2}} (|0\rangle + (-1)^x |1\rangle ) \otimes |x\...
3
votes
1answer
48 views

How to implement the XY Heisenberg interaction using IBMQ and Qiskit?

A possible way to implement the 2 qubit Heisenberg XYZ model using a Quantum computer is to decompose the Hamiltonian as follows: $$H_{XYZ} = H_{XY} + H_{YZ} + H_{XZ}$$. In this case, these operators ...
2
votes
0answers
44 views

Restoring an initial state after computation

Let me first tell my problem statement. Suppose I have a uniform superposition of states $$|A\rangle=\dfrac{1}{2^{9}}\sum_{i,j,k=0}^{2^6-1}|0\rangle^{\otimes 8}|i\rangle|j\rangle|k\rangle,$$ where $|0\...
3
votes
1answer
74 views

2-qubit QFT in IBMQ: controlled phase rotation

I've started getting into quantum computing in the last few days. As part of the learning, I've figured it would be fun to implement some circuits on IBMQ Experience as I learn. So now I'm stuck with ...
4
votes
0answers
36 views

IBM Q devices scheduling of gates with different durations

I was trying to figure out how scheduling works in IBM devices. The thing that's bugging me is that in the quantum computer implementations I had seen before, the cycle concept is used. Say, for ...
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 ...
2
votes
0answers
51 views

Tensorial notation for this quantum XOR circuit

Suppose I have this quantum XOR circuit; this is a quantum circuit for the classical XOR operation $$\begin{eqnarray*} x_1'= x_1\oplus x_2\oplus x_3\oplus x_4,\\ x_2'=x_2\oplus x_3\oplus x_4\oplus x_5,...
1
vote
1answer
47 views

Quantum operation in blocks

I have $n$ states in superposition $|A\rangle=\dfrac{1}{2^{l/2}}\sum_{i=0}^{2^l-1}\sum_{j=0}^{2^l-1}|0\rangle^{\otimes q}|i\rangle^{\otimes l}|j\rangle^{\otimes l}$. Now I have to apply the transform ...
2
votes
1answer
88 views

How to construct a CCY gate in Qiskit

How can one construct a CCY gate using gates which are native to Qiskit (CCX and single qubit gates). I was able to find the answer for CCZ gates, however guessing and testing until I can figure out ...
2
votes
1answer
51 views

Are these notations for the CCNOT gate with different controls correct?

Following this answer by @DaftWullie, I give what I think of different cases of the CC-NOT gate: $I\otimes I\otimes I+ P_0\otimes P_0\otimes(U-I)$ is the CC-NOT operator when the first two controls ...
3
votes
2answers
117 views

Writing the notation when gates act on non successive registers

Suppose I have registers $|a\rangle^{l}|b\rangle^{l} |c\rangle^{l}$ and want an adder mod $l$ gate between the $a$ and $c$ registers. Let $R$ be the adder mod $l$ gate. So is this the correct ...
2
votes
0answers
55 views

Grover diffusion operator different gates

I have two gates here for the Grover diffusion operator. The first gate is completely understandable for me, so I implemented it myself after submitting some papers that I read. This is the first ...
4
votes
1answer
75 views

Most efficient way for general state generation

Assume we are given an $n$-qubit system and complex numbers $a_0, \ldots, a_{m-1}$ with $m = 2^n$. Assume further we start with the initial state $|0 \ldots 0\rangle$ and want to make the ...
3
votes
1answer
57 views

Permutation of initialized states

Suppose I have an initial state: $$|A\rangle=\dfrac{1}{2^{3l/2}}\sum_{x=0}^{2^l-1}\sum_{y=0}^{2^l-1}\sum_{z=0}^{2^l-1} |x\rangle^{\otimes l}|y\rangle^{\otimes l}|z\rangle^{\otimes l}|0\rangle^{\otimes ...
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. $$\...
2
votes
1answer
155 views

Circuit construction and Dirac notation of the following operation

I have a state $$ |\tilde{\Phi_2}\rangle =\dfrac{1}{2^{3l/2}}\sum_{x=0}^{2^l-1}\sum_{y=0}^{2^l-1}\sum_{z=0}^{2^l-1}|0\rangle^{\otimes q}\otimes |x\rangle^{\otimes l}\otimes |y\rangle^{\otimes l}\...
3
votes
1answer
73 views

Why does a quantum circuit consist of simple quantum gates which act on at most a fixed number of qubits?

While reading the Quantum algorithm Wikipedia entry, I noticed that the sentence "A quantum circuit consists of simple quantum gates which act on at most a fixed number of qubits", was annotated with ...
4
votes
1answer
95 views

What applications does the quantum gate [(i,1),(1,i)] have?

I've been working through the great introduction to quantum computing on Quantum Country. One exercise there is to find a possible quantum gate matrix that is not the $X,I$ or $H$ matrix. I thought ...
2
votes
3answers
101 views

What is the spectral decomposition of the Pauli $X$ gate?

The definition of spectral decomposition is as follows: Assume the eigenvectors of $\hat{A}$ define a basis $\beta=\{|\psi_j\rangle\}$. Then $$A_{kj}=\langle\psi_k|\hat{A}|\psi_j\rangle=\alpha_j\...
1
vote
1answer
55 views

Implementing a controlled sum operation

I want to implement a controlled operation that involves the following: we have the following qubits: $|x_0\rangle,|x_1\rangle,|0\rangle,|1\rangle,|z_0\rangle,|z_1\rangle$. I want to add the first ...
1
vote
1answer
38 views

Matrix representation of multiple qubit gates (Hadamard transform on single wire)

I would like to know how the unitary matrix for this circuit looks like: I'm not sure but I would try something like this: First part: $\begin{pmatrix}1&0\\0&0\end{pmatrix}\otimes H_1=\...
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 ...
3
votes
1answer
106 views

Defining standard qubit gates for qutrits

I am actually working on quantum computing with qutrits. I am trying to define standard qubit gates for qutrits. The CNOT gate for qubits is defined as follows: $$|x,y\rangle \to |x,y+x \bmod 2\rangle....
1
vote
1answer
57 views

Order of controls and targets of cnx gates in Qiskit (Python)

In the following piece of code: cnx(qwc, q[0], q[1],q[2],q[3]) in what order control qubits and target qubit are? Which qubit is inverted for which values of ...
3
votes
1answer
97 views

How does the cnx gate work in Qiskit (Python)?

Could somebody explain the cnx operator, and how it operates on its qubit parameters to flip the target qubit in Qiskit (Python)?
3
votes
1answer
63 views

Cost of implementing Boolean function quantumly?

Say, I wanted to implement a unitary $U_f$ to compute a Boolean function $f:B_n \to B_n$. This is done by the unitary $$U_f|x\rangle | y \rangle = |x\rangle|y\oplus f(x)\rangle$$ which one can ...
2
votes
2answers
59 views

CNOT's control qubit preceded by Hadamard: Why is sqrt also applied to target qubit?

I'm going through the Quantum computing for the very curious (Matuschak & Nielsen) tutorial. The example shows a $\operatorname{CNOT}$ gate where the input of the control bit is preceded by a ...
6
votes
4answers
401 views

Controlled Hadamard gate in ZX-calculus

What is the representation of the CH gate in ZX-calculus? Is there a general recipe for going from a ZX-calculus representation of a gate to the representation of the controlled version?
3
votes
1answer
66 views

How to interpret the matrix representation of a quantum gate?

I am trying to understand how the quantum gates work, so I started with the simplest one, the Pauli X gate. I get that it turns $|0\rangle$ into $|1\rangle$ and $|1\rangle$ to $|0\rangle$. So my ...
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, ...
2
votes
0answers
59 views

Writing the transformation matrix for the following in terms of Kronecker products of elementary 2-qubit gates

I have a set of transformations that transforms $|11001\rangle\to |10101\rangle$ which is basically keeping the leftmost qubit as it is and then it is just the CNOT between the successive qubits, I ...
3
votes
2answers
172 views

Square root of CNOT and spectral decomposition of the Hadamard gate

I'm trying to compute the spectral decomposition of the Hadamard gate but I'm making a mistake somewhere. Note: I believe (though I may be wrong so correct me if I am) that spectral decomposition is ...
3
votes
2answers
202 views

What does it mean to express a gate in Dirac notation?

When discussing the Dirac notation of an operator, for example, let's just say we have the bit flip gate $X$ if we want to write this in the Dirac notation does that just mean writing it as follows? $...
1
vote
1answer
41 views

Error in showing $\operatorname{CPHASE}_{12}=\operatorname{CPHASE}_{21}$ in the matrix representation

I read that the relation $\operatorname{CPHASE}_{12}=\operatorname{CPHASE}_{21}$ in the matrix representation but when I tried to work it out I don't see how. $\operatorname{CPHASE}_{12}$ acts in the ...
6
votes
2answers
93 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, \operatorname{CNOT}$. I understand how these gates act on qubits, but what do they ...
3
votes
2answers
108 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 ...