qubiter.device_specific.Qubiter_to_PennyLane module¶
-
class
qubiter.device_specific.Qubiter_to_PennyLane.
Qubiter_to_PennyLane
(file_prefix, num_qbits, qnode_name='qnode', fun_defs_path=None, **kwargs)[source]¶ Bases:
qubiter.device_specific.Qubiter_to_AnyQasm.Qubiter_to_AnyQasm
See docstring of parent class Qubiter_to_AnyQasm.
If input c_to_tars = None, all CNOTs and CZs are allowed.
References
Variables: - fun_defs_path (str) – path to a py file that defines all the distinct functions used in functional placeholders in the English file being translated to PennyLane.
- indentation (int) – internal int that keeps track of indentation. Starts at 0
- qnode_name (str) – name to be given to qnode in output PennyLane file. The whole English File will be in the body of a SINGLE qnode.
- rotn_has_been_defined (bool) – If the English file uses ROTN with placeholder variables, then the first time, and only the 1st time, that ROTN is used, the function rot() defining ROTN as an array is included in the body of the qnode. This internal boolean flag helps to insure that the def of rot( ) is included only once in the body of the qnode.
-
__init__
(file_prefix, num_qbits, qnode_name='qnode', fun_defs_path=None, **kwargs)[source]¶ Constructor
Parameters: - file_prefix (str) –
- num_qbits (int) –
- qnode_name (str) –
- fun_defs_path (str) –
- rotn_has_been_defined (bool) –
-
use_HAD2
(tar_bit_pos, controls)[source]¶ Writes line in PennyL file corresponding to an English file line of type: HAD2 with no controls.
Parameters: - tar_bit_pos (int) –
- controls (Controls) –
Returns: Return type: None
-
use_NOTA
(bla_str)[source]¶ Writes line in PennyL file corresponding to an English file line of type: NOTA
Parameters: bla_str (str) – Returns: Return type: None
-
use_PHAS
(angle_rads, tar_bit_pos, controls)[source]¶ If called for a controlled phase, this function will halt execution of program. If it’s just a global phase with no controls, the function will comment the phase out in the output files (PennyL and output Qubiter English and Picture files.) and move on to the next line.
Parameters: - angle_rads (float) –
- tar_bit_pos (int) –
- controls (Controls) –
Returns: Return type: None
-
use_PRINT
(style, line_num)[source]¶ Writes line in PennyL file corresponding to an English file line of type: PRINT
Parameters: - style (str) –
- line_num (int) –
Returns: Return type: None
-
use_P_PH
(projection_bit, angle_rads, tar_bit_pos, controls)[source]¶ Writes line in PennyL file corresponding to an English file line of type: P1PH with 0 controls.
Parameters: - projection_bit (int) –
- angle_rads (float) –
- tar_bit_pos (int) –
- controls (Controls) –
Returns: Return type: None
-
use_ROTA
(axis, angle_rads, tar_bit_pos, controls)[source]¶ Writes line in PennyL file corresponding to an English file line of type: ROTX, ROTY or ROTZ with no controls.
Parameters: - axis (int) –
- angle_rads (float) –
- tar_bit_pos (int) –
- controls (Controls) –
Returns: Return type: None
-
use_ROTN
(angle_x_rads, angle_y_rads, angle_z_rads, tar_bit_pos, controls)[source]¶ Writes line in PennyL file corresponding to an English file line of type: ROTN with no controls.
Parameters: - angle_x_rads (float) –
- angle_y_rads (float) –
- angle_z_rads (float) –
- tar_bit_pos (int) –
- controls (Controls) –
Returns: Return type: None
-
use_SIG
(axis, tar_bit_pos, controls)[source]¶ Writes line in PennyL file corresponding to an English file line of type: SIGX, SIGY or SIGZ with no controls, or else SIGX with one True control (i.e., simple CNOT), or else SIGZ with one True control.
Parameters: - axis (int) –
- tar_bit_pos (int) –
- controls (Controls) –
Returns: Return type: None
-
use_SWAP
(bit1, bit2, controls)[source]¶ Writes line in PennyL file corresponding to an English file line of type: SWAP with no controls.
Parameters: - bit1 (int) –
- bit2 (int) –
- controls (Controls) –
Returns: Return type: None