<s> from __future__ import print_function , division <EOL> from sympy import Basic <EOL> from sympy . functions import adjoint , conjugate <EOL> from sympy . matrices . expressions . matexpr import MatrixExpr <EOL> class Transpose ( MatrixExpr ) : <EOL> """<STR_LIT>""" <EOL> is_Transpose = True <EOL> def doit ( self , ** hints ) : <EOL> arg = self . arg <EOL> if hints . get ( '<STR_LIT>' , True ) and isinstance ( arg , Basic ) : <EOL> arg = arg . doit ( ** hints ) <EOL> try : <EOL> result = arg . _eval_transpose ( ) <EOL> return result if result is not None else Transpose ( arg ) <EOL> except AttributeError : <EOL> return Transpose ( arg ) <EOL> @ property <EOL> def arg ( self ) : <EOL> return self . args [ <NUM_LIT:0> ] <EOL> @ property <EOL> def shape ( self ) : <EOL> return self . arg . shape [ : : - <NUM_LIT:1> ] <EOL> def _entry ( self , i , j ) : <EOL> return self . arg . _entry ( j , i ) <EOL> def _eval_adjoint ( self ) : <EOL> return conjugate ( self . arg ) <EOL> def _eval_conjugate ( self ) : <EOL> return adjoint ( self . arg ) <EOL> def _eval_transpose ( self ) : <EOL> return self . arg <EOL> def _eval_trace ( self ) : <EOL> from . trace import Trace <EOL> return Trace ( self . arg ) <EOL> def _eval_determinant ( self ) : <EOL> from sympy . matrices . expressions . determinant import det <EOL> return det ( self . arg ) <EOL> def transpose ( expr ) : <EOL> """<STR_LIT>""" <EOL> return Transpose ( expr ) . doit ( ) <EOL> from sympy . assumptions . ask import ask , Q <EOL> from sympy . assumptions . refine import handlers_dict <EOL> def refine_Transpose ( expr , assumptions ) : <EOL> """<STR_LIT>""" <EOL> if ask ( Q . symmetric ( expr ) , assumptions ) : <EOL> return expr . arg <EOL> return expr <EOL> handlers_dict [ '<STR_LIT>' ] = refine_Transpose </s>
