code: def test_docstring_example_exact():
      """Test that the optimizer works with matrix exponential."""
  
      hamiltonian = qml.Hamiltonian(
          coeffs=[-1.0] * 3,
          observables=[
              qml.PauliX(0),
              qml.PauliZ(1),
              qml.PauliY(0) @ qml.PauliX(1),
          ],
      )
  
      @qml.qnode(qml.device("default.qubit", wires=2))
      def quant_fun():
          qml.RX(0.1, wires=[0])
          qml.RY(0.5, wires=[1])
          qml.CNOT(wires=[0, 1])
          qml.RY(0.6, wires=[0])
          return qml.expval(hamiltonian)
  
      opt = RiemannianGradientOptimizer(
          circuit=quant_fun, stepsize=0.1, exact=True
      )
  
      for _ in range(12):
          circuit, cost = opt.step_and_cost()
      circuit()
      assert np.isclose(cost, -2.236068, atol=1e-3)
  
file_path: pennylane/tests/optimize/test_riemannian_gradient_optimizer.py
imports: import pytest
  from scipy.sparse.linalg import expm
  import numpy
  import pennylane
  from pennylane.optimize import RiemannianGradientOptimizer
label_desc: Use image node_id 14 for calling a global function with example usage: test_docstring_example_exact() and returns: qml