Quantum, made easy
Live probabilty results
Edit the code above and watch the probabilty results update in realtime.
Free and open-source
What does coding a quantum circuit look like? Let’s recreate the above Bell state using three separate circuit authoring styles to demonstrate Q’s flexibility. For each of the three examples we’ll create a circuit that uses 2 qubit registers for 2 moments of time. We’ll place a Hadamardgate at moment 1 on register 1. Then we'll place a Controlled-Not gate at moment 2 , with its control component on register 1 and its target component on register 2. 1. Text as input
Q’s text-as-inputfeature directly converts your text into a functioning quantum circuit. Just type your operations out as if creating a text-only circuit diagram (using “I” for identity gates in the spots where no operations occur) and enclose your text block in backticks (instead of quotation marks). Note that parentheses are not required to invoke the function call when using backticks.Q ` H X # 0 I X # 1 `
Folks coming to Q from Python-based quantum suites may find this syntax more familiar. Here thefunction expects the number of qubit registers to use, followed by the number of moments to use. Afterward, each single-letter quantum gate label is also a function name. For these functions the first argument is a moment index and the second is a qubit register index or array of qubit register indices.
QQ (2, 2) .h (1, 1) .x (2, [ 1, 2 ])
3. Verbose for clarity
Under the hood, Q is making more verbose declarations. You can also make direct declarations like so. (And
What are those dollar signs about?)new Q . Circuit (2, 2) . set $ ( Q . Gate . HADAMARD , 1, 1) . set $ ( Q . Gate . PAULI_X , 2, [ 1, 2 ])
There are many ways to build a quantum circuit with Q. What feels right for you? To learn more about Q’s text syntaxand other convenience tricks, see “Writing quantum circuits.” ”
Clear, legible output
Whether you use Q’s drag-and-drop circuit editor interface, text syntax , Python-inspired syntax, or prefer to type out every set $ command yourself, Q makes inspecting and evaluating your circuits easy.
Let’s add two commands which could directly follow any of the three examples above. Hey — deciding what to name a circuit can sometimes be difficult, so we’ll let Q choose a random name for us. Then we’ll generate an outcome probabilities report. Just add the following two lines to any of the above examples:. setName $ ( Q) . getRandomName $ ) . evaluate $ ()
And that combination will yield something like the following:
Q plays well with everyone. Export your circuits as plain text , ASCII diagrams , interactive graphic-user-interfaces , LaTeX code , and more! Visit the Q playground to experiment with converting circuits between various formats. As always, new features are in the works. Join our project on GitHuband help us build bridges to everywhere.
(Read More ) Full coverage and live updates on the Coronavirus (Covid –