‘qop’ Dialect#
Backend-agnostic quantum operator algebra dialect
The qop dialect captures the algebraic structure of quantum operators
(Hamiltonians, Lindbladians, observables) as first-class MLIR values.
Key concepts:
Handlers: Leaf operators (Pauli, bosonic, fermionic, matrix)
Products: Tensor products of handlers with scalar coefficients
Sums: Linear combinations of products (the general operator)
Super-operators: Left/right action pairs for master equations
Evolution:
qop.evolve, the program’s root, evolves the state under a super-operator
Operations#
qop.add (::qop::AddOp)#
Add two operators
Syntax:
operation ::= `qop.add` $lhs `,` $rhs attr-dict `:` type($result)
The sum lhs + rhs of two operators.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
|
Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
Sum of products – the general quantum operator |
qop.anticommutator (::qop::AnticommutatorOp)#
Compute {A, B} = AB + BA
Syntax:
operation ::= `qop.anticommutator` $lhs `,` $rhs attr-dict `:` type($result)
The anticommutator lhs rhs + rhs lhs.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
|
Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
Sum of products – the general quantum operator |
qop.boson (::qop::BosonOp)#
Create a bosonic operator on a target mode
Syntax:
operation ::= `qop.boson` `(` $target `)` attr-dict `:` type($result)
A bosonic operator on mode target, truncated to dimension levels
(at least 2): kind is boson_i, boson_create, boson_annihilate
or boson_number.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
dimension | ::mlir::IntegerAttr | 64-bit signless integer attribute |
kind | ::qop::HandlerKindAttr | Kind of leaf quantum operator |
Operands:#
Operand |
Description |
|---|---|
|
64-bit signless integer |
Results:#
Result |
Description |
|---|---|
|
Leaf operator acting on specific degrees of freedom |
qop.callback_scalar (::qop::CallbackScalarOp)#
Create a time/parameter-dependent scalar coefficient
Syntax:
operation ::= `qop.callback_scalar` $callback attr-dict `:` type($result)
A time-dependent coefficient: the drive envelope named callback.
pulse-to-qop attaches the envelope’s kind and parameters as
attributes, which qop-to-cudm passes to the cuDensityMat runtime
for evaluation at each time step.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
callback | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
Results:#
Result |
Description |
|---|---|
|
Scalar coefficient (constant or time/parameter-dependent) |
qop.commutator (::qop::CommutatorOp)#
Compute [A, B] = AB - BA
Syntax:
operation ::= `qop.commutator` $lhs `,` $rhs attr-dict `:` type($result)
The commutator lhs rhs - rhs lhs.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
|
Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
Sum of products – the general quantum operator |
qop.const_scalar (::qop::ConstScalarOp)#
Create a constant complex scalar coefficient
Syntax:
operation ::= `qop.const_scalar` attr-dict `:` type($result)
The constant complex coefficient real + i imag.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
real | ::mlir::FloatAttr | 64-bit float attribute |
imag | ::mlir::FloatAttr | 64-bit float attribute |
Results:#
Result |
Description |
|---|---|
|
Scalar coefficient (constant or time/parameter-dependent) |
qop.dagger (::qop::DaggerOp)#
Hermitian conjugate of an operator
Syntax:
operation ::= `qop.dagger` $operand attr-dict `:` type($result)
The Hermitian conjugate of an operator.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
Sum of products – the general quantum operator |
qop.degrees (::qop::DegreesOp)#
Query which degrees of freedom an operator acts on
Syntax:
operation ::= `qop.degrees` $operand attr-dict `:` type($operand) `->` type($result)
The modes an operator acts on.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Allocate on ::mlir::SideEffects::DefaultResource, MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
any type |
qop.evolve (::qop::EvolveOp)#
Evolve the quantum system’s state under a generator
Syntax:
operation ::= `qop.evolve` $generator attr-dict `:` type($generator)
Evolves the state of the quantum system under the super-operator
generator over the program’s window: from qop.t_start to
qop.t_end ns in qop.step_count steps of the qop.integrator, all
module attributes. It is the program’s root: the operator ops are pure
and are kept because it uses them, so standard passes such as cse,
canonicalize and inline keep the program.
pulse-to-qop ends each program with one, of its qop.lindblad, and
qop-to-cudm lowers it to cudm.evolve.
%L = qop.lindblad(%H, %collapse) : !qop.super_op
qop.evolve %L : !qop.super_op
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Operands:#
Operand |
Description |
|---|---|
|
Super-operator for density matrix evolution |
qop.fermion (::qop::FermionOp)#
Create a fermionic operator on a target mode
Syntax:
operation ::= `qop.fermion` `(` $target `)` attr-dict `:` type($result)
A fermionic operator on mode target: kind is fermion_i,
fermion_create, fermion_annihilate or fermion_number.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
kind | ::qop::HandlerKindAttr | Kind of leaf quantum operator |
Operands:#
Operand |
Description |
|---|---|
|
64-bit signless integer |
Results:#
Result |
Description |
|---|---|
|
Leaf operator acting on specific degrees of freedom |
qop.lindblad (::qop::LindbladOp)#
Construct Lindblad super-operator from H and collapse ops
Syntax:
operation ::= `qop.lindblad` `(` $hamiltonian `,` $collapse_ops `)` attr-dict `:` type($result)
The Lindblad generator of a Hamiltonian and collapse operators L_k:
-i [H, rho] + sum_k (L_k rho L_k^dagger - {L_k^dagger L_k, rho} / 2).
pulse-to-qop builds one per program from the drives, couplings and
the target’s T1 and T2, for qop.evolve to evolve the state with, and
qop-to-cudm lowers it to a cuDensityMat operator.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
|
variadic of Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
Super-operator for density matrix evolution |
qop.make_product (::qop::MakeProductOp)#
Create a tensor product of handlers with a coefficient
Syntax:
operation ::= `qop.make_product` `(` $coefficient `,` $factors `)` attr-dict `:` type($result)
The tensor product of the handlers factors, weighted by
coefficient.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Scalar coefficient (constant or time/parameter-dependent) |
|
variadic of Leaf operator acting on specific degrees of freedom |
Results:#
Result |
Description |
|---|---|
|
Tensor product of handlers with a scalar coefficient |
qop.make_sum (::qop::MakeSumOp)#
Create a sum of product terms
Syntax:
operation ::= `qop.make_sum` `(` $terms `)` attr-dict `:` type($result)
The sum of one or more product terms: the general operator, such as a Hamiltonian or a collapse operator.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
variadic of Tensor product of handlers with a scalar coefficient |
Results:#
Result |
Description |
|---|---|
|
Sum of products – the general quantum operator |
qop.matrix_leaf (::qop::MatrixLeafOp)#
Create a user-defined matrix leaf operator
Syntax:
operation ::= `qop.matrix_leaf` `(` $data `)` attr-dict `:` type($data) `->` type($result)
A dense operator on the modes targets, of dimensions levels each.
data holds the matrix column-major with interleaved real and
imaginary parts, as a tensor<d x d x 2 x f64>. pulse-to-qop uses
it for qudits of more than two levels.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
targets | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
dimensions | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands:#
Operand |
Description |
|---|---|
|
any type |
Results:#
Result |
Description |
|---|---|
|
Leaf operator acting on specific degrees of freedom |
qop.scale (::qop::ScaleOp)#
Multiply an operator by a scalar coefficient
Syntax:
operation ::= `qop.scale` $coefficient `,` $operand attr-dict `:` type($result)
The operator operand times the scalar coefficient.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Scalar coefficient (constant or time/parameter-dependent) |
|
Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
Sum of products – the general quantum operator |
qop.spin (::qop::SpinOp)#
Create a Pauli spin operator on a target qubit
Syntax:
operation ::= `qop.spin` `(` $target `)` attr-dict `:` type($result)
A Pauli or ladder operator on qubit target: kind is one of
spin_i, spin_x, spin_y, spin_z, spin_lowering or
spin_raising. pulse-to-qop uses it for two-level qudits.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
kind | ::qop::HandlerKindAttr | Kind of leaf quantum operator |
Operands:#
Operand |
Description |
|---|---|
|
64-bit signless integer |
Results:#
Result |
Description |
|---|---|
|
Leaf operator acting on specific degrees of freedom |
qop.super_add (::qop::SuperAddOp)#
Add two super-operators
Syntax:
operation ::= `qop.super_add` $lhs `,` $rhs attr-dict `:` type($result)
The sum of two super-operators.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Super-operator for density matrix evolution |
|
Super-operator for density matrix evolution |
Results:#
Result |
Description |
|---|---|
|
Super-operator for density matrix evolution |
qop.super_both (::qop::SuperBothOp)#
Super-operator: S[rho] = A * rho * B
Syntax:
operation ::= `qop.super_both` $left `,` $right attr-dict `:` type($result)
The super-operator rho -> A rho B for left = A and right = B.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
|
Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
Super-operator for density matrix evolution |
qop.super_left (::qop::SuperLeftOp)#
Super-operator for left multiplication: S[rho] = A * rho
Syntax:
operation ::= `qop.super_left` $operand attr-dict `:` type($result)
The super-operator rho -> A rho of left multiplication by operand.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
Super-operator for density matrix evolution |
qop.super_right (::qop::SuperRightOp)#
Super-operator for right multiplication: S[rho] = rho * A
Syntax:
operation ::= `qop.super_right` $operand attr-dict `:` type($result)
The super-operator rho -> rho A of right multiplication by
operand.
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
Results:#
Result |
Description |
|---|---|
|
Super-operator for density matrix evolution |
qop.to_matrix (::qop::ToMatrixOp)#
Materialize operator to dense matrix at given time/params
Syntax:
operation ::= `qop.to_matrix` $operand `,` $time `,` $params attr-dict `:` type($operand) `,` type($params) `->` type($matrix)
The dense matrix of operand at time and parameters params, over
modes of dimensions levels each (all at least 2).
The pulse lowering does not produce it and qop-to-cudm does not
lower it yet; it is part of the operator algebra planned for later
backends.
Interfaces: MemoryEffectOpInterface (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{MemoryEffects::Allocate on ::mlir::SideEffects::DefaultResource, MemoryEffects::Write on ::mlir::SideEffects::DefaultResource}
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
dimensions | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands:#
Operand |
Description |
|---|---|
|
Sum of products – the general quantum operator |
|
64-bit float |
|
any type |
Results:#
Result |
Description |
|---|---|
|
any type |
Attributes#
HandlerKindAttr#
Kind of leaf quantum operator
Syntax:
#qop.handler_kind<
::qop::HandlerKind # value
>
Parameters:#
Parameter |
C++ type |
Description |
|---|---|---|
value |
|
an enum of type HandlerKind |
Types#
HandlerType#
Leaf operator acting on specific degrees of freedom
Syntax: !qop.handler
OpType#
Sum of products – the general quantum operator
Syntax: !qop.op
ProductType#
Tensor product of handlers with a scalar coefficient
Syntax: !qop.product
ScalarType#
Scalar coefficient (constant or time/parameter-dependent)
Syntax: !qop.scalar
SuperOpType#
Super-operator for density matrix evolution
Syntax: !qop.super_op
Enums#
HandlerKind#
Kind of leaf quantum operator
Cases:#
Symbol |
Value |
String |
|---|---|---|
SpinI |
|
spin_i |
SpinX |
|
spin_x |
SpinY |
|
spin_y |
SpinZ |
|
spin_z |
SpinLowering |
|
spin_lowering |
SpinRaising |
|
spin_raising |
BosonIdentity |
|
boson_i |
BosonCreate |
|
boson_create |
BosonAnnihilate |
|
boson_annihilate |
BosonNumber |
|
boson_number |
FermionIdentity |
|
fermion_i |
FermionCreate |
|
fermion_create |
FermionAnnihilate |
|
fermion_annihilate |
FermionNumber |
|
fermion_number |
Matrix |
|
matrix |