code: def MatrixTriangularSolve(a, rhs, lower, adj):
      
      trans = 0 if not adj else 2
  
      r = np.empty(rhs.shape).astype(a.dtype)
      for coord in np.ndindex(a.shape[:-2]):
          pos = coord + (Ellipsis,)
          r[pos] = sp.linalg.solve_triangular(a[pos] if not adj else np.conj(a[pos]), rhs[pos],
                                              trans=trans, lower=lower)
  
      return r,
docs: Matrix triangular solve op.