Skip to content

Commit

Permalink
Trac #31664: Add package msolve 0.4.4 (multivariate polynomial system…
Browse files Browse the repository at this point in the history
… solver)

https://msolve.lip6.fr/index.html

Upstream issues/PRs:
- algebraic-solving/msolve#2
- algebraic-solving/msolve#3

URL: https://trac.sagemath.org/31664
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Marc Mezzarobba
  • Loading branch information
Release Manager committed Sep 25, 2022
2 parents 4541564 + fa77041 commit a802d07
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 12 deletions.
21 changes: 21 additions & 0 deletions build/pkgs/msolve/SPKG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
msolve: Multivariate polynomial system solver
=============================================

Description
-----------

Open source C library implementing computer algebra algorithms for solving
polynomial systems (with rational coefficients or coefficients in a prime field).

License
-------

GPL v2+

Upstream Contact
----------------

https://github.com/algebraic-solving/msolve

Upstream does not make source tarballs.
We make tarballs from the fork https://github.com/mkoeppe/msolve (branch 0.4.4+sage)
5 changes: 5 additions & 0 deletions build/pkgs/msolve/checksums.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tarball=msolve-VERSION.tar.gz
sha1=5b227de8b222bfe8d143e1d7ea77ad71cd209dc8
md5=2f34bd9ccb089688ae169201281108dc
cksum=941373315
upstream_url=https://trac.sagemath.org/raw-attachment/ticket/31664/msolve-VERSION.tar.gz
4 changes: 4 additions & 0 deletions build/pkgs/msolve/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$(MP_LIBRARY) flint mpfr

----------
All lines of this file are ignored except the first.
1 change: 1 addition & 0 deletions build/pkgs/msolve/package-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.4.4+sage-2022-09-11
4 changes: 4 additions & 0 deletions build/pkgs/msolve/spkg-install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cd src
sdh_configure
sdh_make
sdh_make_install
1 change: 1 addition & 0 deletions build/pkgs/msolve/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
optional
6 changes: 2 additions & 4 deletions src/sage/rings/polynomial/msolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
This module provide implementations of some operations on polynomial ideals
based on msolve.
Note that msolve must be installed separately.
Note that the `optional package msolve <../spkg/msolve.html>`_ must be installed.
.. SEEALSO::
Expand Down Expand Up @@ -46,13 +46,11 @@ def _run_msolve(ideal, options):

# Run msolve

msolve().require()

drlpolring = ideal.ring().change_ring(order='degrevlex')
polys = ideal.change_ring(drlpolring).gens()
msolve_in = tempfile.NamedTemporaryFile(mode='w',
encoding='ascii', delete=False)
command = ["msolve", "-f", msolve_in.name] + options
command = [msolve().absolute_filename(), "-f", msolve_in.name] + options
try:
print(",".join(drlpolring.variable_names()), file=msolve_in)
print(base.characteristic(), file=msolve_in)
Expand Down
16 changes: 8 additions & 8 deletions src/sage/rings/polynomial/multi_polynomial_ideal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2467,7 +2467,8 @@ def variety(self, ring=None, *, algorithm="triangular_decomposition", proof=True
{y: 0.3611030805286474?, x: 2.769292354238632?},
{y: 1, x: 1}]
We can also use the external program msolve to compute the variety.
We can also use the `optional package msolve <../spkg/msolve.html>`_
to compute the variety.
See :mod:`~sage.rings.polynomial.msolve` for more information. ::
sage: I.variety(RBF, algorithm='msolve', proof=False) # optional - msolve
Expand Down Expand Up @@ -2543,9 +2544,9 @@ def variety(self, ring=None, *, algorithm="triangular_decomposition", proof=True
uses triangular decomposition, via Singular if possible, falling back
on a toy implementation otherwise.
- With ``algorithm`` = ``"msolve"``, calls the external program
`msolve <https://msolve.lip6.fr/>`_ (if available in the system
program search path). Note that msolve uses heuristics and therefore
- With ``algorithm`` = ``"msolve"``, uses the
`optional package msolve <../spkg/msolve.html>`_.
Note that msolve uses heuristics and therefore
requires setting the ``proof`` flag to ``False``. See
:mod:`~sage.rings.polynomial.msolve` for more information.
"""
Expand Down Expand Up @@ -4089,7 +4090,7 @@ def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, prot=Fal
Macaulay2's ``GroebnerBasis`` command with the strategy "MGB" (if available)
'msolve'
`msolve <https://msolve.lip6.fr/>`_ (if available, degrevlex order,
`optional package msolve <../spkg/msolve.html>`_ (degrevlex order,
prime fields)
'magma:GroebnerBasis'
Expand Down Expand Up @@ -4215,9 +4216,8 @@ def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, prot=Fal
sage: I.groebner_basis('macaulay2:mgb') # optional - macaulay2
[c^3 + 28*c^2 - 37*b + 13*c, b^2 - 41*c^2 + 20*b - 20*c, b*c - 19*c^2 + 10*b + 40*c, a + 2*b + 2*c - 1]
Over prime fields of small characteristic, we can also use
`msolve <https://msolve.lip6.fr/>`_ (if available in the system program
search path)::
Over prime fields of small characteristic, we can also use the
`optional package msolve <../spkg/msolve.html>`_::
sage: R.<a,b,c> = PolynomialRing(GF(101), 3)
sage: I = sage.rings.ideal.Katsura(R,3) # regenerate to prevent caching
Expand Down

0 comments on commit a802d07

Please sign in to comment.