Hot answers tagged

15 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\...
user avatar
  • 3,034
10 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 ...
user avatar
  • 314
8 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 ...
user avatar
  • 4,477
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\...
user avatar
  • 22.3k
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 ...
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,...
user avatar
  • 22.3k
4 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.
user avatar
  • 22.3k
4 votes

Topological Circuit Simulator

There is QTop which is an open-source project that can simulate but also visualize topological quantum codes.
user avatar
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 ...
user avatar
  • 3,908
4 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}$ ...
user avatar
  • 41
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, ...
user avatar
  • 22.3k
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 ...
user avatar
  • 22.3k
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 ...
user avatar
  • 47.1k
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 ...
user avatar
  • 1,521
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 ...
user avatar
  • 22.3k
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 ...
user avatar
  • 47.1k
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}{\...
user avatar
  • 47.1k
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 ...
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.
user avatar
  • 22.3k
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 ...
user avatar
  • 22.3k
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 ...
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 ...
user avatar
  • 22.3k
2 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:...
user avatar
  • 22.3k
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 ...
user avatar
  • 47.1k
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 ...
user avatar
1 vote

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).
user avatar
  • 364
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 ...
user avatar
  • 22.3k
1 vote

Creating a time dependent custom gate in Quirk

The only way to make a time-dependent custom gate is to decompose the desired unitary into a circuit using the built-in time-dependent gates (typically $X$, $Y$ or $Z^t$), then make a custom circuit ...
user avatar
  • 22.3k
1 vote

Why are these circuits not producing the same output?

You have to put an extra SWAP-gate after the QFT, see this circuit. Furthermore, the two controlled-Z gates on the same qubit are not necessary. This can reduce the circuit further to this.
user avatar
  • 1,412

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