Skip to content

Commit 6cb2837

Browse files
committed
Avoid obsolete names for functions and types
1 parent 5d1cc94 commit 6cb2837

File tree

14 files changed

+92
-94
lines changed

14 files changed

+92
-94
lines changed

docs/src/groebner-bases.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ At the moment different variants of Faugère's F4 Algorithm are implemented.
2727

2828
```@docs
2929
groebner_basis(
30-
I::Ideal{T} where T <: MPolyElem;
30+
I::Ideal{T} where T <: MPolyRingElem;
3131
initial_hts::Int=17,
3232
nr_thrds::Int=1,
3333
max_nr_pairs::Int=0,
@@ -46,7 +46,7 @@ variables of the first block via the `eliminate` parameter in the
4646

4747
```@docs
4848
eliminate(
49-
I::Ideal{T} where T <: MPolyElem,
49+
I::Ideal{T} where T <: MPolyRingElem,
5050
eliminate::Int;
5151
initial_hts::Int=17,
5252
nr_thrds::Int=1,

docs/src/solvers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The underlying engine is provided by msolve.
2626

2727
```@docs
2828
rational_parametrization(
29-
I::Ideal{T} where T <: MPolyElem;
29+
I::Ideal{T} where T <: MPolyRingElem;
3030
initial_hts::Int=17,
3131
nr_thrds::Int=1,
3232
max_nr_pairs::Int=0,
@@ -36,7 +36,7 @@ The underlying engine is provided by msolve.
3636
)
3737
3838
real_solutions(
39-
I::Ideal{T} where T <: MPolyElem;
39+
I::Ideal{T} where T <: MPolyRingElem;
4040
initial_hts::Int=17,
4141
nr_thrds::Int=1,
4242
max_nr_pairs::Int=0,
@@ -45,7 +45,7 @@ The underlying engine is provided by msolve.
4545
precision::Int=32
4646
)
4747
rational_solutions(
48-
I::Ideal{T} where T <: MPolyElem;
48+
I::Ideal{T} where T <: MPolyRingElem;
4949
initial_hts::Int=17,
5050
nr_thrds::Int=1,
5151
max_nr_pairs::Int=0,

docs/src/types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ We use [Nemo](https://www.nemocas.org/index.html)'s multivariate polynomial
2626
ring structures:
2727

2828
```@repl
29-
R, (x,y,z) = PolynomialRing(QQ, ["x", "y", "z"], ordering=:degrevlex)
29+
R, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"], ordering=:degrevlex)
3030
```
3131
The above example defines a multivariate polynomial ring in three variables `x`,
3232
`y`, and `z` over the rationals using the dgree reverse lexicographical ordering
3333
for printing polynomials in the following. One can also define polynomial rings
3434
over finite fields:
3535

3636
```@repl
37-
R, (x,y,z) = PolynomialRing(GF(101), ["x", "y", "z"], ordering=:degrevlex)
37+
R, (x,y,z) = polynomial_ring(GF(101), ["x", "y", "z"], ordering=:degrevlex)
3838
```
3939

4040
## Ideals
@@ -44,7 +44,7 @@ data structures connected to ideals in order to make computational algebra more
4444
effective:
4545

4646
```@repl
47-
R, (x,y,z) = PolynomialRing(QQ, ["x", "y", "z"], ordering=:degrevlex)
47+
R, (x,y,z) = polynomial_ring(QQ, ["x", "y", "z"], ordering=:degrevlex)
4848
I = Ideal([x+y+1, y*z^2-13*y^2])
4949
```
5050

src/algorithms/groebner-bases.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import msolve_jll: libneogb
33
export groebner_basis, eliminate
44

55
@doc Markdown.doc"""
6-
eliminate(I::Ideal{T} where T <: MPolyElem, eliminate::Int, <keyword arguments>)
6+
eliminate(I::Ideal{T} where T <: MPolyRingElem, eliminate::Int, <keyword arguments>)
77
88
Compute a Groebner basis of the ideal `I` w.r.t. to the product monomial ordering defined by two blocks
99
w.r.t. the degree reverse lexicographical monomial ordering using Faugère's F4 algorithm. Hereby the first block includes
@@ -14,7 +14,7 @@ At the moment the underlying algorithm is based on variants of Faugère's F4 Alg
1414
**Note**: At the moment only ground fields of characteristic `p`, `p` prime, `p < 2^{31}` are supported.
1515
1616
# Arguments
17-
- `I::Ideal{T} where T <: MPolyElem`: input generators.
17+
- `I::Ideal{T} where T <: MPolyRingElem`: input generators.
1818
- `initial_hts::Int=17`: initial hash table size `log_2`.
1919
- `nr_thrds::Int=1`: number of threads for parallel linear algebra.
2020
- `max_nr_pairs::Int=0`: maximal number of pairs per matrix, only bounded by minimal degree if `0`.
@@ -26,7 +26,7 @@ At the moment the underlying algorithm is based on variants of Faugère's F4 Alg
2626
```jldoctest
2727
julia> using AlgebraicSolving
2828
29-
julia> R, (x,y,z) = PolynomialRing(GF(101),["x","y","z"], ordering=:degrevlex)
29+
julia> R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], ordering=:degrevlex)
3030
(Multivariate polynomial ring in 3 variables over GF(101), Nemo.fpMPolyRingElem[x, y, z])
3131
3232
julia> I = Ideal([x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y])
@@ -38,7 +38,7 @@ julia> eliminate(I, 2)
3838
```
3939
"""
4040
function eliminate(
41-
I::Ideal{T} where T <: MPolyElem,
41+
I::Ideal{T} where T <: MPolyRingElem,
4242
eliminate::Int;
4343
initial_hts::Int=17,
4444
nr_thrds::Int=1,
@@ -59,15 +59,15 @@ function eliminate(
5959
end
6060

6161
@doc Markdown.doc"""
62-
groebner_basis(I::Ideal{T} where T <: MPolyElem, <keyword arguments>)
62+
groebner_basis(I::Ideal{T} where T <: MPolyRingElem, <keyword arguments>)
6363
6464
Compute a Groebner basis of the ideal `I` w.r.t. to the degree reverse lexicographical monomial ordering using Faugère's F4 algorithm.
6565
At the moment the underlying algorithm is based on variants of Faugère's F4 Algorithm.
6666
6767
**Note**: At the moment only ground fields of characteristic `p`, `p` prime, `p < 2^{31}` are supported.
6868
6969
# Arguments
70-
- `I::Ideal{T} where T <: MPolyElem`: input generators.
70+
- `I::Ideal{T} where T <: MPolyRingElem`: input generators.
7171
- `initial_hts::Int=17`: initial hash table size `log_2`.
7272
- `nr_thrds::Int=1`: number of threads for parallel linear algebra.
7373
- `max_nr_pairs::Int=0`: maximal number of pairs per matrix, only bounded by minimal degree if `0`.
@@ -80,7 +80,7 @@ At the moment the underlying algorithm is based on variants of Faugère's F4 Alg
8080
```jldoctest
8181
julia> using AlgebraicSolving
8282
83-
julia> R, (x,y,z) = PolynomialRing(GF(101),["x","y","z"], ordering=:degrevlex)
83+
julia> R, (x,y,z) = polynomial_ring(GF(101),["x","y","z"], ordering=:degrevlex)
8484
(Multivariate polynomial ring in 3 variables over GF(101), Nemo.fpMPolyRingElem[x, y, z])
8585
8686
julia> I = Ideal([x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y])
@@ -99,7 +99,7 @@ julia> groebner_basis(I, eliminate=2)
9999
```
100100
"""
101101
function groebner_basis(
102-
I::Ideal{T} where T <: MPolyElem;
102+
I::Ideal{T} where T <: MPolyRingElem;
103103
initial_hts::Int=17,
104104
nr_thrds::Int=1,
105105
max_nr_pairs::Int=0,
@@ -119,7 +119,7 @@ function groebner_basis(
119119
end
120120

121121
function _core_groebner_basis(
122-
I::Ideal{T} where T <: MPolyElem;
122+
I::Ideal{T} where T <: MPolyRingElem;
123123
initial_hts::Int=17,
124124
nr_thrds::Int=1,
125125
max_nr_pairs::Int=0,

src/algorithms/solvers.jl

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ function _get_rational_parametrization(
1717
nr_vars::Int32
1818
)
1919
if cfs_lf != Ptr{BigInt}(0)
20-
lf = [fmpz(unsafe_load(cfs_lf, i)) for i in 1:nr_vars]
20+
lf = [ZZRingElem(unsafe_load(cfs_lf, i)) for i in 1:nr_vars]
2121
else
22-
lf = fmpz[]
22+
lf = ZZRingElem[]
2323
end
24-
C, x = PolynomialRing(QQ,"x")
24+
C, x = polynomial_ring(QQ,"x")
2525
ctr = 0
2626

2727
elim = C([unsafe_load(cfs, i) for i in 1:lens[1]])
@@ -31,13 +31,13 @@ function _get_rational_parametrization(
3131
ctr += lens[2]
3232

3333
size = nr-2
34-
p = Vector{PolyElem}(undef, size)
34+
p = Vector{PolyRingElem}(undef, size)
3535
k = 1
3636
for i in 3:nr
3737
p[k] = C([unsafe_load(cfs, j+ctr) for j in 1:lens[i]-1])
3838
# multiply parametrization polynomial directly with
3939
# corresponding coefficients
40-
p[k] *= (-1) * fmpz(unsafe_load(cfs, lens[i]+ctr))
40+
p[k] *= (-1) * ZZRingElem(unsafe_load(cfs, lens[i]+ctr))
4141
ctr += lens[i]
4242
k += 1
4343
end
@@ -46,14 +46,14 @@ function _get_rational_parametrization(
4646
end
4747

4848
@doc Markdown.doc"""
49-
_core_msolve(I::Ideal{T} where T <: MPolyElem, <keyword arguments>)
49+
_core_msolve(I::Ideal{T} where T <: MPolyRingElem, <keyword arguments>)
5050
5151
Compute a rational parametrization and the real solutions of the ideal `I` via msolve.
5252
5353
**Note**: This is an internal function.
5454
"""
5555
function _core_msolve(
56-
I::Ideal{T} where T <: MPolyElem; # input generators
56+
I::Ideal{T} where T <: MPolyRingElem; # input generators
5757
initial_hts::Int=17, # hash table size, default 2^17
5858
nr_thrds::Int=1, # number of threads
5959
max_nr_pairs::Int=0, # number of pairs maximally chosen
@@ -131,9 +131,9 @@ function _core_msolve(
131131
nterms = 0
132132

133133
if jl_dquot == 0
134-
C,x = PolynomialRing(QQ,"x")
135-
I.rat_param = RationalParametrization(Symbol[], fmpz[], C(-1), C(-1), PolyElem[])
136-
I.real_sols = fmpq[]
134+
C,x = polynomial_ring(QQ,"x")
135+
I.rat_param = RationalParametrization(Symbol[], ZZRingElem[], C(-1), C(-1), PolyRingElem[])
136+
I.real_sols = QQFieldElem[]
137137
return I.rat_param, I.real_sols
138138
end
139139
[nterms += jl_len[i] for i=1:jl_ld]
@@ -150,8 +150,8 @@ function _core_msolve(
150150
I.rat_param = RationalParametrization(vsymbols, rat_param[1],rat_param[2],
151151
rat_param[3], rat_param[4])
152152
if jl_nb_sols == 0
153-
I.real_sols = fmpq[]
154-
return rat_param, Vector{fmpq}[]
153+
I.real_sols = QQFieldElem[]
154+
return rat_param, Vector{QQFieldElem}[]
155155
end
156156

157157
# get solutions
@@ -164,17 +164,17 @@ function _core_msolve(
164164

165165
#= solutions are returned as intervals, i.e. a minimum and a maximum entry for
166166
= the numerator and denominator; thus we sum up and divide by =#
167-
solutions = Vector{Vector{fmpq}}(undef, jl_nb_sols)
167+
solutions = Vector{Vector{QQFieldElem}}(undef, jl_nb_sols)
168168

169169
len = 2*jl_nb_sols*nr_vars
170170
i = 1
171171
k = 1
172172
while i <= len
173173
j = 1
174-
tmp = Vector{Nemo.fmpq}(undef, nr_vars)
174+
tmp = Vector{Nemo.QQFieldElem}(undef, nr_vars)
175175
while j <= nr_vars
176-
tmp[j] = fmpq(unsafe_load(jl_sols_num, i)) >> Int64(unsafe_load(jl_sols_den, i))
177-
tmp[j] += fmpq(unsafe_load(jl_sols_num, i+1)) >> Int64(unsafe_load(jl_sols_den, i+1))
176+
tmp[j] = QQFieldElem(unsafe_load(jl_sols_num, i)) >> Int64(unsafe_load(jl_sols_den, i))
177+
tmp[j] += QQFieldElem(unsafe_load(jl_sols_num, i+1)) >> Int64(unsafe_load(jl_sols_den, i+1))
178178
tmp[j] = tmp[j] >> 1
179179
i += 2
180180
j += 1
@@ -194,7 +194,7 @@ function _core_msolve(
194194
end
195195

196196
@doc Markdown.doc"""
197-
rational_parametrization(I::Ideal{T} where T <: MPolyElem, <keyword arguments>)
197+
rational_parametrization(I::Ideal{T} where T <: MPolyRingElem, <keyword arguments>)
198198
199199
Given an ideal `I` with a finite solution set over the complex numbers, return
200200
the rational parametrization of the ideal with a given precision (default 32 bits).
@@ -203,7 +203,7 @@ the rational parametrization of the ideal with a given precision (default 32 bit
203203
is greater then zero an empty array is returned.
204204
205205
# Arguments
206-
- `I::Ideal{T} where T <: MPolyElem`: input generators.
206+
- `I::Ideal{T} where T <: MPolyRingElem`: input generators.
207207
- `initial_hts::Int=17`: initial hash table size `log_2`.
208208
- `nr_thrds::Int=1`: number of threads for parallel linear algebra.
209209
- `max_nr_pairs::Int=0`: maximal number of pairs per matrix, only bounded by minimal degree if `0`.
@@ -215,7 +215,7 @@ is greater then zero an empty array is returned.
215215
```jldoctest
216216
julia> using AlgebraicSolving
217217
218-
julia> R,(x1,x2,x3) = PolynomialRing(QQ, ["x1","x2","x3"])
218+
julia> R,(x1,x2,x3) = polynomial_ring(QQ, ["x1","x2","x3"])
219219
(Multivariate polynomial ring in 3 variables over QQ, Nemo.QQMPolyRingElem[x1, x2, x3])
220220
221221
julia> I = Ideal([x1+2*x2+2*x3-1, x1^2+2*x2^2+2*x3^2-x1, 2*x1*x2+2*x2*x3-x2])
@@ -226,7 +226,7 @@ AlgebraicSolving.RationalParametrization([:x1, :x2, :x3], Nemo.ZZRingElem[], 84*
226226
```
227227
"""
228228
function rational_parametrization(
229-
I::Ideal{T} where T <: MPolyElem; # input generators
229+
I::Ideal{T} where T <: MPolyRingElem; # input generators
230230
initial_hts::Int=17, # hash table size, default 2^17
231231
nr_thrds::Int=1, # number of threads
232232
max_nr_pairs::Int=0, # number of pairs maximally chosen
@@ -250,13 +250,13 @@ end
250250

251251

252252
@doc Markdown.doc"""
253-
rational_solutions(I::Ideal{T} where T <: MPolyElem, <keyword arguments>)
253+
rational_solutions(I::Ideal{T} where T <: MPolyRingElem, <keyword arguments>)
254254
255255
Given an ideal `I` with a finite solution set over the complex numbers, return
256256
the rational roots of the ideal.
257257
258258
# Arguments
259-
- `I::Ideal{T} where T <: MPolyElem`: input generators.
259+
- `I::Ideal{T} where T <: MPolyRingElem`: input generators.
260260
- `initial_hts::Int=17`: initial hash table size `log_2`.
261261
- `nr_thrds::Int=1`: number of threads for parallel linear algebra.
262262
- `max_nr_pairs::Int=0`: maximal number of pairs per matrix, only bounded by minimal degree if `0`.
@@ -268,7 +268,7 @@ the rational roots of the ideal.
268268
```jldoctest
269269
julia> using AlgebraicSolving
270270
271-
julia> R,(x1,x2,x3) = PolynomialRing(QQ, ["x1","x2","x3"])
271+
julia> R,(x1,x2,x3) = polynomial_ring(QQ, ["x1","x2","x3"])
272272
(Multivariate polynomial ring in 3 variables over QQ, Nemo.QQMPolyRingElem[x1, x2, x3])
273273
274274
julia> I = Ideal([x1+2*x2+2*x3-1, x1^2+2*x2^2+2*x3^2-x1, 2*x1*x2+2*x2*x3-x2])
@@ -286,7 +286,7 @@ julia> map(r->map(p->evaluate(p, r), I.gens), rat_sols)
286286
```
287287
"""
288288
function rational_solutions(
289-
I::Ideal{T} where T <: MPolyElem; # input generators
289+
I::Ideal{T} where T <: MPolyRingElem; # input generators
290290
initial_hts::Int=17, # hash table size, default 2^17
291291
nr_thrds::Int=1, # number of threads
292292
max_nr_pairs::Int=0, # number of pairs maximally chosen
@@ -313,12 +313,12 @@ function rational_solutions(
313313
rat_den = map(l->evaluate(param_t.denom, l), rat_elim)
314314
rat_num = map(r->map(l->evaluate(l, r), param_t.param), rat_elim)
315315

316-
rat_sols = Vector{Vector{fmpq}}(undef, nb)
316+
rat_sols = Vector{Vector{QQFieldElem}}(undef, nb)
317317

318318
if length(param_t.vars) == parent(I).nvars
319319

320320
for i in 1:nb
321-
rat_sols[i] = Vector{fmpq}(undef, nvars)
321+
rat_sols[i] = Vector{QQFieldElem}(undef, nvars)
322322
for j in 1:(nvars-1)
323323
rat_sols[i][j] = rat_num[i][j] // rat_den[i]
324324
end
@@ -328,7 +328,7 @@ function rational_solutions(
328328
else
329329

330330
for i in 1:nb
331-
rat_sols[i] = Vector{fmpq}(undef, nvars - 1)
331+
rat_sols[i] = Vector{QQFieldElem}(undef, nvars - 1)
332332
for j in 1:(nvars-1)
333333
rat_sols[i][j] = rat_num[i][j] // rat_den[i]
334334
end
@@ -343,7 +343,7 @@ end
343343

344344

345345
@doc Markdown.doc"""
346-
real_solutions(I::Ideal{T} where T <: MPolyElem, <keyword arguments>)
346+
real_solutions(I::Ideal{T} where T <: MPolyRingElem, <keyword arguments>)
347347
348348
Given an ideal `I` with a finite solution set over the complex numbers, return
349349
the real roots of the ideal with a given precision (default 32 bits).
@@ -352,7 +352,7 @@ the real roots of the ideal with a given precision (default 32 bits).
352352
is greater than zero an empty array is returned.
353353
354354
# Arguments
355-
- `I::Ideal{T} where T <: MPolyElem`: input generators.
355+
- `I::Ideal{T} where T <: MPolyRingElem`: input generators.
356356
- `initial_hts::Int=17`: initial hash table size `log_2`.
357357
- `nr_thrds::Int=1`: number of threads for parallel linear algebra.
358358
- `max_nr_pairs::Int=0`: maximal number of pairs per matrix, only bounded by minimal degree if `0`.
@@ -364,7 +364,7 @@ is greater than zero an empty array is returned.
364364
```jldoctest
365365
julia> using AlgebraicSolving
366366
367-
julia> R,(x1,x2,x3) = PolynomialRing(QQ, ["x1","x2","x3"])
367+
julia> R,(x1,x2,x3) = polynomial_ring(QQ, ["x1","x2","x3"])
368368
(Multivariate polynomial ring in 3 variables over QQ, Nemo.QQMPolyRingElem[x1, x2, x3])
369369
370370
julia> I = Ideal([x1+2*x2+2*x3-1, x1^2+2*x2^2+2*x3^2-x1, 2*x1*x2+2*x2*x3-x2])
@@ -379,7 +379,7 @@ julia> real_solutions(I)
379379
```
380380
"""
381381
function real_solutions(
382-
I::Ideal{T} where T <: MPolyElem; # input generators
382+
I::Ideal{T} where T <: MPolyRingElem; # input generators
383383
initial_hts::Int=17, # hash table size, default 2^17
384384
nr_thrds::Int=1, # number of threads
385385
max_nr_pairs::Int=0, # number of pairs maximally chosen

src/examples/katsura.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ Nemo.QQMPolyRingElem[x1 + 2*x2 + 2*x3 - 1, x1^2 + 2*x2^2 + 2*x3^2 - x1, 2*x1*x2
3030
"""
3131
function katsura(log_solutions::Int, characteristic::Int=0)
3232
if characteristic == 0
33-
R, _ = PolynomialRing(QQ, log_solutions + 1, ordering=:degrevlex)
33+
R, _ = polynomial_ring(QQ, log_solutions + 1, ordering=:degrevlex)
3434
elseif is_probable_prime(characteristic)
35-
R, _ = PolynomialRing(GF(characteristic), log_solutions + 1, ordering=:degrevlex)
35+
R, _ = polynomial_ring(GF(characteristic), log_solutions + 1, ordering=:degrevlex)
3636
else
3737
error("We only support finite fields or QQ as ground fields.")
3838
end

src/exports.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export PolynomialRing, MPolyRing, GFElem, MPoly, MPolyElem, FiniteField, GF,
2-
characteristic, degree, ZZ, QQ, vars, nvars, ngens, fmpz, fmpq, fmpq_poly,
1+
export polynomial_ring, MPolyRing, GFElem, MPolyRingElem, finite_field, GF,
2+
characteristic, degree, ZZ, QQ, vars, nvars, ngens, ZZRingElem, QQFieldElem, QQPolyRingElem,
33
base_ring, coefficient_ring, evaluate, prime_field

0 commit comments

Comments
 (0)