1
1
using Oscar
2
2
3
- global infoLevel = 1
3
+ global infoLevel = 0
4
4
5
5
# ##############################################################
6
6
# Implementation of different variants of the Groebner Walk.
7
7
# The Groebner Walk is proposed by Collart, Kalkbrener & Mall (1997).
8
8
# ##############################################################
9
9
@doc raw """
10
10
groebnerwalk(
11
- I::MPolyIdeal; ordering::MonomialOrdering = default_ordering(base_ring(I)),
12
- startOrder::Symbol = :degrevlex ,
13
- targetOrder::Symbol = : lex,
11
+ I::MPolyIdeal;
12
+ startOrder::MonomialOrdering = default_ordering(base_ring(I)) ,
13
+ targetOrder::Symbol = lex(base_ring(I)) ,
14
14
walktype::Symbol = :standard,
15
15
perturbationDegree::Int = 2,
16
16
)
@@ -25,7 +25,7 @@ Fractal Walk (:fractalcombined) computes the Walk like it´s presented in Amrhei
25
25
Fractal Walk (:fractal) computes the Walk like it´s presented in Amrhein & Gloor (1998). Pertubes only the target vector.
26
26
Set infoLevel to trace the walk:
27
27
-'infoLevel=0': no detailed printout,
28
- -'infoLevel=1': intermediate weight vectors,
28
+ -'infoLevel=1': adds intermediate weight vectors,
29
29
-'infoLevel=2': adds information about the Groebner basis.
30
30
31
31
#Arguments
@@ -40,10 +40,48 @@ Set infoLevel to trace the walk:
40
40
- `fractal`: standard-version of the Fractal Walk,
41
41
- `fractalcombined`: combined Version of the Fractal Walk. Target monomial order needs to be lex,
42
42
- `perturbationDegree::Int=2`: perturbationdegree for the perturbed Walk.
43
+
44
+
45
+ # Examples
46
+
47
+ ```jldoctest
48
+ julia> R,(x,y) = polynomial_ring(QQ, ["x","y"], ordering = :degrevlex);
49
+
50
+ julia> I = ideal([y^4+ x^3-x^2+x,x^4]);
51
+
52
+ julia> groebnerwalk(I, degrevlex(R), lex(R), :standard)
53
+ standard_walk results
54
+ Crossed Cones in:
55
+ [4, 3]
56
+ [4, 1]
57
+ [12, 1]
58
+ [1, 0]
59
+ Cones crossed: 4
60
+ Gröbner basis with elements
61
+ 1 -> y^16
62
+ 2 -> x + y^12 - y^8 + y^4
63
+ with respect to the ordering
64
+ matrix_ordering([x, y], [1 0; 0 1])
65
+
66
+ julia> groebnerwalk(I, degrevlex(R), lex(R), :perturbed, 2)
67
+ perturbed_walk results
68
+ Crossed Cones in:
69
+ [4, 3]
70
+ [4, 1]
71
+ [5, 1]
72
+ [12, 1]
73
+ [1, 0]
74
+ Cones crossed: 5
75
+ Gröbner basis with elements
76
+ 1 -> y^16
77
+ 2 -> x + y^12 - y^8 + y^4
78
+ with respect to the ordering
79
+ matrix_ordering([x, y], [1 0; 0 1])
80
+ ```
43
81
"""
44
82
function groebnerwalk (
45
83
I:: MPolyIdeal , startOrder:: MonomialOrdering = default_ordering (base_ring (I)),
46
- targetOrder:: MonomialOrdering = : lex ,
84
+ targetOrder:: MonomialOrdering = lex ( base_ring (I)) ,
47
85
walktype:: Symbol = :standard ,
48
86
perturbationDegree:: Int = 2 )
49
87
S = canonical_matrix (startOrder)
@@ -74,7 +112,7 @@ Fractal Walk (:fractal) computes the Walk like it´s presented in Amrhein & Gloo
74
112
Fractal Walk (:fractalcombined) computes the Walk like it´s presented in Amrhein & Gloor (1998) with multiple extensions. The target monomial order has to be lex. This version uses the Buchberger Algorithm to skip weightvectors with entries bigger than Int32.
75
113
Set infoLevel to trace the walk:
76
114
-'infoLevel=0': no detailed printout,
77
- -'infoLevel=1': intermediate weight vectors,
115
+ -'infoLevel=1': adds intermediate weight vectors,
78
116
-'infoLevel=2': adds information about the Groebner basis.
79
117
80
118
#Arguments
@@ -89,6 +127,43 @@ Set infoLevel to trace the walk:
89
127
- `fractal`: standard-version of the Fractal Walk,
90
128
- `fractalcombined`: combined version of the Fractal Walk. The target monomial order needs to be lex,
91
129
-`p::Int=2`: perturbationdegree for the perturbed Walk.
130
+
131
+ # Examples
132
+
133
+ ```jldoctest
134
+ julia> R,(x,y) = polynomial_ring(QQ, ["x","y"], ordering = :degrevlex);
135
+
136
+ julia> I = ideal([y^4+ x^3-x^2+x,x^4]);
137
+
138
+ julia> groebnerwalk(I, [1 1; 0 -1], [1 0; 0 1], :standard)
139
+ standard_walk results
140
+ Crossed Cones in:
141
+ [4, 3]
142
+ [4, 1]
143
+ [12, 1]
144
+ [1, 0]
145
+ Cones crossed: 4
146
+ Gröbner basis with elements
147
+ 1 -> y^16
148
+ 2 -> x + y^12 - y^8 + y^4
149
+ with respect to the ordering
150
+ matrix_ordering([x, y], [1 0; 0 1])
151
+
152
+ julia> groebnerwalk(I, [1 1; 0 -1], [1 0; 0 1], :perturbed, 2)
153
+ perturbed_walk results
154
+ Crossed Cones in:
155
+ [4, 3]
156
+ [4, 1]
157
+ [5, 1]
158
+ [12, 1]
159
+ [1, 0]
160
+ Cones crossed: 5
161
+ Gröbner basis with elements
162
+ 1 -> y^16
163
+ 2 -> x + y^12 - y^8 + y^4
164
+ with respect to the ordering
165
+ matrix_ordering([x, y], [1 0; 0 1])
166
+ ```
92
167
"""
93
168
function groebnerwalk (
94
169
G:: Union{Oscar.IdealGens, MPolyIdeal} ,
@@ -174,18 +249,18 @@ function standard_walk(
174
249
tarweight:: Vector{Int} )
175
250
while true
176
251
G = standard_step (G, currweight, T)
252
+ if currweight == tarweight
253
+ return G
254
+ else
255
+ currweight = next_weight (G, currweight, tarweight)
256
+ end
177
257
if infoLevel >= 1
258
+ raise_step_counter ()
178
259
println (currweight)
179
260
if infoLevel == 2
180
261
println (G)
181
262
end
182
263
end
183
- raise_step_counter ()
184
- if currweight == tarweight
185
- return G
186
- else
187
- currweight = next_weight (G, currweight, tarweight)
188
- end
189
264
end
190
265
end
191
266
@@ -227,7 +302,7 @@ function generic_walk(
227
302
ordNew = matrix_ordering (base_ring (G), T)
228
303
if infoLevel >= 1
229
304
println (" generic_walk results" )
230
- println (" Crossed Cones with : " )
305
+ println (" Facets crossed for : " )
231
306
end
232
307
while ! isempty (v)
233
308
G, Lm = generic_step (G, Lm, v, ordNew)
0 commit comments