class_docstr: Density operator for representing mixed states.
  
  TODO: Density operator support for Qubits
  
  Parameters
  ==========
  
  values : tuples/lists
  Each tuple/list should be of form (state, prob) or [state,prob]
  
  Examples
  ========
  
  Create a density operator with 2 states represented by Kets.
  
  >>> from sympy.physics.quantum.state import Ket
  >>> from sympy.physics.quantum.density import Density
  >>> d = Density([Ket(0), 0.5], [Ket(1),0.5])
  >>> d
  Density((|0>, 0.5),(|1>, 0.5))
docstr: Expand the density operator into an outer product format.
  
  Examples
  ========
  
  >>> from sympy.physics.quantum.state import Ket
  >>> from sympy.physics.quantum.density import Density
  >>> from sympy.physics.quantum.operator import Operator
  >>> A = Operator('A')
  >>> d = Density([Ket(0), 0.5], [Ket(1),0.5])
  >>> d.doit()
  0.5*|0><0| + 0.5*|1><1|
docstr_tok: ["Expand","the","density","operator","into","an","outer","product","format",".","Examples","========",">",">",">","from","sympy.physics.quantum.state","import","Ket",">",">",">","from","sympy.physics.quantum.density","import","Density",">",">",">","from","sympy.physics.quantum.operator","import","Operator",">",">",">","A","=","Operator","(","'","A","'",")",">",">",">","d","=","Density","(","[","Ket","(","0",")",",","0.5","]",",","[","Ket","(","1",")",",0.5","]",")",">",">",">","d.doit","(",")","0.5","*","|0",">","<","0|","+","0.5","*","|1",">","<","1|"]
code: def doit(self, **hints):
      """Expand the density operator into an outer product format.
  
      Examples
      ========
  
      >>> from sympy.physics.quantum.state import Ket
      >>> from sympy.physics.quantum.density import Density
      >>> from sympy.physics.quantum.operator import Operator
      >>> A = Operator('A')
      >>> d = Density([Ket(0), 0.5], [Ket(1),0.5])
      >>> d.doit()
      0.5*|0><0| + 0.5*|1><1|
  
      """
  
      terms = []
      for state, prob in self.args:
          state = state.expand()  # needed to break up (a+b)*c
          if isinstance(state, Add):
              for arg in product(state.args, repeat=2):
                  terms.append(
                      prob * self._generate_outer_prod(arg[0], arg[1])
                  )
          else:
              terms.append(
                  prob * self._generate_outer_prod(state, state)
              )
  
      return Add(*terms)
  
imports: from itertools import product
  from sympy.core.add import Add
  from sympy.core.containers import Tuple
  from sympy.core.function import expand
  from sympy.core.mul import Mul
  from sympy.core.singleton import S
  from sympy.functions.elementary.exponential import log
  from sympy.matrices.dense import MutableDenseMatrix
  from sympy.printing.pretty.stringpict import prettyForm
  from sympy.physics.quantum.dagger import Dagger
  from sympy.physics.quantum.operator import HermitianOperator
  from sympy.physics.quantum.represent import represent
  from sympy.physics.quantum.matrixutils import numpy_ndarray, scipy_sparse_matrix, to_numpy
  from sympy.physics.quantum.tensorproduct import TensorProduct, tensor_product_simp
  from sympy.physics.quantum.trace import Tr
label_desc: Use image node_id 7 for calling the Density obj's underlying member method code with example usage: obj.doit() and returns: Add