netqasm.lang.instr

netqasm.lang.instr.base

class netqasm.lang.instr.base.NetQASMInstruction(id=-1, mnemonic='', lineno=None)

Bases: ABC

Base NetQASM instruction class.

Parameters:
  • id (int)

  • mnemonic (str)

  • lineno (Optional[HostLine])

id: int = -1
mnemonic: str = ''
lineno: Optional[HostLine] = None
abstract property operands: List[Operand]
abstract classmethod deserialize_from(raw)
Parameters:

raw (bytes)

Return type:

NetQASMInstruction

abstract serialize()
Return type:

bytes

abstract classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

Return type:

NetQASMInstruction

writes_to()

Returns a list of Registers that this instruction writes to

Return type:

List[Register]

property debug_str
class netqasm.lang.instr.base.NoOperandInstruction(id=-1, mnemonic='', lineno=None)

Bases: NetQASMInstruction

An instruction with no operands.

Parameters:
  • id (int)

  • mnemonic (str)

  • lineno (Optional[HostLine])

property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegInstruction(id=-1, mnemonic='', lineno=None, reg=None)

Bases: NetQASMInstruction

An instruction with 1 Register operand.

Parameters:
reg: Register = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegRegInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None)

Bases: NetQASMInstruction

An instruction with 2 Register operands.

Parameters:
reg0: Register = None
reg1: Register = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegImmImmInstruction(id=-1, mnemonic='', lineno=None, reg=None, imm0=None, imm1=None)

Bases: NetQASMInstruction

An instruction with 1 Register operand followed by 2 Immediate operands.

Parameters:
reg: Register = None
imm0: Immediate = None
imm1: Immediate = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegRegImmImmInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, imm0=None, imm1=None)

Bases: NetQASMInstruction

An instruction with 2 Register operands followed by 2 Immediate operands.

Parameters:
reg0: Register = None
reg1: Register = None
imm0: Immediate = None
imm1: Immediate = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegRegImm4Instruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, imm0=None, imm1=None, imm2=None, imm3=None)

Bases: NetQASMInstruction

An instruction with 2 Register operands followed by 4 Immediate operands.

Parameters:
reg0: Register = None
reg1: Register = None
imm0: Immediate = None
imm1: Immediate = None
imm2: Immediate = None
imm3: Immediate = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegRegRegInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, reg2=None)

Bases: NetQASMInstruction

An instruction with 3 Register operands.

Parameters:
reg0: Register = None
reg1: Register = None
reg2: Register = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegRegRegRegInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, reg2=None, reg3=None)

Bases: NetQASMInstruction

An instruction with 4 Register operands.

Parameters:
reg0: Register = None
reg1: Register = None
reg2: Register = None
reg3: Register = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.ImmInstruction(id=-1, mnemonic='', lineno=None, imm=None)

Bases: NetQASMInstruction

An instruction with 1 Immediate operand.

Parameters:
imm: Immediate = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.ImmImmInstruction(id=-1, mnemonic='', lineno=None, imm0=None, imm1=None)

Bases: NetQASMInstruction

An instruction with 2 Immediate operands.

Parameters:
imm0: Immediate = None
imm1: Immediate = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegRegImmInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, imm=None)

Bases: NetQASMInstruction

An instruction with 2 Register operands and one Immediate operand.

Parameters:
reg0: Register = None
reg1: Register = None
imm: Immediate = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegImmInstruction(id=-1, mnemonic='', lineno=None, reg=None, imm=None)

Bases: NetQASMInstruction

An instruction with 1 Register operand and one Immediate operand.

Parameters:
reg: Register = None
imm: Immediate = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegEntryInstruction(id=-1, mnemonic='', lineno=None, reg=None, entry=None)

Bases: NetQASMInstruction

An instruction with 1 Register operand and one ArrayEntry operand.

Parameters:
reg: Register = None
entry: ArrayEntry = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.RegAddrInstruction(id=-1, mnemonic='', lineno=None, reg=None, address=None)

Bases: NetQASMInstruction

An instruction with 1 Register operand and one Address operand.

Parameters:
reg: Register = None
address: Address = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.ArrayEntryInstruction(id=-1, mnemonic='', lineno=None, entry=None)

Bases: NetQASMInstruction

An instruction with 1 ArrayEntry operand and one Address operand.

Parameters:
entry: ArrayEntry = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.ArraySliceInstruction(id=-1, mnemonic='', lineno=None, slice=None)

Bases: NetQASMInstruction

An instruction with 1 ArraySlice operand.

