qubiter.device_specific.Qubiter_to_GoogleCirq module

class qubiter.device_specific.Qubiter_to_GoogleCirq.Qubiter_to_GoogleCirq(file_prefix, num_qbits, **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 allowed. If c_to_tars = ‘do_fill’, class fills c_to_tars.

References

  1. https://github.com/quantumlib/Cirq
Variables:lattice (QbitPlanarLattice) –
__init__(file_prefix, num_qbits, **kwargs)[source]

Constructor

bit2str(bit_pos)[source]

Returns a string of form ‘GridQubit(‘ … ‘)’

Parameters:bit_pos (int) –
Returns:
Return type:str
use_HAD2(tar_bit_pos, controls)[source]

Writes line in Cirq 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 Cirq 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 (Cirq 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 Cirq 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 Cirq file corresponding to an English file line of type: P0PH or P1PH with 0 or 1 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 Cirq 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 Cirq 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 Cirq 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).

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

Return type:

None

use_SWAP(bit1, bit2, controls)[source]

Writes line in Cirq file corresponding to an English file line of type: SWAP with no controls.

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

Return type:

None

write_ending()[source]

Writes Cirq ending statements after calls to use_ methods for gates.

Returns:
Return type:None
write_prelude()[source]

Writes Cirq opening statements before calls to use_ methods for gates.

Returns:
Return type:None