class_docstr: Test the Hermitian observable
class_docstr_tok: ["Test","the","Hermitian","observable"]
docstr: Test that the matrix representation is defined correctly
docstr_tok: ["Test","that","the","matrix","representation","is","defined","correctly"]
code: def test_matrix_representation(self, tol):
      """Test that the matrix representation is defined correctly"""
      A = np.array([[6 + 0j, 1 - 2j], [1 + 2j, -1]])
      res_static = qml.Hermitian.compute_matrix(A)
      res_dynamic = qml.Hermitian(A, wires=0).matrix()
      expected = np.array(
          [[6.0 + 0.0j, 1.0 - 2.0j], [1.0 + 2.0j, -1.0 + 0.0j]]
      )
      assert np.allclose(res_static, expected, atol=tol)
      assert np.allclose(res_dynamic, expected, atol=tol)
  
imports: import functools
  import pickle
  import pytest
  import numpy
  from gate_data import I, X, Y, Z, H
  import pennylane
  from pennylane.ops.qubit.observables import BasisStateProjector, StateVectorProjector
label_desc: Use image node_id 16 for calling the TestHermitian obj's underlying member method code with example usage: obj.test_matrix_representation(tol) without return types