DifferentiableUnitary.get_grad

abstract DifferentiableUnitary.get_grad(params=[])[source]

Return the gradient for the unitary map as an np.ndarray.

Parameters:

params (RealVector) – The unitary parameters, see Unitary.get_unitary() for more info.

Returns:

The (num_params,N,N)-shaped, matrix-by-vector derivative of this unitary at the point specified by params.

Return type:

np.ndarray

Notes

The gradient of a unitary is defined as a matrix-by-vector derivative. If the UnitaryMatrix result of get_unitary has dimension NxN, then the shape of get_grad’s return value should equal (num_params,N,N), where the return value’s i-th element is the matrix derivative of the unitary with respect to the i-th parameter.