New answers tagged

0

But I dont understand that why we have not bunch of zeros as our output again?


0

Joseph's answer explains a lot of this already but I just want to give a much simpler answer in case others have the same question: "Why is there two H over here? I thought it would be just H * Cnot?" To put the $X$ matrix into the $H$ basis, simply calculate $H^{-1}XH$ as you can see here. Since $H^{-1} = H$, the expression is as given in the ...


3

The key observation is that commuting $X$ through a $Y$ rotation changes the sign of the rotation angle $$ XR_y(\theta) = R_y(-\theta)X. $$ In order to understand how the circuit gives rise to a Toffoli-like gate, we consider three cases. First, suppose that $a$ is in the state $|0\rangle$. Then $CNOT(a, c)$ acts as identity and the sequence simplifies as $$...


1

To add on top of @Davit answer. Suppose you want to do certain operations, in this case is Controlled-S or Controlled-T, and it is not directly implement on the circuit composer. But you want to use the circuit composer to have better visualization of the circuit. What you can do is to create these gate directly in Qiskit and decompose to OpenQASM code, ...


2

A way around :) Controlled-$P$ version for any $P$ phase gate. Note that as is mentioned in the previous answer $P(\pi/2) = S$, $P(\pi/4) = T$ and $P^\dagger (a) = P(-a)$. The circuit for controlled-$P(a)$ looks like this where q[0] is the control qubit. The proof: $$ I P(a/2) \big[|0\rangle \langle 0|I + |1\rangle \langle 1| X \big] I P(-a/2) \big[|0\...


4

I am not sure why, but you cannot add controls to $T$ or $S$ (and their inverses) in the composer. What you can do is instead use the Phase gate (which you can add a control to) and set these angles for identical behaviour: $P(\pi/2) = S$ $P(\pi/4) = T$ $P(-\pi/2) = S^\dagger$ $P(-\pi/4) = T^\dagger$


3

Qubit states at points A, B and C Let the input pure state be $|\psi\rangle = a|0\rangle + b|1\rangle$. At point A the state is simply $$ |\psi_A\rangle = |\psi\rangle = a|0\rangle + b|1\rangle $$ since there are no gates that change the input state before the point A. At point B the state is $$ |\psi_B\rangle = H|\psi\rangle = \frac{a}{\sqrt{2}}(|0\rangle + ...


4

By definition, the Hadamard gate can be written in the computational basis as: $$ H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1& 1\\ 1 & -1 \\ \end{pmatrix}$$ Now, note that applying a Hadamard gate to the state, says, $|\psi \rangle = |0\rangle$, then it is equivalent to be doing the following rotation: So what if you apply another Hadamard gate? What ...


1

This playlist by QuTech Academy on the 'building blocks' of a quantum computer might offer some nice insights. Video $10$ & $11$ introduce spin qubits, with the second video specifically on the operations on spin qubits. Video $12$ & $13$ introduce NV centre qubits, with again the second video specifically on the operations on spin qubits. Video $...


4

Your approach is correct. In particular, sandwiching a controlled rotation between two CNOT gates is a common technique for implementing rotations on the $|01\rangle, |10\rangle$ subspace on hardware that does not implement it natively. We can justify your approach using the fact that if $A$ has eigendecomposition $$ A = \sum_i \lambda_i|i\rangle\langle i| $$...


1

The unitary operations of the phase estimation algorithm are mainly controlled phase rotations of an angle that must be specified in the algorithm. This angle that you specify is the phase that you want to estimate. So the first counting qubit will make one rotation the second will make two, qubit 3 will make 4 rotations ... up to 2 ^ t-1 rotations on the ...


3

The objective of all those gates is to put the quantum state in a "nice form" to manipulate. Let me explain. Let's note $U |\psi \rangle = e^{2i\pi\theta}|\psi\rangle$ all the variables we are interested in, meaning we want to find $\theta$ here. After applying all the Hadamard gates and the $U^{2^j}$, the state looks like this : $$ \frac{1}{2^{n/2}...


0

You can find some information about gates implementation here in this article: Realization of efficient quantum gates with a superconducting qubit-qutrit circuit Although the proposed setup is rather experimental, it may give you some ideas how to implement gates on computers with superconducting qubits.


1

I found this interesting article that talks about creating a Fredkin quantum gate (controlled SWAP) : https://advances.sciencemag.org/content/2/3/e1501531 I hope this can help you in your search.


2

Here is a way to implement multi-controlled RX gate if you interested: from qiskit import QuantumCircuit,QuantumRegister from qiskit.circuit.library.standard_gates import RXGate from qiskit.circuit import Parameter import matplotlib.pyplot as plt qr=QuantumRegister(4) circ=QuantumCircuit(qr) a=Parameter('a') # You can replace a with pi here CCCRX=RXGate(a)....


0

It is normalized by dividing with the modulus or magnitude which is sqrt of (eigenvalue1 * 2 + eigenvalue2 * 2) = sqrt(2)


2

The $\dfrac{1}{\sqrt{2}}$ is the normalization constant to make sure the state/eigenvector is a unit vector. Note that: if $|\psi \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} $ then $\bigg| \bigg| |\psi \rangle \bigg| \bigg| = |1/\sqrt{2}|^2 + |1/\sqrt{2}|^2 = 1 $. The reason for this is because in quantum mechanics, states are always ...


4

This is an application of the following identity $$ Be^AB^{-1} = e^{BAB^{-1}}\tag1 $$ where $A$ is any $n\times n$ real or complex matrix and $B$ is any invertible $n\times n$ real or complex matrix. Proof of $(1)$. First, recall that the matrix exponential of $A$ is defined as $$ e^A = \sum_{k=0}^\infty \frac{1}{k!}A^k. $$ Next, note that for any integer $k$...


0

Just to sort of "talk out" the conceptual difficulty of a "superposition of gates" would be (which was discusssed in a more abstract way by @Adam Zalcman), let's try to conceptually think of an experiment where it would be reasonable to say there's a "superposition of two gate operations." Consider the following experiment: Our ...


3

Let us denote Hadamard with $H$ and the two Hamiltonians as $H_H$ and $H_{CNOT}$, i.e. $$ H = \exp (-iH_H) \\ CNOT = \exp (-iH_{CNOT}). $$ We will make use of the fact that for any normal matrix $A$ with eigendecomposition $$ A = \sum_i \lambda_i |i\rangle\langle i| $$ and for any analytic function $f$, we can compute $f(A)$ by applying it to eigenvalues $$ ...


1

You can also characterise the full set of (normal) square roots of a normal matrix via its eigendecomposition. Let $\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert}A=\sum_k \lambda_k \ketbra{\lambda_k}$ be a matrix with eigenvalues $\lambda_k\in\mathbb C$ and eigenvectors $|\lambda_k\rangle$. Then $$\sqrt A = \sum_k \sqrt{\lambda_k} \ketbra{\...


4

Extending the relationship between $SU(2)$ and $SO(3)$ to higher dimensions The analogy for understanding single-qubit gates in terms of $SO(3)$ is provided by an accidental isomorphism $Spin(3)\cong SU(2)$ where the spin group $Spin(n)$ is the double cover of $SO(n)$. As the name suggests, the isomorphism is not part of a recurring pattern, so the answer to ...


3

In Quirk and in Cirq, the convention used is that the +1 eigenvalue square roots into 1 (as opposed to -1) and that the -1 eigenvalue square roots into $i$ (as opposed to $-i$). More generally, you pick some convention for mapping a unitary eigenvalue $c$ into an angle $\theta$ where $e^{i \theta} = c$, and then define the gate raised to the power $p$ to use ...


3

Mathematically a natural choice is to take the square root of the Polar decomposition $A=UP$. Recalling that any complex matrix $A$ can be written as $UP$ for unitary $U$ and positive-semidefinite matrix $P$. The polar decomposition is unique so $P$ has a unique well-defined square root as a positive hermitian matrix. As the convention here is to take the ...


1

cu1 and crz are different gates and the difference is explained in this answer. One can express $cS$ and $cT$ gates with cu1 gate, but it is impossible to express them with crz gate. $$ cS = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&1&0 \\ 0&0&0&i \\ \end{pmatrix} = cu1(\pi/2) \qquad cT = \begin{pmatrix} 1&...


2

In Qiskit you can get the controlled version of any gate with the method control. For S and T, here is the example: from qiskit.circuit.library.standard_gates import SGate, TGate csgate = SGate().control(1) # the parameter is the amount of control points you want ctgate = TGate().control(1) circuit = QuantumCircuit(2) circuit.append(csgate, [0, 1]) circuit....


3

First note that $H = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix} $ and $|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} $ and $|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$ Hence $H|0\rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \dfrac{1}{\sqrt{2}}\...


4

Controlled Z gate is symmetric with respect to the two qubits. Its action in the computational basis is to leave the states $|00\rangle$, $|01\rangle$, $|10\rangle$ unchanged and to flip the phase of the state $|11\rangle$. Consequently, it does not matter which qubit we designate as control: it flips the phase only if both qubits are in state $|1\rangle$. ...


1

This is nothing but a controlled-unitary gate. The only difference to an "ordinary" controlled-unitary is that now, the control qubit is encoded in the overall state of the device that implements the unitary.


10

The gate in which you're interested: would more often be called $X_1X_2I_3$ rather than $¬_a ¬_b I_c$, because we use $X$ to denote the NOT gate more often than we use $¬$. However it is very unlikely that $X_1X_2I_3$ is given a new name, because there's nothing going on other than just two $X$ gates. CNOT has a name because the "C" part in CNOT ...


6

Welcome to QCSE. You seem to have gotten some of the gist of quantum gates but don't be surprised if every such gate is promoted to having a specific, universally recognized name. A reason some gates such as $\mathsf{CCNOT}$ (Toffoli) or $\mathsf{CCSWAP}$ (Fredkin) have such a name is because they have been found to be useful and are a shorthand for the ...


Top 50 recent answers are included