MQTOpt Dialect

‘mqtopt’ Dialect

The MQT optimization (mqtopt) dialect.

This dialect is using value semantics for qubits. This means that variables of type qubit and the elements of qubit registers do not identify a physical, they rather refer to the state of a qubit. A qubit state can be assigned only once and can also be used only once. Otherwise, the no-cloning theorem would be violated.

The first requirement is enforced by the SSA form of MLIR. The second requirement is not explicitly enforced. However, when converting the input dialect mqt that is using reference semantics to the mqtopt dialect, qubit state values will only be used once by construction. This is also the reason why the mqtopt dialect is not meant to be used by hand, but rather as an intermediate representation for optimization passes.

Due to the value semantics, the mqtopt dialect allows dataflow analysis and optimizations. Those are very common in classical compiler optimizations. Hence, the existing classical compiler optimizations can easier be reused for quantum programs.

For more information, see the paper “QIRO: A Static Single Assignment based Quantum Program Representation for Optimization”.

The mqtopt dialect supports dynamic as well as static qubit addressing.

Operations

mqtopt.allocQubit (::mqt::ir::opt::AllocQubitOp)

Allocates a single qubit

Syntax:

operation ::= `mqtopt.allocQubit` attr-dict

Allocates a single qubit in the “0” state. The qubit can be used in operations after allocation. It must be deallocated with the deallocQubit operation.

Example:

%q = mqtopt.allocQubit

Interfaces: InferTypeOpInterface

Results:

Result

Description

qubit

value-semantic qubit

mqtopt.barrier (::mqt::ir::opt::BarrierOp)

Barrier operation

Syntax:

operation ::= `mqtopt.barrier` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents the barrier operation. It has a variadic number of input qubits and no control qubits.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoControl, NoParameter

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.dcx (::mqt::ir::opt::DCXOp)

DCX operation

Syntax:

operation ::= `mqtopt.dcx` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a DCX gate. It takes two qubits and a variadic list of positive/negative controls as input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.deallocQubit (::mqt::ir::opt::DeallocQubitOp)

Deallocates a single qubit

Syntax:

operation ::= `mqtopt.deallocQubit` $qubit attr-dict

Deallocates a single qubit that was previously allocated with the allocQubit operation. After this operation, the qubit is no longer valid and cannot be used in further operations.

Example:

mqtopt.deallocQubit %q

Operands:

Operand

Description

qubit

value-semantic qubit

mqtopt.ecr (::mqt::ir::opt::ECROp)

DCX operation

Syntax:

operation ::= `mqtopt.ecr` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an ECR gate. It takes two qubits and a variadic list of positive/negative controls as input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.gphase (::mqt::ir::opt::GPhaseOp)

GPhase operation

Syntax:

operation ::= `mqtopt.gphase` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a global phase gate. It accepts a parameter indicating the degree of the rotation angle. The global phase gate does not have any input and output qubits. It might still be controlled by arbitrarily many qubits.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoTarget, OneParameter

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.h (::mqt::ir::opt::HOp)

H operation

Syntax:

operation ::= `mqtopt.h` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a Hadamard gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.i (::mqt::ir::opt::IOp)

I operation

Syntax:

operation ::= `mqtopt.i` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an identity gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.iswap (::mqt::ir::opt::iSWAPOp)

ISWAP operation

Syntax:

operation ::= `mqtopt.iswap` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an iSWAP gate. It takes two qubits and a variadic list of positive/negative controls as input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.iswapdg (::mqt::ir::opt::iSWAPdgOp)

ISWAPdg operation

Syntax:

operation ::= `mqtopt.iswapdg` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an inverse iSWAP gate. It takes two qubits and a variadic list of positive/negative controls as input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.measure (::mqt::ir::opt::MeasureOp)

A measure operation

Syntax:

operation ::= `mqtopt.measure` $in_qubit attr-dict

This class represents a measure operation. It takes a single qubit as input and returns a qubit and a bit. After the measurement, the returned qubit is in state “0” or “1”. The value of the state is indicated by the returned bit.

