@@ -164,11 +164,15 @@ function deflation(p::AbstractPolynomialLike)
164164 return s, d
165165end
166166
167+ function _zero_to_one_exp (defl:: AbstractMonomial )
168+ # TODO Make it faster by calling something like `mapexponents`.
169+ return prod (variables (defl).^ map (d -> iszero (d) ? one (d) : d, exponents (defl)))
170+ end
167171function deflate (p:: AbstractPolynomialLike , shift, defl)
168172 if isconstant (shift) && all (d -> isone (d) || iszero (d), exponents (defl))
169173 return p
170174 end
171- q = MA. operate (deflate, p, shift, defl)
175+ q = MA. operate (deflate, p, shift, _zero_to_one_exp ( defl) )
172176 return q
173177end
174178function inflate (α, shift, defl)
@@ -178,7 +182,7 @@ function inflate(p::AbstractPolynomialLike, shift, defl)
178182 if isconstant (shift) && all (d -> isone (d) || iszero (d), exponents (defl))
179183 return p
180184 end
181- q = MA. operate (inflate, p, shift, defl)
185+ q = MA. operate (inflate, p, shift, _zero_to_one_exp ( defl) )
182186 return q
183187end
184188
193197
194198# Inspired from to `AbstractAlgebra.deflate`
195199function MA. operate (op:: Union{typeof(deflate), typeof(inflate)} , p:: AbstractPolynomialLike , shift, defl)
196- defl = prod (variables (defl).^ map (d -> iszero (d) ? one (d) : d, exponents (defl)))
197200 return polynomial (map (terms (p)) do t
198201 return term (coefficient (t), MA. operate (op, monomial (t), shift, defl))
199202 end )
0 commit comments