1
$\begingroup$

Strolling around I came across Craig Gidney's Blog and his awesome tool Quirk. I proceeded to read this interesting post of his where he alludes to the difference between actually measuring qubits in circuits and simply conditioning some part of the circuit to state of qubits. Long story short, he provides this Quirk circuit to experiment with. There he has a gate that is called "x499" and my question is:

How do I make this gate or any other of the input gates? (Those that feature an "A" or "B") I have spent a good amount of time dragging and dropping and clicking around but I seem unable to figure this functionality out. (* ashamed *) If I drag it into my circuit, it will turn yellow and show something like "input A needed".

$\endgroup$
2
$\begingroup$

The input gates are in the bottom toolbox, near the center:

input gates

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:

arithmetic combo

You can also precede the input-requiring gate with a classical setting of the value:

classical arithmetic

Separating the input and the target into separate boxes makes using arithmetic much more flexible than it otherwise would be. In an older version they were combined into a single gate, and it was just generally a giant hassle to get anything lined up.

The "x499" gate in the circuit you linked is a custom gate:

image

Specifically, it is a "Circuit Gate" which was made by clicking the "Make Gate" button and then entering a range of the (at creation time of the gate) current circuit to include in the gate.

custom gate

Notice that there is in fact a series of custom gates in the before-last screenshot. Each is including a handful of copies of the previous one, in order to build up to many many applications of the "apply Hadamard and controlled increment" operation. This is a workaround for the fact that Quirk has no concept of a loop.

Be aware that custom gates are by far the weakest part of Quirk's user experience. They're clunky to make, impossible to delete without editing the URL, don't have large enough thumbnails... it's just something that I'd have to put 100 hours into to make it good and I haven't had the motivation.

$\endgroup$
  • $\begingroup$ Thx for the answer Craig! For some reason, I had assumed the "x499" was the multiplication gate, but now I understand how you are counting and I also understand that there is no way of obtaining the binomial distribution with quirk since nested measurements arent viable. Keep up the great work, will definitely start following your blog in the future :) $\endgroup$ – Marsl Jul 13 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.