Program

class openql.openql.Program(*args)

Program class which contains one or more kernels.

__init__(*args)
Constructs a program object.
Parameters:
  • arg1 (str) – name of the program
  • arg2 (Platform) – instance of an OpenQL Platform
  • arg3 (int) – number of qubits the program will use
  • arg4 (int) – number of classical registers the program will use (default: 0)

Methods

__init__(*args) Constructs a program object.
add_do_while(*args) Adds specified sub-program to a program which will be repeatedly executed while specified condition is true.
add_for(*args) Adds specified sub-program to a program which will be executed for specified iterations.
add_if(*args) Adds specified sub-program to a program which will be executed if specified condition is true. This allows nesting of operations.
add_if_else(*args) Adds specified sub-programs to a program. First sub-program will be executed if specified condition is true. Second sub-program will be executed if specified condition is false.
add_kernel(k) Adds specified kernel to program.
add_program(p)
compile() Compiles the program
get_sweep_points() Returns sweep points for an experiment.
microcode() Returns program microcode
print_interaction_matrix()
Program.qasm
set_sweep_points(sweep_points) Sets sweep points for an experiment.
write_interaction_matrix()

Attributes

creg_count
name
platform
program
qubit_count
add_do_while(*args)
Adds specified sub-program to a program which will be repeatedly executed while specified condition is true.
Parameters:
  • arg1 (Program) – program to be executed repeatedly
  • arg2 (Operation) – classical relational operation (<, >, <=, >=, ==, !=)
add_for(*args)
Adds specified sub-program to a program which will be executed for specified iterations.
Parameters:
  • arg1 (Program) – sub-program to be executed repeatedly
  • arg2 (int) – iteration count
add_if(*args)
Adds specified sub-program to a program which will be executed if specified condition is true. This allows nesting of operations.
Parameters:
  • arg1 (Program) – program to be executed
  • arg2 (Operation) – classical relational operation (<, >, <=, >=, ==, !=)
add_if_else(*args)
Adds specified sub-programs to a program. First sub-program will be executed if specified condition is true. Second sub-program will be executed if specified condition is false.
Parameters:
  • arg1 (Program) – program to be executed when specified condition is true (if part).
  • arg2 (Program) – program to be executed when specified condition is false (else part).
  • arg3 (Operation) – classical relational operation (<, >, <=, >=, ==, !=)
add_kernel(k)
Adds specified kernel to program.
Parameters:arg1 (kernel) – kernel to be added
compile()
Compiles the program
Parameters:None
get_sweep_points()
Returns sweep points for an experiment.
Parameters:None
Returns:list of sweep points
Return type:[]
microcode()
Returns program microcode
Parameters:None
Returns:microcode
Return type:str
set_sweep_points(sweep_points)
Sets sweep points for an experiment.
Parameters:arg1 ([]) – list of sweep points