U2Gate.get_unitary_and_grad
- U2Gate.get_unitary_and_grad(params=[])
Return a tuple combining the outputs of get_unitary and get_grad.
- Parameters:
params (
RealVector
) – The unitary parameters, seeUnitary.get_unitary()
for more info.- Returns:
- tuple containing:
UnitaryMatrix: The unitary matrix, see
Unitary.get_unitary()
for more info.np.ndarray: The unitary’s gradient, see
get_grad()
.
- Return type:
tuple
Notes
Can be overridden to potentially speed up optimization by calculating both at the same time.