class_docstr: Test that broadcasting works as expected for the entropy functions
class_docstr_tok: ["Test","that","broadcasting","works","as","expected","for","the","entropy","functions"]
docstr: Test broadcasting for purity and density matrices
docstr_tok: ["Test","broadcasting","for","purity","and","density","matrices"]
code: def test_purity_broadcast_dm(self, wires, check_state, interface):
      """Test broadcasting for purity and density matrices"""
      density_matrix = [
          [
              [1 / 2, 0, 0, 1 / 2],
              [0, 0, 0, 0],
              [0, 0, 0, 0],
              [1 / 2, 0, 0, 1 / 2],
          ],
          [
              [1 / 2, 0, 0, 0],
              [0, 0, 0, 0],
              [0, 0, 0, 0],
              [0, 0, 0, 1 / 2],
          ],
          [[1, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]],
      ]
      expected = [0.5, 0.5, 1]
  
      if interface:
          density_matrix = qml.math.asarray(
              density_matrix, like=interface
          )
  
      purity = qml.math.purity(
          density_matrix, wires, check_state=check_state
      )
      assert qml.math.allclose(purity, expected)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 1 for calling the TestEntropyBroadcasting obj's underlying member method code with example usage: obj.test_purity_broadcast_dm(wires, check_state, interface) without return types