class_docstr: Generic Trace operation than can trace over:
  
  a) SymPy matrix
  b) operators
  c) outer products
  
  Parameters
  ==========
  o : operator, matrix, expr
  i : tuple/list indices (optional)
  
  Examples
  ========
  
  # TODO: Need to handle printing
  
  a) Trace(A+B) = Tr(A) + Tr(B)
  b) Trace(scalar*Operator) = scalar*Trace(Operator)
  
  >>> from sympy.physics.quantum.trace import Tr
  >>> from sympy import symbols, Matrix
  >>> a, b = symbols('a b', commutative=True)
  >>> A, B = symbols('A B', commutative=False)
  >>> Tr(a*A,[2])
  a*Tr(A)
  >>> m = Matrix([[1,2],[1,1]])
  >>> Tr(m)
  2
class_docstr_tok: ["Generic","Trace","operation","than","can","trace","over",":","a",")","SymPy","matrix","b",")","operators","c",")","outer","products","Parameters","==========","o",":","operator",",","matrix",",","expr","i",":","tuple\/list","indices","(","optional",")","Examples","========","#","TODO",":","Need","to","handle","printing","a",")","Trace","(","A+B",")","=","Tr","(","A",")","+","Tr","(","B",")","b",")","Trace","(","scalar","*","Operator",")","=","scalar","*","Trace","(","Operator",")",">",">",">","from","sympy.physics.quantum.trace","import","Tr",">",">",">","from","sympy","import","symbols",",","Matrix",">",">",">","a",",","b","=","symbols","(","'","a","b","'",",","commutative=True",")",">",">",">","A",",","B","=","symbols","(","'","A","B","'",",","commutative=False",")",">",">",">","Tr","(","a","*","A",",","[","2","]",")","a","*","Tr","(","A",")",">",">",">","m","=","Matrix","(","[","[","1,2","]",",","[","1,1","]","]",")",">",">",">","Tr","(","m",")","2"]
docstr: Perform the trace operation.
  
  #TODO: Current version ignores the indices set for partial trace.
  
  >>> from sympy.physics.quantum.trace import Tr
  >>> from sympy.physics.quantum.operator import OuterProduct
  >>> from sympy.physics.quantum.spin import JzKet, JzBra
  >>> t = Tr(OuterProduct(JzKet(1,1), JzBra(1,1)))
  >>> t.doit()
  1
docstr_tok: ["Perform","the","trace","operation",".","#","TODO",":","Current","version","ignores","the","indices","set","for","partial","trace",".",">",">",">","from","sympy.physics.quantum.trace","import","Tr",">",">",">","from","sympy.physics.quantum.operator","import","OuterProduct",">",">",">","from","sympy.physics.quantum.spin","import","JzKet",",","JzBra",">",">",">","t","=","Tr","(","OuterProduct","(","JzKet","(","1,1",")",",","JzBra","(","1,1",")",")",")",">",">",">","t.doit","(",")","1"]
code: def doit(self, **hints):
      """Perform the trace operation.
  
      #TODO: Current version ignores the indices set for partial trace.
  
      >>> from sympy.physics.quantum.trace import Tr
      >>> from sympy.physics.quantum.operator import OuterProduct
      >>> from sympy.physics.quantum.spin import JzKet, JzBra
      >>> t = Tr(OuterProduct(JzKet(1,1), JzBra(1,1)))
      >>> t.doit()
      1
  
      """
      if hasattr(self.args[0], "_eval_trace"):
          return self.args[0]._eval_trace(indices=self.args[1])
  
      return self
  
file_path: sympy/sympy/physics/quantum/trace.py
imports: from sympy.core.add import Add
  from sympy.core.containers import Tuple
  from sympy.core.expr import Expr
  from sympy.core.mul import Mul
  from sympy.core.power import Pow
  from sympy.core.sorting import default_sort_key
  from sympy.core.sympify import sympify
  from sympy.matrices import Matrix
label_desc: Use image node_id 3 for calling the Tr obj's underlying member method code with example usage: obj.doit() and returns: self, self