Skip to content

Commit e068926

Browse files
committed
Define monomial constructor
1 parent 985e962 commit e068926

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/gcd.jl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,8 @@ function deflation(p::AbstractPolynomialLike)
261261
shift_defl = shift_deflation.(p, variables(p))
262262
shift = getindex.(shift_defl, 1)
263263
defl = getindex.(shift_defl, 2)
264-
s = prod(
265-
variables(p) .^ shift;
266-
init = constant_monomial(p),
267-
)::monomial_type(p)
268-
d = prod(
269-
variables(p) .^ defl;
270-
init = constant_monomial(p),
271-
)::monomial_type(p)
264+
s = monomial(variables(p), shift)
265+
d = monomial(variables(p), defl)
272266
return s, d
273267
end
274268

src/term.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ Returns the monomial of the term `t`.
151151
### Examples
152152
153153
Calling `monomial` on ``4x^2y`` should return ``x^2y``.
154+
155+
monomial(variables, exponents)
156+
157+
Returns the monomial corresponding to `prod(variables .^ exponents)`
158+
159+
### Examples
160+
161+
In order to create `x^2 * y`,
162+
163+
* with DynamicPolynomials, use `monomial([x, y], [2, 1])`,
164+
* with TypedPolynomials, use `monomial((x, y), (2, 1))`.
154165
"""
155166
function monomial end
156167
monomial(t::AbstractTerm) = t.monomial # by convention, the field should be `monomial`.

0 commit comments

Comments
 (0)