People who code: we want your input. Take the Survey

# Tag Info

## Hot answers tagged quantum-gate

20

I'd say it's far more common for quantum algorithms to use billions of gates than thousands. And that's assuming you're ignoring Clifford gates as well as error correction overhead! If you want to count those, add in another factor of a million. For example... According to Table III of https://arxiv.org/abs/2011.03494 , quantum chemistry algorithms looking ...

9

First, note that the Controlled-X gate can be written as: $$CX = |0\rangle \langle 0| \otimes I + |1 \rangle \langle 1| \otimes X$$ This tells us that the first qubit is the controlled, and the second qubit is the target. And when the controlled qubit is $|0\rangle$ we do nothing hence the Idenity operator. When the controlled-qubit is a $|1\rangle$ we ...

8

No this is not possible. One argument is the following: Toffoli + Hadamard are universal for quantum computation, so if you can make Toffoli from controlled-not then controlled-not + Hadamard would be universal. However, we know (Gottesman-Knill theorem) that the effects of controlled-not + Hadamard can be classically simulated, and so if we believe that ...

6

Qiskit supports translating to different continuous basis sets by specifying the basis_gates in the transpile method. So in your case you could just do >>> from qiskit import QuantumCircuit, transpile >>> from qiskit.circuit import Parameter >>> circuit = QuantumCircuit(1) >>> circuit.ry(Parameter('theta'), 0) >>> ...

4

Great observation! The devices are calibrated daily(ish) and sometimes a bad calibration requires a "rerun". The value 1 is some sort of flag that something went wrong with the calibration. Noise-aware transpilation algorithms will try to avoid that gate as will be presented as particularly noisy. Thanks @paul-nation for the help answering this ...

4