Example:

%q_1, %0 = mqtopt.measure q_0

Interfaces: InferTypeOpInterface

Operands:

Operand

Description

in_qubit

value-semantic qubit

Results:

Result

Description

out_qubit

value-semantic qubit

out_bit

1-bit signless integer

mqtopt.p (::mqt::ir::opt::POp)

P operation

Syntax:

operation ::= `mqtopt.p` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a phase gate. It takes a qubit and a variadic list of positive/negative controls as an input. Additionally, it accepts a parameter indicating the degree of the rotation angle.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.peres (::mqt::ir::opt::PeresOp)

Peres operation

Syntax:

operation ::= `mqtopt.peres` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a Peres gate. It takes two qubits and a variadic list of positive/negative controls as input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.peresdg (::mqt::ir::opt::PeresdgOp)

Peresdg operation

Syntax:

operation ::= `mqtopt.peresdg` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an inverse Peres gate. It takes two qubits and a variadic list of positive/negative controls as input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.qubit (::mqt::ir::opt::QubitOp)

Retrieve static qubit

Syntax:

operation ::= `mqtopt.qubit` $index attr-dict

The mqtopt.qubit operation produces an SSA value from the given index to a static (hardware) qubit.

Example:

%q = mqtopt.qubit 0

Interfaces: InferTypeOpInterface

Attributes:

AttributeMLIR TypeDescription
index::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Results:

Result

Description

qubit

value-semantic qubit

mqtopt.r (::mqt::ir::opt::ROp)

R operation

Syntax:

operation ::= `mqtopt.r` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a R gate. It takes a qubit and a variadic list of positive/negative controls as an input. Additionally, it accepts two parameters indicating the degree of the rotation angles.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneTarget, TwoParameters

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.reset (::mqt::ir::opt::ResetOp)

A reset operation

Syntax:

operation ::= `mqtopt.reset` $in_qubit attr-dict

This class represents a reset operation. It takes a single qubit as input and returns the same qubit after its state was reset to “0”.

Example:

%q_1 = mqtopt.reset %q_0

Interfaces: InferTypeOpInterface

Operands:

Operand

Description

in_qubit

value-semantic qubit

Results:

Result

Description

out_qubit

value-semantic qubit

mqtopt.rx (::mqt::ir::opt::RXOp)

RX operation

Syntax:

operation ::= `mqtopt.rx` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an RX gate. It takes a qubit and a variadic list of positive/negative controls as input. Additionally, it accepts a parameter indicating the degree of the rotation angle.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.rxx (::mqt::ir::opt::RXXOp)

RXX operation

Syntax:

operation ::= `mqtopt.rxx` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an RXX gate. It takes two qubits and a variadic list of positive/negative controls as input. Additionally, it accepts a parameter indicating the degree of the rotation angle.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.ry (::mqt::ir::opt::RYOp)

RY operation

Syntax:

operation ::= `mqtopt.ry` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an RY gate. It takes a qubit and a variadic list of positive/negative controls as input. Additionally, it accepts a parameter indicating the degree of the rotation angle.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.ryy (::mqt::ir::opt::RYYOp)

RYY operation

Syntax:

operation ::= `mqtopt.ryy` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an RYY gate. It takes two qubits and a variadic list of positive/negative controls as input. Additionally, it accepts a parameter indicating the degree of the rotation angle.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.rz (::mqt::ir::opt::RZOp)

RZ operation

Syntax:

operation ::= `mqtopt.rz` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an RZ gate. It takes a qubit and a variadic list of positive/negative controls as input. Additionally, it accepts a parameter indicating the degree of the rotation angle.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.rzx (::mqt::ir::opt::RZXOp)

RZX operation

Syntax:

operation ::= `mqtopt.rzx` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an RZX gate. It takes two qubits and a variadic list of positive/negative controls as input. Additionally, it accepts a parameter indicating the degree of the rotation angle.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.rzz (::mqt::ir::opt::RZZOp)

RZZ operation

Syntax:

