Development

Project source

You can get a clone of the GitHub repository with:

git clone https://github.com/sumiya11/Groebner.jl

If you want to browse the repository online, or fork it on GitHub, it can be accessed here:

https://github.com/sumiya11/Groebner.jl

The up-to-date branch in the repository is "master".

Development directions

TBD!

Utilities in Groebner.jl

Internally, Groebner.jl provides utilities for convenient assertion checking, logging, and timings measurment. These are implemented via macros @invariant, @log, and @timeit.

Each utility can be globally enabled/disabled by setting the appropriate switch to true/false. The switches and their default values are:

MacroSwitchDefault value
@invariantinvariants_enabledfalse
@loglogging_enabledtrue
@timeitperformance_counters_enabledfalse

If the switch value is false, then the corresponding macro gets compiled-out, and has no performance impact.

Therefore, for example, if you would like to get the best performance out of Groebner.jl, and do not care about assertions and logging, you can do

using Groebner
Groebner.logging_enabled() = false

Logging

Assuming Groebner.logging_enabled() is true, for printing some logs you can do, for example,

using Groebner, AbstractAlgebra

R, (x,y,z) = GF(2^31-1)["x","y","z"]

# Will print some debug info.
# Use lower loglevel, e.g., loglevel=-5, to print A LOT of info
groebner([x*y + z, x*z + y], loglevel=-2)
3-element Vector{AbstractAlgebra.Generic.MPoly{AbstractAlgebra.GFElem{Int64}}}:
 y^2 + 2147483646*z^2
 x*z + y
 x*y + z

Measuring performance

All functions in the interface have keyword argument statistics. This argument can be set to either of: :no, :timings, and :all.

Use statistics=:timings to print the table with timings and allocations of internal functions of Groebner.jl. You should also set Groebner.performance_counters_enabled() to true to record runtime statistics. For example,

using Groebner, AbstractAlgebra

# Enable performance counters
Groebner.performance_counters_enabled() = true

R, (x,y,z) = GF(2^31-1)["x","y","z"]

groebner([x*y + z, x*z + y], statistics=:timings)
 --------------------------------------------------------------------------------
          Groebner.jl                   Time                    Allocations      
                               -----------------------   ------------------------
       Tot / % measured:           91.4ms /   0.2%           5.90MiB /   7.7%    

 Section               ncalls     time    %tot     avg     alloc    %tot      avg
 --------------------------------------------------------------------------------
 _groebner2                 1    142μs   65.1%   142μs    428KiB   91.5%   428KiB
   f4!                      1   96.1μs   44.1%  96.1μs   35.7KiB    7.6%  35.7KiB
     f4_reduction!          3   27.6μs   12.7%  9.20μs   9.36KiB    2.0%  3.12KiB
       linalg_main!         3   19.2μs    8.8%  6.41μs   6.62KiB    1.4%  2.21KiB
         linalg_int...      3   1.32μs    0.6%   441ns      976B    0.2%     325B
       matrix_fill_...      3   1.81μs    0.8%   605ns      256B    0.1%    85.3B
     f4_update!             4   10.0μs    4.6%  2.49μs   2.80KiB    0.6%     716B
       pairset_update!      5   6.55μs    3.0%  1.31μs   1.28KiB    0.3%     262B
       basis_update!        4    411ns    0.2%   103ns     0.00B    0.0%    0.00B
     matrix_polynom...     14   5.67μs    2.6%   405ns   2.59KiB    0.6%     190B
     f4_symbolic_pr...      4   5.21μs    2.4%  1.30μs   2.28KiB    0.5%     584B
       matrix_polyn...      3    500ns    0.2%   167ns      272B    0.1%    90.7B
     basis_standard...      1   2.03μs    0.9%  2.03μs      528B    0.1%     528B
     hashtable_init...      2   1.58μs    0.7%   792ns   3.97KiB    0.8%  1.98KiB
     linalg_interre...      1   1.26μs    0.6%  1.26μs   1.12KiB    0.2%  1.12KiB
     matrix_fill_co...      1    691ns    0.3%   691ns     96.0B    0.0%    96.0B
   f4_initialize_st...      1   39.0μs   17.9%  39.0μs    389KiB   83.2%   389KiB
   basis_export_data        1    631ns    0.3%   631ns      416B    0.1%     416B
 io_convert_to_inte...      1   47.2μs   21.7%  47.2μs   3.78KiB    0.8%  3.78KiB
 f4_initialize_structs      1   16.4μs    7.5%  16.4μs   29.1KiB    6.2%  29.1KiB
 io_convert_to_output       1   4.68μs    2.1%  4.68μs   1.50KiB    0.3%  1.50KiB
 basis_standardize!         1   1.62μs    0.7%  1.62μs      512B    0.1%     512B
 linalg_interreduce...      1   1.24μs    0.6%  1.24μs      896B    0.2%     896B
 matrix_polynomial_...      3   1.17μs    0.5%   391ns      672B    0.1%     224B
 basis_export_data          1   1.09μs    0.5%  1.09μs      352B    0.1%     352B
 hashtable_initiali...      1    991ns    0.5%   991ns   1.97KiB    0.4%  1.97KiB
 f4_symbolic_prepro...      1    821ns    0.4%   821ns      944B    0.2%     944B
 matrix_fill_column...      1    672ns    0.3%   672ns     80.0B    0.0%    80.0B
 basis_update!              1    120ns    0.1%   120ns     0.00B    0.0%    0.00B
 --------------------------------------------------------------------------------
3-element Vector{AbstractAlgebra.Generic.MPoly{AbstractAlgebra.GFElem{Int64}}}:
 y^2 + 2147483646*z^2
 x*z + y
 x*y + z