qml.operation.operation_derivative

operation_derivative(operation)numpy.ndarray[source]

Calculate the derivative of an operation.

For an operation \(e^{i \hat{H} \phi t}\), this function returns the matrix representation in the standard basis of its derivative with respect to \(t\), i.e.,

\[\frac{d \, e^{i \hat{H} \phi t}}{dt} = i \phi \hat{H} e^{i \hat{H} \phi t},\]

where \(\phi\) is a real constant.

Parameters

operation (Operation) – The operation to be differentiated.

Returns

the derivative of the operation as a matrix in the standard basis

Return type

array

Raises

ValueError – if the operation does not have a generator or is not composed of a single trainable parameter