Skip to content

Commit 014104d

Browse files
authored
Define monomial constructor (#328)
* Define monomial constructor * Bump TP to v0.4.2 * Drop Julia v1.6
1 parent 985e962 commit 014104d

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ jobs:
1717
- version: '1'
1818
os: ubuntu-latest
1919
arch: x64
20-
- version: '1.6'
21-
os: ubuntu-latest
22-
arch: x64
2320
- version: '1.10'
2421
os: ubuntu-latest
2522
arch: x64

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
1414
ChainRulesCore = "1"
1515
DataStructures = "0.19"
1616
MutableArithmetics = "0.3, 1"
17-
julia = "1.6"
17+
julia = "1.10"

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`.

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ TypedPolynomials = "afbbf031-7a57-5f58-a1b9-b774a0fad08d"
1111

1212
[compat]
1313
DynamicPolynomials = "0.6"
14-
TypedPolynomials = "0.4"
14+
TypedPolynomials = "0.4.2"

0 commit comments

Comments
 (0)