Kernel¶
-
class
openql.openql.
Kernel
(*args)¶ Kernel class which contains various quantum instructions.
-
__init__
(*args)¶ - Constructs a Kernel object.
Parameters: - arg1 (str) – name of the Kernel
- arg2 (Platform) – target platform for which the kernel will be compiled
- arg3 (int) – qubit count
- arg4 (int) – classical register count
Methods
__init__
(*args)Constructs a Kernel object. barrier
(*args)inserts explicit barrier on specified qubits. classical
(*args)adds classical operation kernel. clifford
(id, q0)Applies clifford operation of the specified id on the qubit. cnot
(q0, q1)Applies controlled-not operation. conjugate
(k)generates conjugate version of the kernel from the input kernel. controlled
(k, control_qubits, ancilla_qubits)generates controlled version of the kernel from the input kernel. cphase
(q0, q1)Applies controlled-phase operation. cz
(q0, q1)display
()inserts QX display instruction (so QX specific). gate
(*args)adds unitary to kernel. get_custom_instructions
()Returns list of available custom instructions. hadamard
(q0)Applies hadamard on the qubit specified in argument. identity
(q0)Applies identity on the qubit specified in argument. measure
(q0)measures input qubit. mrx90
(q0)Applies mrx90 on the qubit specified in argument. mry90
(q0)prepz
(q0)rx
(q0, angle)rx180
(q0)Applies rx180 on the qubit specified in argument. rx90
(q0)Applies rx90 on the qubit specified in argument. ry
(q0, angle)ry180
(q0)Applies ry180 on the qubit specified in argument. ry90
(q0)rz
(q0, angle)s
(q0)Applies x on the qubit specified in argument. sdag
(q0)Applies sdag on the qubit specified in argument. t
(q0)tdag
(q0)toffoli
(q0, q1, q2)Applies controlled-controlled-not operation. wait
(qubits, duration)inserts explicit wait of specified duration on specified qubits. x
(q0)y
(q0)Applies y on the qubit specified in argument. z
(q0)Applies z on the qubit specified in argument. Attributes
creg_count
kernel
name
platform
qubit_count
-
barrier
(*args)¶ inserts explicit barrier on specified qubits.
wait with duration ‘0’ is also equivalent to applying barrier on specified list of qubits. If no qubits are specified, then barrier is applied on all the qubits.Parameters: arg1 ([]) – list of qubits
-
classical
(*args)¶ - adds classical operation kernel.
Parameters:
-
clifford
(id, q0)¶ - Applies clifford operation of the specified id on the qubit.
The ids and the corresponding operations are:
id Operations 0 [‘I’] 1 [‘Y90’, ‘X90’] 2 [‘mX90’, ‘mY90’] 3 [‘X180’] 4 [‘mY90’, ‘mX90’] 5 [‘X90’, ‘mY90’] 6 [‘Y180’] 7 [‘mY90’, ‘X90’] 8 [‘X90’, ‘Y90’] 9 [‘X180’, ‘Y180’] 10 [‘Y90’, ‘mX90’] 11 [‘mX90’, ‘Y90’] 12 [‘Y90’, ‘X180’] 13 [‘mX90’] 14 [‘X90’, ‘mY90’, ‘mX90’] 15 [‘mY90’] 16 [‘X90’] 17 [‘X90’, ‘Y90’, ‘X90’] 18 [‘mY90’, ‘X180’] 19 [‘X90’, ‘Y180’] 20 [‘X90’, ‘mY90’, ‘X90’] 21 [‘Y90’] 22 [‘mX90’, ‘Y180’] 23 [‘X90’, ‘Y90’, ‘mX90’] Parameters: - arg1 (int) – clifford operation id
- arg2 (int) – target qubit
-
cnot
(q0, q1)¶ - Applies controlled-not operation.
Parameters: - arg1 (int) – control qubit
- arg2 (int) – target qubit
-
conjugate
(k)¶ - generates conjugate version of the kernel from the input kernel.
Parameters: arg1 (ql::Kernel) – input kernel. Except measure, Kernel to be conjugated. Returns: Return type: None
-
controlled
(k, control_qubits, ancilla_qubits)¶ - generates controlled version of the kernel from the input kernel.
Parameters: - arg1 (ql::Kernel) – input kernel. Except measure, Kernel to be controlled may contain any of the default gates as well custom gates which are not specialized for a specific qubits.
- arg2 ([]) – list of control qubits.
- arg3 ([]) – list of ancilla qubits. Number of ancilla qubits should be equal to number of control qubits.
Returns: Return type: None
-
cphase
(q0, q1)¶ - Applies controlled-phase operation.
Parameters: - arg1 (int) – control qubit
- arg2 (int) – target qubit
-
display
()¶ - inserts QX display instruction (so QX specific).
Parameters: None – Returns: Return type: None
-
gate
(*args)¶ - adds unitary to kernel.
Parameters: - arg1 (Unitary) – unitary matrix
- arg2 ([]) – list of qubits
-
get_custom_instructions
()¶ - Returns list of available custom instructions.
Parameters: None – Returns: List of available custom instructions Return type: []
-
hadamard
(q0)¶ - Applies hadamard on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-
identity
(q0)¶ - Applies identity on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-
measure
(q0)¶ - measures input qubit.
Parameters: arg1 (int) – input qubit
-
mrx90
(q0)¶ - Applies mrx90 on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-
rx180
(q0)¶ - Applies rx180 on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-
rx90
(q0)¶ - Applies rx90 on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-
ry180
(q0)¶ - Applies ry180 on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-
s
(q0)¶ - Applies x on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-
sdag
(q0)¶ - Applies sdag on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-
toffoli
(q0, q1, q2)¶ - Applies controlled-controlled-not operation.
Parameters: - arg1 (int) – control qubit
- arg2 (int) – control qubit
- arg3 (int) – target qubit
-
wait
(qubits, duration)¶ inserts explicit wait of specified duration on specified qubits.
wait with duration ‘0’ is equivalent to barrier on specified list of qubits. If no qubits are specified, then wait/barrier is applied on all the qubits.Parameters: - arg1 ([]) – list of qubits
- arg2 (int) – duration in ns
-
y
(q0)¶ - Applies y on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-
z
(q0)¶ - Applies z on the qubit specified in argument.
Parameters: arg1 (int) – target qubit
-