17 votes
Accepted

Toffoli gate as FANOUT

To simplify the question consider CNOT gate instead of Toffoli gate; CNOT is also fanout because \begin{align} |0\rangle|0\rangle \rightarrow |0\rangle|0\rangle\\ |1\rangle|0\rangle \rightarrow |1\...
kludg's user avatar
  • 3,204
11 votes

Is there any method of adding two operators in a circuit?

Below is a recent paper by Gilyén et al on doing "quantum matrix arithmetics", allowing to implement linear combinations of unitary operators. They consider the general case where the linear ...
smapers's user avatar
  • 324
10 votes
Accepted

Is there any method of adding two operators in a circuit?

What you are trying to do is called Hamiltonian Simulation. If your exponential can be split in a sum of unitary matrices, @smapers' answer guide you to a good algorithm: the Linear Combination of ...
Adrien Suau's user avatar
  • 4,927
8 votes

Toffoli gate as FANOUT

The no cloning theorem says that there is no circuit which creates independent copies of all quantum states. Mathematically, no cloning states that: $$\forall C: \exists a,b: C \cdot \Big( (a|0\...
Craig Gidney's user avatar
  • 36.9k
7 votes

Toffoli gate as FANOUT

The answer is that the no-cloning theorem states that you cannot clone an arbitrary unknown state. This circuit does not violate the no-cloning theorem, because let's look at what it does when the ...
user1271772 No more free time's user avatar
5 votes
Accepted

Incorrectly Calculating Probability Amplitudes for 3-qbit Circuit

You're getting the same output as Quirk, just with a different bit ordering convention for the kets. Quirk considers the top qubit to be the "least significant" qubit (i.e. if you count 000, 001, 010,...
Craig Gidney's user avatar
  • 36.9k
5 votes
Accepted

Topological Circuit Simulator

Those figures were created manually with sketchup, which is a 3d modelling tool. There was no simulation involved, only careful application of known rules.
Craig Gidney's user avatar
  • 36.9k
5 votes

Topological Circuit Simulator

There is QTop which is an open-source project that can simulate but also visualize topological quantum codes.
Mark Fingerhuth's user avatar
5 votes

Is there any method of adding two operators in a circuit?

It seems that you need oblivious fixed point amplitude amplification. See Theorem 26-28 in the aforementioned paper: arXiv:1806.01838 [quant-ph]. As a first step, you can implement $\frac{A+B(t)}{2}$ ...
András's user avatar
  • 51
4 votes
Accepted

Building a matrix corresponding to the teleportation circuit

Since the quantum teleportation circuit has three qbits, the matrix at each step is 8x8 and thus has 64 elements; this is pretty clunky to type out in its entirety, so I'll just walk you through step ...
ahelwer's user avatar
  • 4,128
4 votes
Accepted

Creating .gifs corresponding to Quirk simulations

I made those GIFs using the screen recorder ScreenToGif. ScreenToGif is not very good at compressing while maintaing quality, so I found it worked better to disable all optimizations while recording, ...
Craig Gidney's user avatar
  • 36.9k
4 votes
Accepted

What is wrong with my circuit for the fourth-root of $X$?

With the gates you allowed, you can conjugate the $T$ so that it rotates around $X$ instead of $Z$. That gives you $\sqrt[4]X$. In your circuit I think you got your QFTs backwards, so the phase ...
Craig Gidney's user avatar
  • 36.9k
3 votes
Accepted

How to use the input gates in Quirk

The input gates are in the bottom toolbox, near the center: If you place an input gate in the same column as an arithmetic gate requiring that input, they will link together into a combined operation:...
Craig Gidney's user avatar
  • 36.9k
3 votes

What is wrong with my circuit for the fourth-root of $X$?

I think it's actually far easier than this. You only need one ancilla. The trick is that $X$ has the same eigenvectors as $\sqrt[4]X$. So, you can just do the following The circuit that you've ...
DaftWullie's user avatar
3 votes
Accepted

Trying to perform Quantum Phase Estimation on T-gate

Your implementation is really close - on the website, here's the diagram that they used: So, I think you reversed the angles - it should be $-\pi/2, -\pi/4, -\pi/2$. (Also: there's a QFT inverse that ...
C. Kang's user avatar
  • 1,716
3 votes
Accepted

How to implement a $\frac{\theta}{2}$ rotation from $\theta$ rotation?

(This answer is specific to the context of the question, which is about doing this construction out of Quirk's time dependent gates.) It's not possible to have proper half-speed time-dependent ...
Craig Gidney's user avatar
  • 36.9k
3 votes
Accepted

How to avoid error when applying certain combinations of degree of freedom rotations using a quantum circuit?

Since you haven't told us how you've tried to do the calculation, I don't know where you're making the mistake. (I'm also unfamiliar with Quirk, which seems to be using an unusual ordering of basis ...
DaftWullie's user avatar
3 votes

Incorrectly Calculating Probability Amplitudes for 3-qbit Circuit

The output you've stated there appears to be correct. The Hadamard produces $$ |000\rangle\mapsto\frac{1}{\sqrt{2}}(|000\rangle+|100\rangle). $$ Then, the two controlled-nots give $$ \mapsto\frac{1}{\...
DaftWullie's user avatar
2 votes

Why are these circuits not producing the expected output?

The endian-ness of the qubits is the answer. Both QFT and phase estimation rely on certain endianness of the register, and the representations used in the controlled-unitary part has to match the ...
Mariia Mykhailova's user avatar
2 votes
Accepted

Question about Grover algorithm implementation in the Quirk simulator

In the second half of the circuit you're mixing up which qubits are your ancillae and which are the ones you want to operate on. You can't use one of your system qubits as an ancilla.
Craig Gidney's user avatar
  • 36.9k
2 votes
Accepted

Find local state and compute Bloch coordinates, like Quirk

Trace out everything except the qubit you are interested in. Do this by computing the outer product of the state of the target qubit, for each possible value of the other qubits, and summing up all ...
Craig Gidney's user avatar
  • 36.9k
2 votes
Accepted

Problem with commutation of $e^{-iH_1t}$ and $e^{-iH_2t}$, where $H_1$ commutes with $H_2$

I agree that $Y$ is not the best notation. Actually, in the paper that I was referring in the answer there was a gate $Y$ that was doing the desired job (it was also not a self-inverse gate). I didn't ...
Davit Khachatryan's user avatar
2 votes

Problem with commutation of $e^{-iH_1t}$ and $e^{-iH_2t}$, where $H_1$ commutes with $H_2$

You reversed the order of $Y^\dagger$ and $Y$ compared to the answer you linked. Instead of using the "$Y^\dagger$" operation that sends the X axis to the Y axis to the Z axis to the X axis, you're ...
Craig Gidney's user avatar
  • 36.9k
2 votes

How to implement *nested* Grover search (in Quirk)?

Well, checking again with the paper it seems I simply forgot a pair of Hadamard gates (Correct Quirk Cicruit).
Fleeep's user avatar
  • 374
2 votes
Accepted

Explanation of the function of the circuit

This gate is closely related to the CNOT gate that you've already learnt about. Where the CNOT gate says "apply NOT to the target if the control is in the state $|1\rangle$", this gate says "apply NOT ...
DaftWullie's user avatar
2 votes
Accepted

Why does entanglement of 3 qubits break this?

Why wouldn't it break it? Involving Eve requires, for example, putting a CNOT gate from one of the distributed qubits to some outside qubit. That CNOT operation doesn't commute with the controlled Y ...
Craig Gidney's user avatar
  • 36.9k
2 votes
Accepted

How to store error caused by circuit manipulation

If you want to propagate a non-Pauli operator through a stabilizer circuit, a useful conversion is to transform it into a form where all the non-Pauli stuff is hidden away on ancilla qubits. For ...
Craig Gidney's user avatar
  • 36.9k
2 votes
Accepted

Problem with eigenvalue evaluation algorithm application on matrix $U$

TL;DR: Qubit order in the top register is reversed. QFT qubit order in Quirk Quirk's QFT gate treats the top qubit as the least significant and the bottom qubit as the most significant. Thus, if you ...
Adam Zalcman's user avatar
  • 22.3k
1 vote

Manually calculating quantum circuit with custom gate

While quantum circuits are written such that time goes left to right[1], matrix multiplication goes the other direction[2]. That is, a quantum circuit contains the gate $U_1$ followed by $U_2$ is ...
Egretta.Thula's user avatar
1 vote

Implementation of quantum phase estimation in Quirk

Quirk uses the convention that the top qubit is the least significant qubit. When Quirk shows the ket $|001\rangle$, the rightmost bit (the 1) is the top qubit line and the equivalent decimal value is ...
Craig Gidney's user avatar
  • 36.9k

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