operation ::= `mqtopt.rzz` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an RZZ gate. It takes two qubits and a variadic list of positive/negative controls as input. Additionally, it accepts a parameter indicating the degree of the rotation angle.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.s (::mqt::ir::opt::SOp)

S operation

Syntax:

operation ::= `mqtopt.s` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an S gate. It takes a qubit as an input and a variadic list of positive/negative controls.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.sdg (::mqt::ir::opt::SdgOp)

Sdg operation

Syntax:

operation ::= `mqtopt.sdg` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an inverse S gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.swap (::mqt::ir::opt::SWAPOp)

SWAP operation

Syntax:

operation ::= `mqtopt.swap` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a SWAP gate. It takes two qubits and a variadic list of positive/negative controls as input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.sx (::mqt::ir::opt::SXOp)

SX operation

Syntax:

operation ::= `mqtopt.sx` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an SX gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.sxdg (::mqt::ir::opt::SXdgOp)

SXdg operation

Syntax:

operation ::= `mqtopt.sxdg` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an inverse SX gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.t (::mqt::ir::opt::TOp)

T operation

Syntax:

operation ::= `mqtopt.t` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a T gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.tdg (::mqt::ir::opt::TdgOp)

Tdg operation

Syntax:

operation ::= `mqtopt.tdg` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an inverse T gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.u (::mqt::ir::opt::UOp)

U operation

Syntax:

operation ::= `mqtopt.u` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a U gate. It takes a qubit and a variadic list of positive/negative controls as an input. Additionally, it accepts three parameters indicating the degree of the rotation angles.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneTarget, ThreeParameters

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.u2 (::mqt::ir::opt::U2Op)

U2 operation

Syntax:

operation ::= `mqtopt.u2` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a U2 gate. It takes a qubit and a variadic list of positive/negative controls as an input. Additionally, it accepts two parameters indicating the degree of the rotation angles.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, OneTarget, TwoParameters

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.v (::mqt::ir::opt::VOp)

V operation

Syntax:

operation ::= `mqtopt.v` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a V gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.vdg (::mqt::ir::opt::VdgOp)

Vdg operation

Syntax:

operation ::= `mqtopt.vdg` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an inverse V gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.x (::mqt::ir::opt::XOp)

X operation

Syntax:

operation ::= `mqtopt.x` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a Pauli-X gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.xx_minus_yy (::mqt::ir::opt::XXminusYYOp)

XX-YY operation

Syntax:

operation ::= `mqtopt.xx_minus_yy` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an XX-YY gate. It takes two qubits and a variadic list of positive/negative controls as input. Additionally, it accepts two parameters indicating the degree of the rotation angles.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, TwoParameters, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.xx_plus_yy (::mqt::ir::opt::XXplusYYOp)

XX+YY operation

Syntax:

operation ::= `mqtopt.xx_plus_yy` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents an XX+YY gate. It takes two qubits and a variadic list of positive/negative controls as input. Additionally, it accepts two parameters indicating the degree of the rotation angles.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, TwoParameters, TwoTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.y (::mqt::ir::opt::YOp)

Y operation

Syntax:

operation ::= `mqtopt.y` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a Pauli-Y gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

mqtopt.z (::mqt::ir::opt::ZOp)

Z operation

Syntax:

operation ::= `mqtopt.z` `(` custom<OptParams>($params, $static_params, $params_mask) `)`
              attr-dict
              ( $in_qubits^ )? ( `ctrl` $pos_ctrl_in_qubits^ )? ( `nctrl` $neg_ctrl_in_qubits^ )?
              custom<OptOutputTypes>(type($out_qubits), type($pos_ctrl_out_qubits), type($neg_ctrl_out_qubits))

This class represents a Pauli-Z gate. It takes a qubit and a variadic list of positive/negative controls as an input.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments, NoParameter, OneTarget

Interfaces: UnitaryInterface

Attributes:

AttributeMLIR TypeDescription
static_params::mlir::DenseF64ArrayAttrf64 dense array attribute
params_mask::mlir::DenseBoolArrayAttri1 dense array attribute

