qubiter.EchoingSEO_reader module

class qubiter.EchoingSEO_reader.EchoingSEO_reader(file_prefix, num_bits, wr, vars_manager=None, **kwargs)[source]

Bases: qubiter.SEO_reader.SEO_reader

This class is a child of SEO_reader. The class reads any previously created Qubiter English file and it writes new English & Picture files wherein every line is echoed faithfully, except maybe the qubits are permuted.

The constructor of this class takes as input wr which should be a SEO_writer or child thereof. If wr is a plain SEO_writer writing to a file_prefix different to the file_prefix being read, this class will generate a Picture File & English file starting from only an English file.

This class has many uses. Here are some:

1. If given as input a pictureless English file, it can be used to draw an ASCII picture of the input English file.

2. If wr permutes the qubits, it can be used to write new Picture File & English files that have permuted qubits with respect to the input English file.

3. It is the parent class to the Expander classes MultiplexorExpander and DiagUnitaryExpander, both of which echo every line except those starting with MP_Y and DIAG, respectively, and therefore need only override the functions use_MP_Y() and use_DIAG, respectively, of this class.

Variables:wr (SEO_writer) – This object of SEO_writer is called inside every use_ function to do some writing in the output files.
__init__(file_prefix, num_bits, wr, vars_manager=None, **kwargs)[source]

Constructor

Parameters:
do_log()[source]

This class does a “flat” reading of the input file; i.e., the reading does not respect loop structure. Hence, we won’t let it write a log file, for if we did, it would be incorrect. A correct log file can always be obtained by creating a SEO_reader object.

Returns:
Return type:None
static pic_file_from_eng_file(file_prefix, num_bits, ZL=True)[source]

This function reads an English file with file prefix = file_prefix and it writes a Picture file for it with the same file prefix.

Parameters:
  • file_prefix (str) –
  • num_bits (int) –
  • ZL (bool) –
Returns:

Return type:

None

use_DIAG(controls, rad_angles)[source]

This function echoes a DIAG line; i.e., it transcribes the line from the input English file to the output English & Picture files.

Parameters:
  • controls (Controls) –
  • rad_angles (list[float]) –
Returns:

Return type:

None

use_HAD2(tar_bit_pos, controls)[source]

This function echoes a HAD2 line.

Parameters:
  • tar_bit_pos (int) –
  • controls (Controls) –
Returns:

Return type:

None

use_IF_M_beg(controls)[source]

This function echoes IF_M_beg line.

Parameters:controls (Controls) –
Returns:
Return type:None
use_IF_M_end()[source]

This function echoes IF_M_end line

Returns:
Return type:None
use_LOOP(loop_num, nreps)[source]

This function echoes a LOOP line.

Parameters:
  • loop_num (int) –
  • nreps (int) –
Returns:

Return type:

None

use_MEAS(tar_bit_pos, kind)[source]

This function echoes a MEAS line.

Parameters:
  • kind (int) –
  • tar_bit_pos (int) –
Returns:

Return type:

None

use_MP_Y(tar_bit_pos, controls, rad_angles)[source]

This function echoes an MP_Y line.

Parameters:
  • tar_bit_pos (int) –
  • controls (Controls) –
  • rad_angles (list[float]) –
Returns:

Return type:

None

use_NEXT(loop_num)[source]

This function echoes a NEXT line.

Parameters:loop_num (int) –
Returns:
Return type:None
use_NOTA(bla_str)[source]

This function echoes a NOTA line.

Parameters:bla_str (str) –
Returns:
Return type:None
use_PHAS(angle_rads, tar_bit_pos, controls)[source]

This function echoes a PHAS line.

Parameters:
  • angle_rads (float) –
  • tar_bit_pos (int) –
  • controls (Controls) –
Returns:

Return type:

None

use_PRINT(style, line_num)[source]

This function echoes PRINT line

Parameters:
  • style (str) –
  • line_num (int) –
Returns:

Return type:

None

use_P_PH(projection_bit, angle_rads, tar_bit_pos, controls)[source]

This function echoes a P0PH or P1PH line.

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]

This function echoes a ROTX, ROTY or ROTZ line.

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]

This function echoes a ROTN line.

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]

This function echo a SIGX, SIGY or SIGZ line.

Parameters:
  • axis (int) –
  • tar_bit_pos (int) –
  • controls (Controls) –
Returns:

Return type:

None

use_SWAP(bit1, bit2, controls)[source]

This function echoes a SWAP line.

Parameters:
  • bit1 (int) –
  • bit2 (int) –
  • controls (Controls) –
Returns:

Return type:

None

use_SWAY(bit1, bit2, controls, rads_list)[source]

This function echoes a SWAY line.

Parameters:
  • bit1 (int) –
  • bit2 (int) –
  • controls (Controls) –
  • rads_list (list[float | str]) –
Returns:

Return type:

None

use_U_2_(rads0, rads1, rads2, rads3, tar_bit_pos, controls)[source]

This function echoes a U_2_ line.

Parameters:
  • rads0 (float) –
  • rads1 (float) –
  • rads2 (float) –
  • rads3 (float) –
  • tar_bit_pos (int) –
  • controls (Controls) –
Returns:

Return type:

None