QuICScript Cheat Sheet

A cheat sheet for quantum programming language QuICScript

QuICScript Cheat Sheet

A Cheat Sheet for Quantum Programming Language QuICScript 

What is QuICScript?

QuIC stands for Quantum Interpreted Circuits, and QuICScript was developed by my CEO, Tan Teik Guan, as a hobby to streamline the process of quantum circuit development.

QuICScript is a software-based quantum emulator, which can support quantum computations of up to 20-qubits and scale to gate depths beyond 100,000 gates.

Quantum programs written in QuICScript can be executed in real-time via a QuICScript Engine. Quantum-in-a-Browser is a QuICScript Engine implemented within a standard web browser.

Overview of a QuICScript Program

Diagram 1. Bell Circuit with inverse correlation output.

At the start of a new execution, each qubit will be initialized to |0⟩. If you need the qubit to be initialized to |1⟩, add a "X" to each relevant qubit before the actual quantum algorithm.

In Diagram 1 above, I want the input qubit q[0] to be in state |0⟩ and qubit q[1] to be in state |1⟩. I added the X gate for q[1] to initialize the qubit to be in state |1⟩. The rest of the QuICScript program "IX,HI,CN" will result in a Bell state with inverse correlation.

QuICScript Commands

The QuICScript Engine supports the execution of many discrete quantum gates. The commands are listed in the left column, and the associated behavior is listed in the right column.

Fundamental Gates

QuICScript CommandDescription
IIdentity Gate
XPauli-X Gate
YPauli-Y Gate
ZPauli-Z Gate / Phase shift by φ = π
HHadamard Gate
PPhase (S, P) Gate / Phase shift by φ = π/2
pInverse Phase (S, P) Gate
TPhase (T) Gate / Phase shift by φ = π/4
tInverse Phase (T) Gate
sSwap Gate

Universal Gates

QuICScript CommandDescription
U θ φ λU Gate. Enables arbitrary rotation of a single qubit. Parameters are the three Euler rotation angles, θ, φ and λ that are separated by 0 between them.

The matrix for the U gate is defined as 

U(θ,φ,λ) = ( cos(θ2) -esin(θ2) esin(θ2) ei(φ+λ)cos(θ2) )

To implement the phase shift via the U gate, it is defined as

P(φ) = U ( 0,φ,0 )

Controlled Gates

QuICScript CommandDescription
CNControlled Not Gate (CNOT)
CYControlled Y Gate
CZControlled Z Gate (CZ)
CPControlled Phase (S, P) Gate
CTControlled Phase (T) Gate
CsFredkin Gate (CSWAP)
CUControlled U Gate
CCNToffoli Gate (CCNOT)
C...CNn-bit Toffoli Gate

Similar to the Toffoli gate, QuICScript also supports controlled-controlled-gate syntax for the above listed controlled gates. E.g., CCY, CYC, ZCC, etc. Note that QuICScript Engine supports any permutation of the QuICScript commands describing the controlled gates.

Similar to the n-bit Toffoli gate, QuICScript also supports n-bit controlled-gate syntax for the above listed controlled gates. E.g., CCCY, CYCC, ZCCCC, etc.

Measurements

QuICScript CommandDescription
mMeasurement operation that resolves at random, per execution, according to the quantum state probabilities to either |0⟩ or  |1⟩.  
0Measurement output always set to |0⟩.
1Measurement output always set to |1⟩.

Circuit Modifiers

QuICScript CommandDescription
,One QuICScript command is assigned to each qubit in a top-to-bottom vertical sequence. The comma is a delimiter to indicate that all available qubits have been each assigned a command; the next set of command-to-qubit assignments is expected after the comma.
dDelete a qubit from the output state (system wavefunction). The probabilities of the remaining qubits will be normalized in the QuICScript Engine output.

Author

Nicholas Ho

Nicholas seriously enjoys learning new knowledge. He is so serious about it that his hobby is to collect hobbies. His most enduring hobby, since 1997, is to continuously explore the ever-evolving domains of applied cryptography, software development, and cybersecurity. His latest aspiration is to add the word quantum in front of each of these 3 domains. Nicholas is currently a Senior Cryptographic Engineer at pQCee.com. Akin to many Singaporeans, he also enjoys collecting popular certifications, including a CS degree, an Infocomm Security masters, CISSP, and CISA.

0 Comments

Leave a reply