diff --git a/src/sage/groups/matrix_gps/group_element.pyx b/src/sage/groups/matrix_gps/group_element.pyx index 777b141beb0..bcb9fad842e 100644 --- a/src/sage/groups/matrix_gps/group_element.pyx +++ b/src/sage/groups/matrix_gps/group_element.pyx @@ -82,6 +82,8 @@ from sage.libs.gap.element cimport GapElement, GapElement_List from sage.groups.libgap_wrapper cimport ElementLibGAP from sage.structure.element import is_Matrix +from sage.rings.polynomial.multi_polynomial_libsingular import MPolynomial_libsingular +from sage.all import PolynomialRing, Matrix as MatrixConstructor from sage.structure.factorization import Factorization from sage.misc.cachefunc import cached_method from sage.rings.integer_ring import ZZ @@ -489,6 +491,18 @@ cdef class MatrixGroupElement_gap(ElementLibGAP): """ return hash(self.matrix()) + def __call__(self, other): + r""" + """ + if type(other)==MPolynomial_libsingular: + assert self.base_ring()==other.base_ring() + mRingPoly=other + polynomial_vars=mRingPoly.variables() + varsToSubstituteModuleContext=self*MatrixConstructor(polynomial_vars).transpose() + varsToSubstituteRingContext=map(PolynomialRing(self.base_ring(), other.variables()), varsToSubstituteModuleContext) + substitutionDict={v:s for v,s in zip(polynomial_vars, varsToSubstituteRingContext)} + return mRingPoly.subs(substitutionDict) + def _repr_(self): r""" Return string representation of this matrix.