def _eigenvects_DOM(M, **kwargs): DOM = DomainMatrix.from_Matrix(M, field=True, extension=True) if DOM.domain != EX: rational, algebraic = dom_eigenvects(DOM) eigenvects = dom_eigenvects_to_sympy(rational, algebraic, M.__class__, **kwargs) eigenvects = sorted(eigenvects, key=lambda x: default_sort_key(x[0])) return eigenvects return None
def _to_domain(m, domain=None): """Convert Matrix to DomainMatrix""" # XXX: deprecated support for RawMatrix: ring = getattr(m, "ring", None) m = m.applyfunc(lambda e: e.as_expr() if isinstance(e, Poly) else e) dM = DomainMatrix.from_Matrix(m) domain = domain or ring if domain is not None: dM = dM.convert_to(domain) return dM