Parameters:
slice: ArraySlice = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.AddrInstruction(id=-1, mnemonic='', lineno=None, address=None)

Bases: NetQASMInstruction

An instruction with 1 Address operand.

Parameters:
  • id (int)

  • mnemonic (str)

  • lineno (Optional[HostLine])

  • address (Optional[Address])

address: Address = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.Reg5Instruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, reg2=None, reg3=None, reg4=None)

Bases: NetQASMInstruction

An instruction with 5 Register operands.

Parameters:
reg0: Register = None
reg1: Register = None
reg2: Register = None
reg3: Register = None
reg4: Register = None
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.base.DebugInstruction(id=-1, mnemonic='', lineno=None, text='')

Bases: NetQASMInstruction

Parameters:
  • id (int)

  • mnemonic (str)

  • lineno (Optional[HostLine])

  • text (str)

text: str = ''
property operands: List[Operand]
classmethod deserialize_from(raw)
Parameters:

raw (bytes)

serialize()
Return type:

bytes

classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

netqasm.lang.instr.core

class netqasm.lang.instr.core.SingleQubitInstruction(id=-1, mnemonic='', lineno=None, reg=None)

Bases: RegInstruction

Parameters:
property qreg
abstract to_matrix()
Return type:

ndarray

class netqasm.lang.instr.core.TwoQubitInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None)

Bases: RegRegInstruction

Parameters:
property qreg0
property qreg1
abstract to_matrix()
abstract to_matrix_target_only()
class netqasm.lang.instr.core.RotationInstruction(id=-1, mnemonic='', lineno=None, reg=None, imm0=None, imm1=None)

Bases: RegImmImmInstruction

Parameters:
property qreg
property angle_num
property angle_denom
abstract to_matrix()
classmethod from_operands(operands)
Parameters:

operands (List[Union[Operand, int]])

class netqasm.lang.instr.core.ControlledRotationInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, imm0=None, imm1=None)

Bases: RegRegImmImmInstruction

Parameters:
property qreg0
property qreg1
property angle_num
property angle_denom
abstract to_matrix()
class netqasm.lang.instr.core.ClassicalOpInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, reg2=None)

Bases: RegRegRegInstruction

Parameters:
writes_to()

Returns a list of Registers that this instruction writes to

Return type:

List[Register]

property regout
property regin0
property regin1
class netqasm.lang.instr.core.ClassicalOpModInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, reg2=None, reg3=None)

Bases: RegRegRegRegInstruction

Parameters:
writes_to()

Returns a list of Registers that this instruction writes to

Return type:

List[Register]

property regout
property regin0
property regin1
property regmod
class netqasm.lang.instr.core.QAllocInstruction(id=1, mnemonic='qalloc', lineno=None, reg=None)

Bases: RegInstruction

Parameters:
id: int = 1
mnemonic: str = 'qalloc'
property qreg
class netqasm.lang.instr.core.InitInstruction(id=2, mnemonic='init', lineno=None, reg=None)

Bases: RegInstruction

Parameters:
id: int = 2
mnemonic: str = 'init'
property qreg
class netqasm.lang.instr.core.ArrayInstruction(id=3, mnemonic='array', lineno=None, reg=None, address=None)

Bases: RegAddrInstruction

Parameters:
id: int = 3
mnemonic: str = 'array'
property size
class netqasm.lang.instr.core.SetInstruction(id=4, mnemonic='set', lineno=None, reg=None, imm=None)

Bases: RegImmInstruction

Parameters:
id: int = 4
mnemonic: str = 'set'
writes_to()

Returns a list of Registers that this instruction writes to

Return type:

List[Register]

class netqasm.lang.instr.core.StoreInstruction(id=5, mnemonic='store', lineno=None, reg=None, entry=None)

Bases: RegEntryInstruction

Parameters:
id: int = 5
mnemonic: str = 'store'
class netqasm.lang.instr.core.LoadInstruction(id=6, mnemonic='load', lineno=None, reg=None, entry=None)

Bases: RegEntryInstruction

Parameters:
id: int = 6
mnemonic: str = 'load'
writes_to()

Returns a list of Registers that this instruction writes to

Return type:

List[Register]

class netqasm.lang.instr.core.UndefInstruction(id=7, mnemonic='undef', lineno=None, entry=None)

Bases: ArrayEntryInstruction

Parameters:
id: int = 7
mnemonic: str = 'undef'
class netqasm.lang.instr.core.LeaInstruction(id=8, mnemonic='lea', lineno=None, reg=None, address=None)

