qubiter.quantum_CSD_compiler.MultiplexorExpander module¶
-
class
qubiter.quantum_CSD_compiler.MultiplexorExpander.
MultiplexorExpander
(file_prefix, num_qbits, style, gbit_list=None, vars_manager=None, **kwargs)[source]¶ Bases:
qubiter.EchoingSEO_reader.EchoingSEO_reader
This class is a child of EchoingSEO_reader. The class reads any previously created Qubiter English file and it writes new English & Picture files wherein every line of the original English file that doesn’t start with MP_Y (multiplexor) is echoed faithfully whereas lines which do start with MP_Y are expanded via class MultiplexorSEO_writer into a sequence in the style specified as input to the class constructor.
So, to expand English & Picture files that contain DIAG and MP_Y lines into just CNOTs and qubit rotations, first use this class and the analogous one for DIAG, then use class CGateExpander.
If the input English file has in_file_prefix as file prefix, then the output English & Picture files have as file prefix in_file_prefix + ‘_X1’, assuming that ‘_X’ + str(k) for some integer k is not already the ending of in_file_prefix. If it is, then the ending is changed to ‘_X’ + str( k+1).
Variables: - gbit_list (list(int)|None) – Only needed for some expansion styles, this is a list of grounded bits
- style (str) –
-
__init__
(file_prefix, num_qbits, style, gbit_list=None, vars_manager=None, **kwargs)[source]¶ Constructor
Parameters: - file_prefix (str) –
- num_qbits (int) –
- style (str) –
- gbit_list (list(int)) –
- vars_manager (PlaceholderManager) –
-
emb_for_plexor
(tar_bit_pos, controls)[source]¶ This is an internal function used inside the function use_MP_Y(). The function returns emb, nt, nf to be used as arguments of a MultiplexorSEO_writer that will be used to expand the MP_y line currently being considered. emb is a circuit embedder, nt is the number of T bits and nf is the number of F bits detected in the input argument ‘controls’.
Parameters: - tar_bit_pos (int) – target bit position of multiplexor currently being considered.
- controls (Controls) – controls of the MP_Y currently being considered.
Returns: Return type: CktEmbedder, int, int
-
use_MP_Y
(tar_bit_pos, controls, rad_angles)[source]¶ This is an override of a function in the parent class EchoingSEO_reader. This is the only use_ function of this class that doesn’t simply echo its input line. This function does most of its work inside the Multiplexor_SEO_writer.write() function that it calls.
Parameters: - tar_bit_pos (int) –
- controls (Controls) –
- rad_angles (list[float]) –
Returns: Return type: None