class_docstr: Integration tests for the ParametrizedEvolution class.
class_docstr_tok: ["Integration","tests","for","the","ParametrizedEvolution","class","."]
docstr: Test the wire mapping for custom wire labels works as expected with DefaultQubit
docstr_tok: ["Test","the","wire","mapping","for","custom","wire","labels","works","as","expected","with","DefaultQubit"]
code: def test_map_wires_with_time_independent_hamiltonian(self):
      """Test the wire mapping for custom wire labels works as expected with DefaultQubit"""
      import jax
      from jax import numpy as jnp
  
      def f1(params, t):
          return params  # constant
  
      def f2(params, t):
          return params  # constant
  
      ops = [
          qml.PauliX("a"),
          qml.PauliZ("b"),
          qml.PauliY("a"),
          qml.PauliX("b"),
      ]
      coeffs = [f1, f2, 4, 9]
      H = ParametrizedHamiltonian(coeffs, ops)
  
      dev = DefaultQubit()
  
      t = 4
  
      @qml.qnode(dev)
      def circuit(params):
          ParametrizedEvolution(H=H, params=params, t=t)
          return qml.expval(qml.PauliX("a") @ qml.PauliX("b"))
  
      @jax.jit
      @qml.qnode(dev)
      def jitted_circuit(params):
          ParametrizedEvolution(H=H, params=params, t=t)
          return qml.expval(qml.PauliX("a") @ qml.PauliX("b"))
  
      @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 4 for calling the TestIntegration obj's underlying member method code with example usage: obj.test_map_wires_with_time_independent_hamiltonian() and returns: params, params, qml, qml, qml