Docs Gate User Guide

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

User Guide

1. Introduction The matrix form of the single-qubit gates with


angles can be written as,
Here, we provide the instructions, which need to
be followed by the users before applying the gate 
cos 2θ −i sin 2θ

operations and running quantum circuit. Any RX(θ) =
−i sin 2θ cos 2θ
user can run quantum circuits up to a 100-qubit
cos 2θ − sin 2θ
 
system. RY (θ) =
sin 2θ cos 2θ
2. Operations
 
1 0
RZ(θ) =
Here, we can use the following gates, single- 0 eiθ
 
qubit; Hadamard (H), Not (X), Y, Z, rota- 1 0
P (ϕ) =
tional gates (RX, RY, RZ), phase (P), two-qubit; 0 eiϕ
controlled-Not (CX), controlled-U (CU), and cos 2θ −eiλ sin 2θ
 
three-qubit; controlled-controlled-Not (CCX) U (θ, ϕ, λ) = (2)
eiϕ sin 2θ ei(ϕ+λ) cos 2θ
gates. The single-qubit gates without any an-
gles can be given as, Two-qubit operations are;
 
  1 0 0 0
1 1 1 0 1 0 0
H = √ CX = 
1 −1

2 0 0 0 1
0 0 1 0
 
0 1
X =
1 0
 
1 0 0 0

0 −i
 0 1 0 0 
Y = CU (θ, ϕ, λ, γ) =  
i 0 0 0 e cos 2θ
iγ −ei(γ+λ) sin 2θ 

1 0
 0 0 e i(γ+ϕ) sin 2θ ei(γ+ϕ+λ) cos 2θ
Z = (3)
0 −1
(1)

1
User Documentation

Three-qubit operation is given by; single spaces in between the operations, and
  no spaces before and after the string. If
1 0 0 0 0 0 0 0 there are errors while inputting the gates,
0 1 0 0 0 0 0 0 the user will be asked to put them cor-
 
0 0 1 0 0 0 0 0
  rectly. While putting the qubit indices for
0 0 0 1 0 0 0 0
CCX =   (4) two-qubit and three-qubit gates, users must
0 0 0 0 1 0 0 0
  note that there should not be any repeat of
0 0 0 0 0 1 0 0
  qubit indices, e.g., CX{0, 0} is not accept-
0 0 0 0 0 0 0 1 able.
0 0 0 0 0 0 1 0 • Then the user needs to enter the number of
shots, i.e., the number of times the quantum
3. How to apply the operations circuit will be measured. The minimum and
• For the operations having single qubit maximum range of shots are 1 and 8192 re-
index and no angle, {H, X, Y, Z}; e.g., spectively. The users are adviced to put the
H{i}, X{i}, Y {i}, Z{i}, where i is the in- maximum number of shots for lesser statis-
dex of qubit, and it can take values from tical error in the results.
0, 1, ..n − 1, while n being the number of • Then the users need to enter the qubits
qubits. where the measurement would be per-
• The operations having single qubit in- formed. It is to be noted that the qubit
dex and with angle, {RX, RY, RZ, P, U }; indices have to be lesser than the number
RX(θ){i}, RY (θ){i}, RZ(θ){i}, P (θ){i}, U (θ){i}, of qubits (n), and the length of the string
where θ can take values from +/− 0 to has to be lesser than n. Like the previous
999999, and i is the index of qubits. Any case, here also the user needs to put sin-
angle in radian needs to be converted, e.g., gle spaces in between the qubit indices, and
an angle of π can be converted to 3.141, there should not be any repeat of the qubit
and this value can be put in the angle indices. Some examples for a 3-qubit circuit
parameter. can be seen as;
• For two-qubit operations {CX, CU } with ◦ ‘0 1 2’
no angle, CX{i, j} and with angle, ◦ ‘0 1’
CU (θ, ϕ, λ, γ){i, j}, where θ, ϕ, λ, γ are the ◦ ‘1 2’
angles, and take the same range as given A string like ‘0 1 0’ or ‘0 1 2 3’ or ‘0 1 3’ is
above. Here, i, j are the qubit indices, not acceptable.
th
where i qubit is the control qubit and j th

qubit is the target qubit.


• For three-qubit gates, CCX{i, j, k}, where
i, j, k are the qubit indices. Here, both i
and j are the control qubits’ indices and k
is the target qubit index.

4. How to run a quantum cir-


cuit?
• The user first needs to enter the number of
qubits, it can range any number from 1 to
100.
• Then the users will be asked to apply the
operations. Here, we attach some suitable
examples for a 3-qubit system,
◦ ‘H{1} X{0} Y {0} Z{0} CCX{0, 1, 2}’
◦ ‘CU (0.1, 0.1, 0.1, 0.1){0, 1} RZ(0.1){0}’
◦ ‘U (0.1, 0.1, 0.1){0} P (0.1){1} CX{0, 1}’
The users must note that there should be

You might also like