qubiter.SEO_MatrixProduct module

class qubiter.SEO_MatrixProduct.SEO_MatrixProduct(file_prefix, num_bits)[source]

Bases: object

The class SEO_simulator has an initial state vector as an input, and it calculates the evolution of that state vector after each line of an English file. This class, on the other hand, has no input (initial) nor output (evolved) state vectors. Instead, the class calculates the product of the matrices corresponding to each line (gate) of an English file.

In order to accomplish this goal, this class calls SEO_simulalor_mp repeatedly using as initial state vector all the standard basis vectors (2^num_bits of them). Then the class assembles the product matrix that we seek by stacking on top of each other all the 2^num_bits final evolved state vectors. Admittedly, this is a very slow, inefficient way of finding the sought for matrix product. However, it works fine for a small number of qubits. It can be used to check that gate expansions agree with what they are supposed to be an expansion of.

Though slow, the strategy used by this class has the advantages that it was very easy to code, and that every time it is shown to work, SEO_simulator is shown to work too, 2^num_bit times. This strategy is also easier to parallelize if the need for that arises at some later date.

Variables:prod_arr (np.ndarray) – the product matrix obtained by multiplying each line of the input English file.
__init__(file_prefix, num_bits)[source]

Constructor

Parameters:
  • file_prefix (str) – Prefix of English file being read
  • num_bits (int) – number of bits in English file begin read.
class qubiter.SEO_MatrixProduct.SEO_simulator_mp(file_prefix, num_bits, init_st_vec=None, **kwargs)[source]

Bases: qubiter.SEO_simulator.SEO_simulator

This class is a mp (matrix product) child of class SEO_simulator. An object of this class is created inside class SEO_MatrixProduct. The purpose of this class is to override the use_MEAS() function of its parent class SEO_simulator. The new use_MEAS() returns an error message if an English file with a MEAS line is being read.

use_MEAS(tar_bit_pos, kind)[source]

Returns an error message if an English file with a MEAS line is being read.

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

Return type:

None

use_PRINT(style, line_num)[source]

If circuit has any PRINT statements, skip them

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

Return type:

None