Bases: RegAddrInstruction

Parameters:
id: int = 8
mnemonic: str = 'lea'
writes_to()

Returns a list of Registers that this instruction writes to

Return type:

List[Register]

class netqasm.lang.instr.core.JmpInstruction(id=9, mnemonic='jmp', lineno=None, imm=None)

Bases: ImmInstruction

Parameters:
id: int = 9
mnemonic: str = 'jmp'
property line
class netqasm.lang.instr.core.BranchUnaryInstruction(id=-1, mnemonic='', lineno=None, reg=None, imm=None)

Bases: RegImmInstruction

Represents an instruction to branch to a certain line, depending on a unary expression.

Parameters:
property line
abstract check_condition(a)
Return type:

bool

class netqasm.lang.instr.core.BezInstruction(id=10, mnemonic='bez', lineno=None, reg=None, imm=None)

Bases: BranchUnaryInstruction

Parameters:
id: int = 10
mnemonic: str = 'bez'
check_condition(a)
Parameters:

a (int)

Return type:

bool

class netqasm.lang.instr.core.BnzInstruction(id=11, mnemonic='bnz', lineno=None, reg=None, imm=None)

Bases: BranchUnaryInstruction

Parameters:
id: int = 11
mnemonic: str = 'bnz'
check_condition(a)
Parameters:

a (int)

Return type:

bool

class netqasm.lang.instr.core.BranchBinaryInstruction(id=-1, mnemonic='', lineno=None, reg0=None, reg1=None, imm=None)

Bases: RegRegImmInstruction

Represents an instruction to branch to a certain line, depending on a binary expression.

Parameters:
property line
abstract check_condition(a, b)
Return type:

bool

class netqasm.lang.instr.core.BeqInstruction(id=12, mnemonic='beq', lineno=None, reg0=None, reg1=None, imm=None)

Bases: BranchBinaryInstruction

Parameters:
id: int = 12
mnemonic: str = 'beq'
check_condition(a, b)
Parameters:
  • a (int)

  • b (int)

Return type:

bool

class netqasm.lang.instr.core.BneInstruction(id=13, mnemonic='bne', lineno=None, reg0=None, reg1=None, imm=None)

Bases: BranchBinaryInstruction

Parameters:
id: int = 13
mnemonic: str = 'bne'
check_condition(a, b)
Parameters:
  • a (int)

  • b (int)

Return type:

bool

class netqasm.lang.instr.core.BltInstruction(id=14, mnemonic='blt', lineno=None, reg0=None, reg1=None, imm=None)

Bases: BranchBinaryInstruction

Parameters:
id: int = 14
mnemonic: str = 'blt'
check_condition(a, b)
Parameters:
  • a (int)

  • b (int)

Return type:

bool

class netqasm.lang.instr.core.BgeInstruction(id=15, mnemonic='bge', lineno=None, reg0=None, reg1=None, imm=None)

Bases: BranchBinaryInstruction

Parameters:
id: int = 15
mnemonic: str = 'bge'
check_condition(a, b)
Parameters:
  • a (int)

  • b (int)

Return type:

bool

class netqasm.lang.instr.core.AddInstruction(id=16, mnemonic='add', lineno=None, reg0=None, reg1=None, reg2=None)

Bases: ClassicalOpInstruction

Parameters:
id: int = 16
mnemonic: str = 'add'
class netqasm.lang.instr.core.SubInstruction(id=17, mnemonic='sub', lineno=None, reg0=None, reg1=None, reg2=None)

Bases: ClassicalOpInstruction

Parameters:
id: int = 17
mnemonic: str = 'sub'
class netqasm.lang.instr.core.AddmInstruction(id=18, mnemonic='addm', lineno=None, reg0=None, reg1=None, reg2=None, reg3=None)

Bases: ClassicalOpModInstruction

Parameters:
id: int = 18
mnemonic: str = 'addm'
class netqasm.lang.instr.core.SubmInstruction(id=19, mnemonic='subm', lineno=None, reg0=None, reg1=None, reg2=None, reg3=None)

Bases: ClassicalOpModInstruction

Parameters:
id: int = 19
mnemonic: str = 'subm'
class netqasm.lang.instr.core.MeasInstruction(id=32, mnemonic='meas', lineno=None, reg0=None, reg1=None)

Bases: RegRegInstruction

Parameters:
id: int = 32
mnemonic: str = 'meas'
writes_to()

Returns a list of Registers that this instruction writes to

Return type:

List[Register]