Here's a simple example if you're looking for a quick hack: import pennylane as qml import numpy as np def RXX(theta): rxx = np.array([ [np.cos(theta/2), 0, 0, -1j*np.sin(theta/2)], [0, np.cos(theta/2), -1j*np.sin(theta/2), 0], [0, -1j*np.sin(theta/2), np.cos(theta/2), 0], [-1j*np.sin(theta/2), 0, 0, np.cos(theta/2)] ]...

4

Yes, as long as you change the order of the gates without changing the qubits on which each gate acts. Proof: All phase gates are represented by diagonal unitary matrices. If $A$ has a diagonal matrix then controlled-$A$ also has a diagonal matrix. Therefore, all gates in your set of gates have diagonal matrices. Conclusion follows from the fact that ...

3

I'm going to label my 3 parties by A, B, C (just to be awkward). If we consider a bipartition of A|BC, we know that a general state can be written in the form $$U_A\otimes I_{BC}(\alpha|0\rangle_A|\psi_0\rangle_{BC}+\beta|1\rangle_A|\psi_1\rangle_{BC})$$ where $|\psi_i\rangle$ are mutually orthogonal and may be entangled. This is just the Schmidt ...

3

If you want to be more precise about it, quantum (pure, ket) states are elements of complex projective spaces, $\mathbb{CP}^n$. This is the set of equivalence classes of elements of $\mathbb C^{n+1}$ modulo multiplication by complex scalars. So "gates" should really be described as maps between such equivalence classes. This is the projective ...

3

Two states that are the same up to a global phase are physically indistinguishable; some even go as far as to say that they are exactly the same state. Any $U_{1}$ and $U_{2} = e^{i\alpha}U_{1}$ will thus give physically indistinguishable states, meaning that there is nothing that $U_{2}$ can do that $U_{1}$ cannot. Would a quantum processor restricted to ...

3

I didn't go through the attached pdf. But if you want to find a unitary matrix $U$ that maps a quantum state $|\psi \rangle$ to $|\phi\rangle$ then you can use the Householder transformation as I commented. Here the two vectors have the same length (they are unit vectors) because we are thinking of them as a quantum state, so there will always exist a ...

3

The phase gate $$S=\begin{pmatrix}1&0\\0&i\end{pmatrix}=\sqrt{\sigma_z}$$ satisfies $$S\sigma_x S^\dagger=\sigma_y,$$ where $\sigma_i$ are the Pauli matrices. So, once you know that $R_x=H R_z H$, you can immediately find $$R_y=SH R_z HS^\dagger.$$ You can also do $$R_y=-S^\dagger H R_z HS.$$

3

This is wrong for sure. And according to the book reviews on Amazon, this book is "unreliable", "riddled with errors", and "someone studying for the first time will get confused"

3

If your inputs are bits $b_1, ..., b_n$ and you can only use NOT gates and CNOT gates, then your outputs are always parities. Your outputs are always of the form $c_0 + \sum_{k=1}^n c_k b_k$ where $c_k \in \{0, 1\}$ are bits you can pick and also all arithmetic is modulo 2. For example, you can output $\lnot b_1$ and you can output $b_1 + b_3$ but you can't ...

3

Inspired by the discussion in @DaftWullie's answer above, note that we can construct a lattice/Hasse diagram of all classes of Boolean functions realizable/synthesizable with various gate sets. Such a lattice will indicate whether a given gate set is universal for the given class. For classical (not necessarily reversible) computation, Emil Post did this in ...

3

One thing you can do is zero noise extrapolation. The idea of the technique is to deliberately add noise to your circuit (by stretching the duration of the pulses of your circuit: Extending the computational reach of a noisy superconducting quantum processor or by adding extra gates that do nothing: Option Pricing using Quantum Computers) and then ...

3

Note that \begin{align}|\psi \rangle &= \frac {1}{2}(| 0 \rangle_1|\psi \rangle_2|\phi \rangle_3 + | 1 \rangle_1|\psi \rangle_2|\phi \rangle_3 + | 0 \rangle_1|\phi \rangle_2|\psi \rangle_3 - | 1 \rangle_1|\phi \rangle_2|\psi \rangle_3) \\ &= \dfrac{1}{2} |0\rangle \bigg( |\psi\rangle_2 |\phi \rangle_3 + |\phi\rangle_2 |\psi\rangle_3 \bigg) + \dfrac{...

3

An explicit construction that you can use to apply any power of an unknown unitary $U$ for which you have a circuit, is to perform phase estimation of $U$ applied to the current state $|\psi\rangle$, apply a phase gradient to the phase estimation register where the strength of the phase estimation determins the power of the gate, then uncompute the phase ...

2

Yes, all quantum circuits can be view as a $2^n \times 2^n$ unitary matrix as $n$ is the number of of qubits. Long way: For your circuits, first note the circuit identity: Now, using the circuit on the right, you can see that it can be written as $$U = \big(CNOT \otimes I\big)\cdot\big(I \otimes CNOT\big)\cdot \big(CNOT \otimes I\big)\cdot\big(I \otimes ... 2 I'm not sure that anybody really knows the answer to this. Ultimately, this comes down to error correction. Universal quantum computers will have built-in error correction (and, indeed, fault-tolerance) that allows them to perform arbitrarily large computations in an essentially noise-free way. To my knowledge (although I'm not an expert), while there has ... 2 It's worth noting that the Fourier transform implements$$ |\Psi\rangle=U_{QFT}|0\rangle=\frac{1}{\sqrt{2^n}}\sum_{j=0}^{2^n-1}e^{2\pi i\frac{j}{2^n}}|j\rangle, $$so for some particular choice of frequency, what you're effectively asking for is, up to normalisation,$$ \text{Im}(|\Psi\rangle). $$Now, there's a neat way to do this. There's a standard proof ... 2 IBM tutorial's representation of a general unitary matrix U(\theta,\phi,\lambda) can be derived as rotation of qubit on the Bloch sphere, in much the same way as the pdf reference has derived R_{\hat{n}}(\alpha). But, these are two different ways of doing the same operation, requiring different user inputs. R_{\hat{n}}(\alpha) considers rotation of ... 2 In this tutorial in PennyLane, they guide you to create a custom gate (Rxx gate) https://pennylane.ai/blog/2021/05/how-to-add-custom-gates-and-templates-to-pennylane/ After creating it you can simply use these code to add it: dev = qml.device('default.qubit', wires=3) dev.operations.add("RXX") 2 Basically what you want is anapplication of phase estimation. Take a look at this paper. To give a very crude summary. Imagine you have an eignevector |\lambda\rangle of a unitary U, and the eigenvalue is of the form e^{2\pi ip/2^t}. If you did phase estimation on that state, using a register of t qubits, you'd have$$ |\lambda\rangle|p\rangle  If ...

2

In QAOA you do not implement Hamiltonian $H$ itself but gate defined as $U = \mathrm{e}^{iHt}$. Since Hamiltonian $H$ is always Hermitian, operator $U$ is always unitary. You can see proof of this here. Concerning implementation of QAOA circuits, I would recommed this article. It contains discussion how to convert QUBO to Hamiltonian and in the appendix, ...

2

$X \otimes Z = \begin{pmatrix} 0 & 1\\ 1 & 0 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix} = \begin{pmatrix} 0 \cdot \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix} & 1\cdot \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix}\\ 1 \cdot \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix} & 0 \cdot \begin{... 2 Is it possible to construct such a black-box gate ?? No, the gate you're describing isn't possible. It's not unitary. You can't condition on amplitude thresholds, you can only condition on orthogonal states. 1 Dirac notations, as far as I have seen, concerns quantum states (kets) and their complex conjugates (bras). For gates, you could simply use the capitalized letter that represents the particular gate. For example,$H$for Hadamard gate,$X$for bit flip, and so on. Please note that, when you apply two quantum gates on the same quantum state, the notation ... 1 First note that your$P(\theta)$and$R_z(\theta)$gates are the same up to a global phase, so you will not be able to distinguish them. Now, according to qiskit.pulse.ShiftPhase documentation: The qubit phase is tracked in software, enabling instantaneous, nearly error-free Z-rotations by using a ShiftPhase to update the frame tracking the qubit state. So ... 1 Where does that single evaluation of$f(x)$actually occur? Is it in the construction of$U_f$?$U_f$is an implementation of$f$in quantum gates. The evaluation of$f$occurs in the course of applying the gates making up$U_f$to the qubits. What is$U_f$in this case? I realize it depends on$f$, but how can we build it using at most one evaluation of$...

Only top voted, non community-wiki answers of a minimum length are eligible