Operands:

Operand

Description

params

variadic of 64-bit float

in_qubits

variadic of value-semantic qubit

pos_ctrl_in_qubits

variadic of value-semantic qubit

neg_ctrl_in_qubits

variadic of value-semantic qubit

Results:

Result

Description

out_qubits

variadic of value-semantic qubit

pos_ctrl_out_qubits

variadic of value-semantic qubit

neg_ctrl_out_qubits

variadic of value-semantic qubit

Types

QubitType

Value-semantic qubit

Syntax: !mqtopt.Qubit

The value-semantic qubit corresponds to a state. It can be static or dynamic.

Passes

-gate-elimination

This pass searches for consecutive applications of gates and their inverses and cancels them.

This pass searches for applications of gates that are their own inverses. Walking down their def-use chain, it then checks if the same gate is applied once again. In that case, the two gates are cancelled. Additionally, all occurrences of the identity gate are removed.

-lift-measurements

This pass attempts to lift measurements as much as possible by replacing quantum operations with classical operations where possible.

This pass consists of several patterns that attempt to push different structures of quantum gates below measurements.

-merge-rotation-gates

This pass searches for consecutive applications of rotation gates that can be merged.

Consecutive applications of gphase, p, rx, ry, rz, rxx, ryy, rzz, and rzx are merged into one by adding their angles. The merged gate is currently not removed if the angles add up to zero.

This pass currently does not affect xx_minus_yy, xx_plus_yy, u, and u2.

-mqt-core-round-trip

This pass performs a round trip to MQT Core’s QuantumComputation and back

This pass starts by extracting all quantum-computation-relevant operations and then translates them into an MQT Core QuantumComputation, deleting all quantum operations in the process. Then, the quantum computation is read in a second pattern and used to generate new MLIR code from it.

This pass makes the following assumptions:

  • Each module consists of a single function that uses mqtopt operations with just a single qubit register.

  • All qubits are measured exactly once and the boolean measurement results are returned from the function in order.

  • The first returned value is the AllocOp that constructs a qubit register.

  • Unitary operations may also use any number of (positive) controls.

-placement-sc

This pass maps program qubits to hardware qubits on superconducting quantum devices using initial placement strategies.

Options

-strategy : The initial placement strategy to use.
-arch     : The name of the targeted architecture.

-quantum-sink

This pass attempts to push down operations into branches for possible optimizations.

This pass searches for branch instructions and attempts to push instructions from previous branches into them.

-reuse-qubits

Reduce the number of required qubits by reusing existing ones that are no longer used.

This pass performs qubit reuse, searching for qubits that are first referenced after the final reference to a different qubit. In these cases, rather than using a new qubit, the old qubit can be reset and reused.

-route-astar-sc

This pass ensures that all two-qubit gates are executable on the target architecture.

Routes the program by dividing the circuit into layers of parallel two-qubit gates and iteratively searches and inserts SWAPs for each layer using A*-search.

Options

-arch       : The name of the targeted architecture.
-nlookahead : astar option: Number of lookahead steps (heuristic horizon)
-alpha      : astar option: The alpha factor in the cost function
-lambda     : astar option: The lambda factor in the cost function

Statistics

num-additional-swaps : The number of additional SWAPs

-route-naive-sc

This pass ensures that all two-qubit gates are executable on the target architecture.

Simple pre-order traversal of the IR that routes any non-executable gates by inserting SWAPs along the shortest path.

Options

-arch : The name of the targeted architecture.

Statistics

num-additional-swaps : The number of additional SWAPs

-swap-reconstruction-and-elision

Reconstruct SWAPs from eligible CNOT pairs and eliminate SWAPs by applying the implied qubit permutation.

Eliminates all uncontrolled swap operations by:

  1. Reconstructing explicit swap ops from eligible CNOT patterns (canonical 3–CNOT form or two alternating CNOT pairs).

  2. Replacing remaining swap ops by applying the induced qubit permutation to subsequent uses.

