def invert(self, poly): r""" Inverted map to initial ring. sage: from sage.rings.polynomial.pbori.pbori import * sage: from sage.rings.polynomial.pbori.blocks import declare_ring, Block sage: to_ring = declare_ring([Block("x", 10)], globals()) sage: from_ring = declare_ring([Block("y", 5), Block("x", 10)], globals()) sage: from sage.rings.polynomial.pbori.ll import RingMap sage: mapping = RingMap(to_ring, from_ring) sage: mapping.invert(mapping(x(1)+1)) x(1) + 1 """ return substitute_variables(self.from_ring, self.from_map, poly)
def __call__(self, poly): r""" Execute the map to change rings. TESTS:: sage: from sage.rings.polynomial.pbori.pbori import * sage: from sage.rings.polynomial.pbori.blocks import declare_ring, Block sage: to_ring = declare_ring([Block("x", 10)], globals()) sage: from_ring = declare_ring([Block("y", 5), Block("x", 10)], globals()) sage: from sage.rings.polynomial.pbori.ll import RingMap sage: mapping = RingMap(to_ring, from_ring) sage: mapping(x(1)+1) x(1) + 1 """ return substitute_variables(self.to_ring, self.to_map, poly)
def map_back(p): return substitute_variables(from_ring, map_back_vec, p)
def map_from(p): res = substitute_variables(to_ring, map_from_vec, p) return res