class_docstr: Integration tests for the ParametrizedEvolution class.
class_docstr_tok: ["Integration","tests","for","the","ParametrizedEvolution","class","."]
docstr: Test the execution of a time independent hamiltonian.
docstr_tok: ["Test","the","execution","of","a","time","independent","hamiltonian","."]
code: def test_time_independent_hamiltonian(self, device_class):
      """Test the execution of a time independent hamiltonian."""
      import jax
      import jax.numpy as jnp
  
      H = time_independent_hamiltonian()
  
      dev = device_class(wires=2)
  
      t = 4
  
      @qml.qnode(dev)
      def circuit(params):
          ParametrizedEvolution(H=H, params=params, t=t)
          return qml.expval(qml.PauliX(0) @ qml.PauliX(1))
  
      @jax.jit
      @qml.qnode(dev)
      def jitted_circuit(params):
          ParametrizedEvolution(H=H, params=params, t=t)
          return qml.expval(qml.PauliX(0) @ qml.PauliX(1))
  
      @qml.qnode(dev)
      def true_circuit(params):
          true_mat = qml.math.expm(-1j * qml.matrix(H(params, t=t)) * t)
          QubitUnitary(U=true_mat, wires=[0, 1])
          return qml.expval(qml.PauliX(0) @ qml.PauliX(1))
  
      params = jnp.array([1.0, 2.0])
  
      assert qml.math.allclose(
          circuit(params), true_circuit(params), atol=1e-3
      )
      assert qml.math.allclose(
          jitted_circuit(params), true_circuit(params), atol=1e-3
      )
      assert qml.math.allclose(
          jax.grad(circuit)(params),
          jax.grad(true_circuit)(params),
          atol=1e-3,
      )
      assert qml.math.allclose(
          jax.grad(jitted_circuit)(params),
          jax.grad(true_circuit)(params),
          atol=1e-3,
      )
  
imports: from functools import reduce
  import numpy
  import pytest
  import pennylane
  from pennylane.operation import AnyWires
  from pennylane.ops import QubitUnitary
  from pennylane.pulse import ParametrizedEvolution, ParametrizedHamiltonian
  from pennylane.tape import QuantumTape
  from pennylane.devices import DefaultQubit, DefaultQubitLegacy
label_desc: Use image node_id 2 for calling the TestIntegration obj's underlying member method code with example usage: obj.test_time_independent_hamiltonian(device_class) and returns: qml, qml, qml