qubiter.device_specific.Qubiter_to_RigettiPyQuil module

class qubiter.device_specific.Qubiter_to_RigettiPyQuil.Qubiter_to_RigettiPyQuil(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.

References

  1. https://github.com/rigetticomputing/pyquil
__init__(file_prefix, num_qbits, **kwargs)[source]

Constructor

Parameters:
  • file_prefix (str) –
  • num_qbits (int) –
use_HAD2(tar_bit_pos, controls)[source]

Writes line in PyQuil 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 PyQuil 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 (PyQuil 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 PyQuil 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 PyQuil 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 PyQuil 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 PyQuil 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 PyQuil 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 PyQuil file corresponding to an English file line of type: SWAP with no controls.

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

Return type:

None

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

Writes line in PyQuil file corresponding to an English file line of type: U_2_ with no controls.

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

Return type:

None

write_ending()[source]

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

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

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

Returns:
Return type:None