class_docstr: Test the special cases on a two qubit state.  Also tests the special cases for einsum and tensor application methods
  for additional testing of these generic matrix application methods.
class_docstr_tok: ["Test","the","special","cases","on","a","two","qubit","state",".","Also","tests","the","special","cases","for","einsum","and","tensor","application","methods","for","additional","testing","of","these","generic","matrix","application","methods","."]
docstr: Test the application of a hadamard on a two qubit state.
docstr_tok: ["Test","the","application","of","a","hadamard","on","a","two","qubit","state","."]
code: def test_hadamard(self, method, wire, ml_framework):
      """Test the application of a hadamard on a two qubit state."""
      initial_state = np.array(
          [
              [0.04624539 + 0.3895457j, 0.22399401 + 0.53870339j],
              [-0.483054 + 0.2468498j, -0.02772249 - 0.45901669j],
          ]
      )
      initial_state = qml.math.asarray(initial_state, like=ml_framework)
  
      new_state = method(qml.Hadamard(wire), initial_state)
  
      inv_sqrt2 = 1 / np.sqrt(2)
  
      initial0 = qml.math.take(initial_state, 0, axis=wire)
      initial1 = qml.math.take(initial_state, 1, axis=wire)
  
      expected0 = inv_sqrt2 * (initial0 + initial1)
      new0 = qml.math.take(new_state, 0, axis=wire)
      assert qml.math.allclose(new0, expected0)
  
      expected1 = inv_sqrt2 * (initial0 - initial1)
      new1 = qml.math.take(new_state, 1, axis=wire)
      assert qml.math.allclose(new1, expected1)
  
imports: from functools import reduce
  import pytest
  import numpy
  from scipy.stats import unitary_group
  import pennylane
  from pennylane.operation import _UNSET_BATCH_SIZE, Operation
  from pennylane.devices.qubit.apply_operation import apply_operation, apply_operation_einsum, apply_operation_tensordot
label_desc: Use image node_id 4 for calling the TestTwoQubitStateSpecialCases obj's underlying member method code with example usage: obj.test_hadamard(method, wire, ml_framework) without return types