New answers tagged

1 vote

How can I produce the state $\frac{1}{\sqrt{2}^N} (|1,0^{N-1}\rangle + |01,0^{N-2}\rangle + ...+|0^{N-1},1\rangle)$

It is not possible to construct the above state using the specified gates. States that can be prepared using these gates are called stabilizer states. To quote this stack exchange post, "for a ...
  • 111
0 votes

How to shift the eigenvalues of a quantum Hermitian operator G to ±r?

Consider a gate $\mathcal{G}(\mu)=e^{-i \mu G}$ generated by a Hermitian operator G. If G has just two distinct eigenvalues(which can be repeated) we can, without loss of generality, shift the ...
  • 606
1 vote

How to shift the eigenvalues of a quantum Hermitian operator G to ±r?

Say the eigenvalues of $G$ are $\lambda_1, \lambda_2$ with $\lambda_1 \neq \lambda_2$. Writing the $2\times 2$ Hermitian matrix $G$ in its eigenbasis (we can pick any basis, since unitary ...
  • 5,610
1 vote

How can I implement an n-bit Toffoli gate?

EDIT: You can simply use mct gate: https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.mct.html As of Qiskit 'qiskit': '0.19.6', this process is ...
1 vote

Why does a bitwise product show up in Simon’s algorithm?

You can simply use the definition of the Hadamard gate: $$H|x\rangle=\frac{1}{\sqrt{2^n}}\sum_z(-1)^{x\cdot z}|z\rangle$$ Thus, we have: $$\begin{align} H\left(\frac{1}{\sqrt{2}}\left(|x\rangle+|y\...
1 vote
Accepted

Why does a bitwise product show up in Simon’s algorithm?

Can someone explain how the x and y jumped into the power, and somehow got the bitwise product operation performed on them? It is helpful to write out a few examples to see what is happening. 1-bit ...
  • 606
3 votes
Accepted

How to write the $iSWAP$ unitary as a linear combination of tensor products between 1-qubit gates?

ISWAP = + II * (0.5+0j) + XX * 0.5j + YY * 0.5j + ZZ * (0.5+0j) Output is from this code: ...
  • 28.7k
2 votes

How to write the $iSWAP$ unitary as a linear combination of tensor products between 1-qubit gates?

You can check that $$\mathrm{iSWAP}=\frac12(I\otimes I+iX\otimes X+iY\otimes Y + Z\otimes Z)$$
  • 1,973
4 votes
Accepted

Does every code have a strongly transversal Pauli group?

The [[4,1,2]] surface code, or any code with an even number of data qubits, either doesn't have a transversal X or doesn't have a transversal Z. Because logical X has to anticommute with logical Z, ...
  • 28.7k
2 votes

Transform Pauli basis to other basis

One way to do this consist in exploiting that the three Pauli matrices can be related to Cartesian axes of the Bloch sphere (SU(2) is the double cover of SO(3)). That means that you can perform ...
  • 1,973
2 votes
Accepted

How to implement the -I matrix using Pauli gates

If you add $-I$ gate, a $I$ gate or nothing, it is not going to make any difference because it is just a global phase. However if you still insist to get one, here it's the decomposition of $-I$ using ...
  • 1,973
2 votes

How to build the quantum circuit corresponding to a given unitary matrix?

There is a tool I am aware of called QNC which will perform this compilation down to basis gates. Additionally, the answer @SimoneGasperini gave is absolutely correct. I want to add though that once ...
4 votes
Accepted

What is $HTHTH\left| 0 \right>$?

... $$\frac{1}{2\sqrt{2}}[(1 - i + 2e^{i\pi/4})\left| 0 \right> + (1 + i)\left| 1 \right>]$$ ... However, the answer given at the back of the book (page 360) is (notice the $e^{i\pi/4}$ as ...
  • 606
3 votes

What is $HTHTH\left| 0 \right>$?

I quickly computed in Mathematica. You are correct. The book is incorrect.
0 votes

Transform Pauli basis to other basis

There is perhaps a better answer than this one. Still, one approach is to note that $\mathbb{C}^{2\times 2}\cong \mathbb{C}^2\otimes \mathbb{C}^2 \cong \mathbb{C}^4$ and recall the vectorization ...
  • 1,761
2 votes

How to build the quantum circuit corresponding to a given unitary matrix?

I was going to recommend BQSKit from Berkeley (link), but their gate synthesis default only goes to 4 qubits (there may be a way to extend that), Your operator has 5 qubits. For a walk on a circular ...
  • 823
4 votes
Accepted

How to build the quantum circuit corresponding to a given unitary matrix?

In Qiskit, you can do it by simply passing your unitary matrix to the QuantumCircuit.unitary method, specifying the qubits indices your operator is acting on. In ...
1 vote

How would you represent the $T$ gate in terms of rotations around the $X$ and $Y$ axes?

As already mentioned by Mauricio in his answer, you can express the $T$ gate as a combination of rotations around the $X$ and the $Y$ axes (up to a global phase). In particular, this is how you can ...
1 vote

How would you represent the $T$ gate in terms of rotations around the $X$ and $Y$ axes?

A $T$ gate is a rotation of $\pi/4$ around the $Z$-axis of the Bloch sphere. Meaning that $T$ is equivalent to $R_Z(\pi/4)$ up to a global phase (where $R_Z(\theta)=\exp(-i\theta Z/2 )$ is the ...
  • 1,973
0 votes

Pytket's SquashTK1 pass changes symbolic parameters of gates into complicated expressions

Squashing symbolic gates with optimisation passes like SquashTK1 frequently leads to lengthy trigometric expresions. See the pytket user manual for some background. However in this case its possible ...
  • 181
4 votes
Accepted

SWAP test: clarification of measurement output

Please look at picture of the circuit. The state in the second last step, is the state after the second $H$ gate. Now, we only have to measure, and we are interested in the probability of the two ...
2 votes
Accepted

Is it possible to use quantum state to store and read information without destorying it?

Reading information from a quantum system is possible only via a measurement, which mathematically can be described as applying a Hermitian operator (also called "observable") on the Hilbert ...
  • 1,574
0 votes

Time complexity of block-encoded matrices

From Lecture Notes on Quantum Algorithms for Scientific Computation by Lin: Of course, if $A$ is a dense matrix without obvious structures, any input model will be very expensive (e.g. exponential in ...
4 votes

How does one perform amplitude encoding using only unitary gates?

In amplitude encoding, we encode data into the amplitudes of a quantum state. So, dataset is represented as a normalized classical $2^n$-dimensional vector, which can be thought of as a quantum state ...
0 votes

Time complexity of block-encoded matrices

The matrix $C$ you block-encode can be non-unitary but must be square. There are many techniques for embedding $C$ into a unitary matrix. Examples of explicit quantum circuits are provided in this ...
2 votes
Accepted

How to remove gates added in the quantum circuit?

For your case, indeed, rerun the cell in the best solution. Here, a general solution for situation when that is not possible. Say you have the following circuit and you would like to remove the first <...
  • 4,973
4 votes

Controlled Z gate entanglement

Showing that the matrix of a gate cannot be written as the tensor product is a tedious approach. It's easier to come up with a product state that the gate entangles. For this, it's helpful to have a ...
  • 18.2k
0 votes

Is the Eastin-Knill Theorem incorrect?

$ \mathcal{G} $ is a closed subgroup of $ \mathcal{T} $, which is a closed subset of a unitary group. Unitary groups are compact. Closed subsets of compact spaces are compact. Thus $ \mathcal{G} $ is ...
2 votes
Accepted

Formal Definition of a Quantum Circuit

The first concern (allowing any $2^N \times 2^N$ matrix) is covered by the uniformity condition in the definition. Uniformity means that there exists a deterministic polynomial-time algorithm that, on ...
0 votes
Accepted

Entanglement and superposition illustration

Is there an example that would demonstrate the importance of both entanglement and superposition? The usual "quantum parallelization" example, (e.g., from Nielsen and Chuang chapter 1) is ...
  • 606
2 votes
Accepted

What is $H\left| \psi \right>$ with $\left| \psi \right> = \alpha\left| 0 \right> + \beta\left| 1 \right>$?

Your calculation is correct and that is probably a typo in the textbook, as already mentioned in the comments. Moreover, if you write down your state as $| \psi \rangle = \alpha | 0 \rangle + \beta | ...
2 votes

What is $H\left| \psi \right>$ with $\left| \psi \right> = \alpha\left| 0 \right> + \beta\left| 1 \right>$?

Your result is correct. The answer you quote from the book is wrong and probably a typo. You can quickly check by plugging in α=0,β=1, in which case that answer results in $H|1\rangle = |+\rangle$. ...
  • 5,610
1 vote

Sorting two numbers using quantum computing

In a quantum circuit, a sorting step looks like this: Or, in code: let cmp = a > b if cmp: swap a, b The main tricky thing here is that you can't discard ...
  • 28.7k
0 votes

Sorting two numbers using quantum computing

In Quantum Information notation, what you ask is an operation that maps both $|0\rangle$ and $|1\rangle$ to the same state $|1\rangle$. Thus, it is not unitary, because an unitary operation is ...
3 votes
Accepted

What is the difference between Gate.power() and Gate.repeat()?

The method Gate.repeat() accepts positive integers only. While Gate.power() accepts real values. So, you can use it, for eaxmple,...
1 vote

What is a simple example to showcase quantum computing to a broad audience?

On current noisy QC it is hard to show any advantage over classical computers. Concerning Grover algorithm, it was shown (see here) that any algorithm promising quadratic speed up cannot reach it on a ...
1 vote

What is a "virtual" gate as defined by Qiskit?

Here is the main reference for virtual Rz gates: https://arxiv.org/abs/1612.00858
2 votes

Duration of single qubit gate in IBM

It's available from backend properties's gate_length. API Doc: https://qiskit.org/documentation/stubs/qiskit.providers.models.BackendProperties.gate_length.html#...
  • 203
1 vote

import error :No module named 'qiskit_aqua'

Qiskit Aqua is being phased out, and its components are being moved to different libraries. You can use the qiskit_machine_learning library. Check here: https://qiskit.org/documentation/machine-...
  • 36
1 vote
Accepted

Variational Algorithms - Is there a way to avoid discontinuities in optimal variational parameters?

Let $C(\theta)$ be an arbitrary quantum circuit parametrized by $\theta \in \mathbb{R}^n$. And let $L(C(\theta))$ be a continuous non-convex objective function we would like to optimize. Given that ...
  • 2,033
1 vote

How to transform an Hamiltonian operator to a controlled gate (Hadamard test) in Pennylane?

Given the 2-qubits Hamiltonian $\hat{H}$, this is how you can perform the Hadamard test in Pennylane: ...
1 vote

Express $e^{i\frac{\gamma}{2}Z\otimes Z}$ in terms of CNOT and rotations gate

To verify the action of this circuit, I suggest computing how it acts on each of the 4 basis states $|00\rangle,|01\rangle,|10\rangle$ and $|11\rangle$. For example $$ |00\rangle\xrightarrow{CX}|00\...
  • 51.1k
1 vote

Minimum number of 2-qubit gates required to implement a Toffoli gate

There are some techniques to decompose Toffoli gate. Here I mention two useful techniques. Toffoli gate can be decomposed into six CNOTs (two qubit gate) gates with transpile technique of Qiskit and ...
  • 11
0 votes

How to transform an Hamiltonian operator to a controlled gate (Hadamard test) in Pennylane?

Isn't that just applying X and Z operators separately? For instance, if I compute it by hand: ...
  • 101
1 vote

Difference between Repeat-until-success circuit and Distillation procedure

Distillation is used to produce T states, that can be used to perform T gates. The repeat-until-success circuits from the paper you linked use T gates (they consume T states) in order to perform more ...
  • 28.7k

Top 50 recent answers are included