property qreg
property creg
class netqasm.lang.instr.core.MeasBasisInstruction(id=41, mnemonic='meas_basis', lineno=None, reg0=None, reg1=None, imm0=None, imm1=None, imm2=None, imm3=None)

Bases: RegRegImm4Instruction

Parameters:
id: int = 41
mnemonic: str = 'meas_basis'
writes_to()

Returns a list of Registers that this instruction writes to

Return type:

List[Register]

property qreg
property creg
property angle_num_x1
property angle_num_y
property angle_num_x2
property angle_denom
class netqasm.lang.instr.core.CreateEPRInstruction(id=33, mnemonic='create_epr', lineno=None, reg0=None, reg1=None, reg2=None, reg3=None, reg4=None)

Bases: Reg5Instruction

Parameters:
id: int = 33
mnemonic: str = 'create_epr'
property remote_node_id
property epr_socket_id
property qubit_addr_array
property arg_array
property ent_results_array
class netqasm.lang.instr.core.RecvEPRInstruction(id=34, mnemonic='recv_epr', lineno=None, reg0=None, reg1=None, reg2=None, reg3=None)

Bases: RegRegRegRegInstruction

Parameters:
id: int = 34
mnemonic: str = 'recv_epr'
property remote_node_id
property epr_socket_id
property qubit_addr_array
property ent_results_array
class netqasm.lang.instr.core.WaitAllInstruction(id=35, mnemonic='wait_all', lineno=None, slice=None)

Bases: ArraySliceInstruction

Parameters:
id: int = 35
mnemonic: str = 'wait_all'
class netqasm.lang.instr.core.WaitAnyInstruction(id=36, mnemonic='wait_any', lineno=None, slice=None)

Bases: ArraySliceInstruction

Parameters:
id: int = 36
mnemonic: str = 'wait_any'
class netqasm.lang.instr.core.WaitSingleInstruction(id=37, mnemonic='wait_single', lineno=None, entry=None)

Bases: ArrayEntryInstruction

Parameters:
id: int = 37
mnemonic: str = 'wait_single'
class netqasm.lang.instr.core.QFreeInstruction(id=38, mnemonic='qfree', lineno=None, reg=None)

Bases: RegInstruction

Parameters:
id: int = 38
mnemonic: str = 'qfree'
property qreg
class netqasm.lang.instr.core.RetRegInstruction(id=39, mnemonic='ret_reg', lineno=None, reg=None)

Bases: RegInstruction

Parameters:
id: int = 39
mnemonic: str = 'ret_reg'
class netqasm.lang.instr.core.RetArrInstruction(id=40, mnemonic='ret_arr', lineno=None, address=None)

Bases: AddrInstruction

Parameters:
  • id (int)

  • mnemonic (str)

  • lineno (Optional[HostLine])

  • address (Optional[Address])

id: int = 40
mnemonic: str = 'ret_arr'
class netqasm.lang.instr.core.BreakpointInstruction(id=100, mnemonic='breakpoint', lineno=None, imm0=None, imm1=None)

Bases: ImmImmInstruction

Parameters:
id: int = 100
mnemonic: str = 'breakpoint'
property action
property role

netqasm.lang.instr.flavour

class netqasm.lang.instr.flavour.InstrMap(id_map=None, name_map=None)

Bases: object

Parameters:
id_map: Optional[Dict[int, Type[NetQASMInstruction]]] = None
name_map: Optional[Dict[str, Type[NetQASMInstruction]]] = None
class netqasm.lang.instr.flavour.Flavour(flavour_specific)

Bases: ABC

A Flavour represents an explicit instruction set that adheres to the Core NetQASM specification. Typically, a flavour is used for each specific target hardware.

A flavour ‘inherits’ all classical instructions from the core, but can specify explicitly the quantum instructions that the hardware supports, by listing the corresponding instruction classes.

Examples of flavours are the Vanilla flavour (with instructions defined in vanilla.py) and the Nitrogen-Vacancy (NV) flavour (instructions in nv.py).

Parameters:

flavour_specific (List[Type[NetQASMInstruction]])

get_instr_by_id(id)
Parameters:

id (int)

get_instr_by_name(name)
Parameters:

name (str)

abstract property instrs
class netqasm.lang.instr.flavour.VanillaFlavour

Bases: Flavour

property instrs
class netqasm.lang.instr.flavour.NVFlavour

Bases: Flavour

property instrs
class netqasm.lang.instr.flavour.REIDSFlavour

Bases: Flavour

property instrs

netqasm.lang.instr.nv

