1- import msolve_jll: libneogb
1+ import msolve_jll: libneogb, libmsolve
22
33export groebner_basis, eliminate
44
@@ -25,6 +25,7 @@ At the moment the underlying algorithm is based on variants of Faugère's F4 Alg
2525- `la_option::Int=2`: linear algebra option: exact sparse-dense (`1`), exact sparse (`2`, default), probabilistic sparse-dense (`42`), probabilistic sparse(`44`).
2626- `complete_reduction::Bool=true`: compute a reduced Gröbner basis for `I`.
2727- `normalize::Bool=false`: normalize generators of Gröbner basis for `I`, only applicable when working over the rationals.
28+ - `truncate_lifting::Int=0`: truncates the lifting process to given number of elements, only applicable when working over the rationals.
2829- `info_level::Int=0`: info level printout: off (`0`, default), summary (`1`), detailed (`2`).
2930
3031# Examples
@@ -52,6 +53,7 @@ function eliminate(
5253 la_option:: Int = 2 ,
5354 complete_reduction:: Bool = true ,
5455 normalize:: Bool = false ,
56+ truncate_lifting:: Int = 0 ,
5557 info_level:: Int = 0
5658 )
5759 if eliminate <= 0
@@ -62,6 +64,7 @@ function eliminate(
6264 eliminate= eliminate, intersect= intersect,
6365 complete_reduction= complete_reduction,
6466 normalize = normalize,
67+ truncate_lifting = truncate_lifting,
6568 info_level= info_level)
6669 end
6770end
@@ -84,6 +87,7 @@ At the moment the underlying algorithm is based on variants of Faugère's F4 Alg
8487- `intersect::Bool=true`: compute the `eliminate`-th elimination ideal.
8588- `complete_reduction::Bool=true`: compute a reduced Gröbner basis for `I`.
8689- `normalize::Bool=false`: normalize generators of Gröbner basis for `I`, only applicable when working over the rationals.
90+ - `truncate_lifting::Int=0`: truncates the lifting process to given number of elements, only applicable when working over the rationals.
8791- `info_level::Int=0`: info level printout: off (`0`, default), summary (`1`), detailed (`2`).
8892
8993# Examples
@@ -118,6 +122,7 @@ function groebner_basis(
118122 intersect:: Bool = true ,
119123 complete_reduction:: Bool = true ,
120124 normalize:: Bool = false ,
125+ truncate_lifting:: Int = 0 ,
121126 info_level:: Int = 0
122127 )
123128
@@ -127,6 +132,7 @@ function groebner_basis(
127132 eliminate = eliminate, intersect = intersect,
128133 complete_reduction = complete_reduction,
129134 normalize = normalize,
135+ truncate_lifting = truncate_lifting,
130136 info_level = info_level)
131137 end
132138end
@@ -141,6 +147,7 @@ function _core_groebner_basis(
141147 intersect:: Bool = true ,
142148 complete_reduction:: Bool = true ,
143149 normalize:: Bool = false ,
150+ truncate_lifting:: Int = 0 ,
144151 info_level:: Int = 0
145152 )
146153
@@ -155,6 +162,9 @@ function _core_groebner_basis(
155162
156163 mon_order = 0
157164 elim_block_size = eliminate
165+ if elim_block_size >= nr_vars
166+ error (" Number of variables to be eliminated is bigger than number of variables in ring." )
167+ end
158168 reduce_gb = Int (complete_reduction)
159169
160170 # convert ideal to flattened arrays of ints
@@ -183,7 +193,7 @@ rr = Libdl.dlsym(msv, :export_groebner_qq)
183193 Cint, Cint, Cint, Cint, Cint, Cint, Cint, Cint),
184194 cglobal (:jl_malloc ), gb_ld, gb_len, gb_exp, gb_cf, lens, exps, cfs,
185195 field_char, mon_order, elim_block_size, nr_vars, nr_gens, initial_hts,
186- nr_thrds, max_nr_pairs, 0 , la_option, reduce_gb, 0 , 0 , info_level)
196+ nr_thrds, max_nr_pairs, 0 , la_option, reduce_gb, 0 , truncate_lifting , info_level)
187197
188198 else
189199 nr_terms = ccall ((:export_f4 , libneogb), Int,
0 commit comments