class_docstr: Tests for the relative entropy qml.math function
class_docstr_tok: ["Tests","for","the","relative","entropy","qml.math","function"]
docstr: Test that mutual information works for density matrices
docstr_tok: ["Test","that","mutual","information","works","for","density","matrices"]
code: def test_density_matrix(
      self, interface, state0, state1, expected, base, check_state
  ):
      """Test that mutual information works for density matrices"""
      state0 = qml.math.asarray(state0, like=interface)
      state1 = qml.math.asarray(state1, like=interface)
  
      actual = qml.math.relative_entropy(
          state0, state1, base=base, check_state=check_state
      )
      div = 1 if base is None else np.log(base)
      assert np.allclose(actual, expected / div, rtol=1e-06, atol=1e-07)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 1 for calling the TestRelativeEntropy obj's underlying member method code with example usage: obj.test_density_matrix(interface, state0, state1, expected, base, check_state) without return types