Notes:

  • No connectivity or coupling constraints are preserved.

  • Controlled swap operations (if ever introduced) are not touched.

Example (reconstruction):

     ┌───┐         ┌───┐
──■──┤ X ├    ──■──┤ X ├──■────■──    ──╳────■──
┌─┴─┐└─┬─┘ => ┌─┴─┐└─┬─┘┌─┴─┐┌─┴─┐ =>   |  ┌─┴─┐
┤ X ├──■──    ┤ X ├──■──┤ X ├┤ X ├    ──╳──┤ X ├
└───┘         └───┘     └───┘└───┘         └───┘

Example (elision):

                         ┌───┐                 ┌───┐
q0 ──╳────■── q0    q0 ──┤ X ├──╳── q0    q0 ──┤ X ├─ q1
     |  ┌─┴─┐    =>      └─┬─┘  |      =>      └─┬─┘
q1 ──╳──┤ X ├ q1    q1 ────■────╳── q1    q1 ────■─── q0
        └───┘

-verify-routing-sc

This pass verifies that all two-qubit gates are executable on the target architecture.

This pass ensures that all two-qubit gates are executable on the target’s architecture.

Options

-arch : The name of the targeted architecture.

Interfaces

OpInterface definitions

UnitaryInterface (UnitaryInterface)

This interface provides a generic way to interact with unitary operations in the MQTOpt dialect. Unitary operations are quantum operations that are reversible and can be represented by a unitary matrix. The interface provides methods to access the operands and results of the operation.

Methods:

getInQubits
mlir::OperandRange getInQubits();

Returns all input qubits of the operation excl. control qubits.

NOTE: This method must be implemented by the user.

getPosCtrlInQubits
mlir::OperandRange getPosCtrlInQubits();

Returns all positively-controlling input qubits of the operation.

NOTE: This method must be implemented by the user.

getNegCtrlInQubits
mlir::OperandRange getNegCtrlInQubits();

Returns all negatively-controlling input qubits of the operation.

NOTE: This method must be implemented by the user.

getOutQubits
mlir::ResultRange getOutQubits();

Returns all output qubits of the operation excl. control qubits.

NOTE: This method must be implemented by the user.

getPosCtrlOutQubits
mlir::ResultRange getPosCtrlOutQubits();

Returns all positively-controlling output qubits of the operation.

NOTE: This method must be implemented by the user.

getNegCtrlOutQubits
mlir::ResultRange getNegCtrlOutQubits();

Returns all negatively-controlling output qubits of the operation.

NOTE: This method must be implemented by the user.

getAllCtrlInQubits
std::vector<mlir::Value> getAllCtrlInQubits();

Returns all controlling input qubits of the operation.

NOTE: This method must be implemented by the user.

getAllCtrlOutQubits
std::vector<mlir::Value> getAllCtrlOutQubits();

Returns all control output qubits of the operation.

NOTE: This method must be implemented by the user.

isControlled
bool isControlled();

Returns true if the operation has any control qubits, otherwise false.

NOTE: This method must be implemented by the user.

getAllInQubits
std::vector<mlir::Value> getAllInQubits();

Returns all input qubits of the operation incl. all controlling qubits.

NOTE: This method must be implemented by the user.

getAllOutQubits
std::vector<mlir::Value> getAllOutQubits();

Returns all output qubits of the operation incl. all controlling qubits.

NOTE: This method must be implemented by the user.

getParams
mlir::ValueRange getParams();

Get params.

NOTE: This method must be implemented by the user.

getCorrespondingInput
mlir::Value getCorrespondingInput(mlir::Value outQubit);

Get the corresponding input qubit for a given output qubit.

NOTE: This method must be implemented by the user.

getCorrespondingOutput
mlir::Value getCorrespondingOutput(mlir::Value inQubit);

Get the corresponding output qubit for a given input qubit.

NOTE: This method must be implemented by the user.

getIdentifier
llvm::StringRef getIdentifier();

Returns the name of the gate.

NOTE: This method must be implemented by the user.