Operation
- class Operation(gate, location, params=[])[source]
Bases:
DifferentiableUnitary
An Operation groups together a gate, its parameters and location.
- __init__(gate, location, params=[])[source]
Construct an operation.
- Parameters:
gate (
Gate
) – The operation’s gate.location (
CircuitLocationLike
) – The set of qudits this gate is applied to.params (
RealVector
) – The parameters for the gate.
- Raises:
ValueError – If gate’s size doesn’t match location’s length.
ValueError – If gate’s num_params doesn’t match params’s length.
Attributes
The matrix dimension for this unitary.
The operation's gate.
The qudit this operation is applied to.
The number of real parameters this unitary-valued function takes.
The number of qudits this unitary can act on.
The operation's parameters for its gate.
The number of orthogonal states for each qudit.
Methods
check_parameters
(params)Check parameters are valid and match the unitary.
get_grad
([params])Return the gradient for this operation.
Return the operation's inverse operation.
get_qasm
()Return the qasm string for this operation.
get_unitary
([params])Return the unitary for this gate, see
Unitary
for more.get_unitary_and_grad
([params])Return the unitary and gradient for this gate.
Return true if this unitary doesn't take parameters.
Check if operation is differentiable.
Return true if this unitary is parameterized.
Return true if this unitary can only act on qubits.
is_qudit_only
(radix)Return true if this unitary can only act on radix-qudits.
Return true if this unitary can only act on qutrits.
is_self_inverse
([params])Checks whether the unitary is its own inverse.