in evaluation/latex2sympy/latex2sympy2.py [0:0]
def mat_mul_flat(lh, rh):
if hasattr(lh, 'is_MatMul') and lh.is_MatMul or hasattr(rh, 'is_MatMul') and rh.is_MatMul:
args = []
if hasattr(lh, 'is_MatMul') and lh.is_MatMul:
args += list(lh.args)
else:
args += [lh]
if hasattr(rh, 'is_MatMul') and rh.is_MatMul:
args = args + list(rh.args)
else:
args += [rh]
return sympy.MatMul(*[arg.doit() for arg in args], evaluate=False)
else:
if hasattr(lh, 'doit') and hasattr(rh, 'doit'):
return sympy.MatMul(lh.doit(), rh.doit(), evaluate=False)
elif hasattr(lh, 'doit') and not hasattr(rh, 'doit'):
return sympy.MatMul(lh.doit(), rh, evaluate=False)
elif not hasattr(lh, 'doit') and hasattr(rh, 'doit'):
return sympy.MatMul(lh, rh.doit(), evaluate=False)
else:
return sympy.MatMul(lh, rh, evaluate=False)