This module contains classes and functions for Operator arithmetic.

Constructor Functions

adjoint(fn[, lazy])

Create the adjoint of an Operator or a function that applies the adjoint of the provided function.

ctrl(op, control[, control_values, work_wires])

Create a method that applies a controlled version of the provided op.

exp(op[, coeff, num_steps, id])

Take the exponential of an Operator times a coefficient.

sum(*summands[, id, lazy])

Construct an operator which is the sum of the given operators.

pow(base[, z, lazy, id])

Raise an Operator to a power.

prod(*ops[, id, lazy])

Construct an operator which represents the generalized product of the operators provided.

s_prod(scalar, operator[, lazy, id])

Construct an operator which is the scalar product of the given scalar and operator provided.

Symbolic Classes

Adjoint([base, id])

The Adjoint of an operator.

CompositeOp(*operands[, id])

A base class for operators that are composed of other operators.

Controlled(base, control_wires[, …])

Symbolic operator denoting a controlled operator.

ControlledOp(base, control_wires[, …])

Operation-specific methods and properties for the Controlled class.

Evolution(generator[, param, num_steps, id])

Create an exponential operator that defines a generator, of the form \(e^{-ix\hat{G}}\)

Exp(base[, coeff, num_steps, id])

A symbolic operator representing the exponential of a operator.

Pow([base, z, id])

Symbolic operator denoting an operator raised to a power.

Prod(*operands[, id])

Symbolic operator representing the product of operators.

Sum(*operands[, id])

Symbolic operator representing the sum of operators.

SProd(scalar, base[, id])

Arithmetic operator representing the scalar product of an operator with the given scalar.

SymbolicOp(base[, id])

Developer-facing base class for single-operator symbolic operators.

ScalarSymbolicOp(base, scalar[, id])

Developer-facing base class for single-operator symbolic operators that contain a scalar coefficient.

Controlled Operator Classes

ControlledQubitUnitary(U, control_wires, …)

Apply an arbitrary fixed unitary to wires with control from the control_wires.


The controlled-Y operator


The controlled-Z operator


ctrl_decomp_zyz(target_operation, control_wires)

Decompose the controlled version of a target single-qubit operation

ctrl_decomp_bisect(target_operation, …)

Decompose the controlled version of a target single-qubit operation