class netqasm.lang.instr.nv.GateXInstruction(id=20, mnemonic='x', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 20
mnemonic: str = 'x'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.nv.GateYInstruction(id=21, mnemonic='y', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 21
mnemonic: str = 'y'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.nv.GateZInstruction(id=22, mnemonic='z', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 22
mnemonic: str = 'z'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.nv.GateHInstruction(id=23, mnemonic='h', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 23
mnemonic: str = 'h'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.nv.RotXInstruction(id=27, mnemonic='rot_x', lineno=None, reg=None, imm0=None, imm1=None)

Bases: RotationInstruction

Parameters:
id: int = 27
mnemonic: str = 'rot_x'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.nv.RotYInstruction(id=28, mnemonic='rot_y', lineno=None, reg=None, imm0=None, imm1=None)

Bases: RotationInstruction

Parameters:
id: int = 28
mnemonic: str = 'rot_y'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.nv.RotZInstruction(id=29, mnemonic='rot_z', lineno=None, reg=None, imm0=None, imm1=None)

Bases: RotationInstruction

Parameters:
id: int = 29
mnemonic: str = 'rot_z'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.nv.ControlledRotXInstruction(id=30, mnemonic='crot_x', lineno=None, reg0=None, reg1=None, imm0=None, imm1=None)

Bases: ControlledRotationInstruction

Parameters:
id: int = 30
mnemonic: str = 'crot_x'
to_matrix()
Return type:

ndarray

to_matrix_target_only()
Return type:

ndarray

class netqasm.lang.instr.nv.ControlledRotYInstruction(id=31, mnemonic='crot_y', lineno=None, reg0=None, reg1=None, imm0=None, imm1=None)

Bases: ControlledRotationInstruction

Parameters:
id: int = 31
mnemonic: str = 'crot_y'
to_matrix()
Return type:

ndarray

to_matrix_target_only()
Return type:

ndarray

netqasm.lang.instr.vanilla

class netqasm.lang.instr.vanilla.GateXInstruction(id=20, mnemonic='x', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 20
mnemonic: str = 'x'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.GateYInstruction(id=21, mnemonic='y', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 21
mnemonic: str = 'y'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.GateZInstruction(id=22, mnemonic='z', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 22
mnemonic: str = 'z'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.GateHInstruction(id=23, mnemonic='h', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 23
mnemonic: str = 'h'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.GateSInstruction(id=24, mnemonic='s', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 24
mnemonic: str = 's'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.GateKInstruction(id=25, mnemonic='k', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 25
mnemonic: str = 'k'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.GateTInstruction(id=26, mnemonic='t', lineno=None, reg=None)

Bases: SingleQubitInstruction

Parameters:
id: int = 26
mnemonic: str = 't'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.RotXInstruction(id=27, mnemonic='rot_x', lineno=None, reg=None, imm0=None, imm1=None)

Bases: RotationInstruction

Parameters:
id: int = 27
mnemonic: str = 'rot_x'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.RotYInstruction(id=28, mnemonic='rot_y', lineno=None, reg=None, imm0=None, imm1=None)

Bases: RotationInstruction

Parameters:
id: int = 28
mnemonic: str = 'rot_y'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.RotZInstruction(id=29, mnemonic='rot_z', lineno=None, reg=None, imm0=None, imm1=None)

Bases: RotationInstruction

Parameters:
id: int = 29
mnemonic: str = 'rot_z'
to_matrix()
Return type:

ndarray

class netqasm.lang.instr.vanilla.CnotInstruction(id=30, mnemonic='cnot', lineno=None, reg0=None, reg1=None)

Bases: TwoQubitInstruction

Parameters:
id: int = 30
mnemonic: str = 'cnot'
to_matrix()
Return type:

ndarray

to_matrix_target_only()
Return type:

ndarray

class netqasm.lang.instr.vanilla.CphaseInstruction(id=31, mnemonic='cphase', lineno=None, reg0=None, reg1=None)

Bases: TwoQubitInstruction

Parameters:
id: int = 31
mnemonic: str = 'cphase'
to_matrix()
Return type:

ndarray

to_matrix_target_only()
Return type:

ndarray

class netqasm.lang.instr.vanilla.MovInstruction(id=41, mnemonic='mov', lineno=None, reg0=None, reg1=None)

Bases: TwoQubitInstruction

Move source qubit to target qubit (target is overwritten)

Parameters:
id: int = 41
mnemonic: str = 'mov'
to_matrix()
Return type:

ndarray

to_matrix_target_only()
Return type:

ndarray