passagemath-msolve 10.6.47__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ graft passagemath_msolve
2
+
3
+ prune sage
4
+
5
+ include VERSION.txt
6
+
7
+ include sage/libs/msolve.p*
8
+ include sage/rings/polynomial/msolve.p*
9
+
10
+ global-exclude *.c
11
+ global-exclude *.cpp
12
+
13
+ global-exclude all__sagemath_*.py
14
+ global-include all__sagemath_msolve.py
15
+
16
+ include repair_wheel.py
17
+
18
+ global-exclude __pycache__
19
+ global-exclude *.py[co]
20
+ global-exclude *.bak
21
+ global-exclude *.so
22
+ global-exclude *~
23
+ prune .tox
24
+ prune build
25
+ prune dist
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: passagemath-msolve
3
+ Version: 10.6.47
4
+ Summary: passagemath: Polynomial system solving through algebraic methods with msolve
5
+ Author-email: The Sage Developers <sage-support@googlegroups.com>
6
+ Maintainer: Matthias Köppe, passagemath contributors
7
+ License-Expression: GPL-2.0-or-later
8
+ Project-URL: release notes, https://github.com/passagemath/passagemath/releases
9
+ Project-URL: repo (upstream), https://github.com/sagemath/sage
10
+ Project-URL: repo, https://github.com/passagemath/passagemath
11
+ Project-URL: documentation, https://passagemath.org/docs/latest
12
+ Project-URL: homepage (upstream), https://www.sagemath.org
13
+ Project-URL: discourse, https://passagemath.discourse.group
14
+ Project-URL: tracker (upstream), https://github.com/sagemath/sage/issues
15
+ Project-URL: tracker, https://github.com/passagemath/passagemath/issues
16
+ Classifier: Development Status :: 6 - Mature
17
+ Classifier: Intended Audience :: Education
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Operating System :: POSIX
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Programming Language :: Python :: Implementation :: CPython
29
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
30
+ Requires-Python: <3.15,>=3.10
31
+ Description-Content-Type: text/x-rst
32
+ Requires-Dist: cysignals!=1.12.4; sys_platform == "win32"
33
+ Requires-Dist: cysignals!=1.12.0,>=1.11.2
34
+ Requires-Dist: passagemath-categories~=10.6.47.0
35
+ Requires-Dist: passagemath-flint~=10.6.47.0
36
+ Requires-Dist: passagemath-modules~=10.6.47.0
37
+ Requires-Dist: passagemath-repl~=10.6.47.0
38
+ Provides-Extra: test
39
+
40
+ ============================================================================
41
+ passagemath: Polynomial system solving through algebraic methods with msolve
42
+ ============================================================================
43
+
44
+ `passagemath <https://github.com/passagemath/passagemath>`__ is open
45
+ source mathematical software in Python, released under the GNU General
46
+ Public Licence GPLv2+.
47
+
48
+ It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
49
+ developed 2005-2025 under the motto “Creating a Viable Open Source
50
+ Alternative to Magma, Maple, Mathematica, and MATLAB”.
51
+
52
+ The passagemath fork uses the motto "Creating a Free Passage Between the
53
+ Scientific Python Ecosystem and Mathematical Software Communities."
54
+ It was created in October 2024 with the following goals:
55
+
56
+ - providing modularized installation with pip,
57
+ - establishing first-class membership in the scientific Python
58
+ ecosystem,
59
+ - giving `clear attribution of upstream
60
+ projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
61
+ - providing independently usable Python interfaces to upstream
62
+ libraries,
63
+ - offering `platform portability and integration testing
64
+ services <https://github.com/passagemath/passagemath/issues/704>`__
65
+ to upstream projects,
66
+ - inviting collaborations with upstream projects,
67
+ - `building a professional, respectful, inclusive
68
+ community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
69
+ - `empowering Sage users to participate in the scientific Python ecosystem
70
+ <https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
71
+ - developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
72
+ serverless deployment with Javascript,
73
+ - developing a native Windows port.
74
+
75
+ `Full documentation <https://passagemath.org/docs/latest/html/en/index.html>`__ is
76
+ available online.
77
+
78
+ passagemath attempts to support and provides binary wheels suitable for
79
+ all major Linux distributions and recent versions of macOS.
80
+
81
+ Binary wheels for native Windows (x86_64) are are available for a subset of
82
+ the passagemath distributions. Use of the full functionality of passagemath
83
+ on Windows currently requires the use of Windows Subsystem for Linux (WSL)
84
+ or virtualization.
85
+
86
+ The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.14.x.
87
+
88
+
89
+ About this pip-installable distribution package
90
+ -----------------------------------------------
91
+
92
+ This pip-installable distribution ``passagemath-msolve`` provides an interface to `msolve <https://msolve.lip6.fr/>`_, which implements computer algebra algorithms for solving polynomial systems (with rational coefficients or coefficients in a prime field).
93
+
94
+
95
+ Examples
96
+ --------
97
+
98
+ A quick way to try it out interactively::
99
+
100
+ $ pipx run --pip-args="--prefer-binary" --spec "passagemath-msolve[test]" ipython
101
+
102
+ In [1]: from passagemath_msolve import *
103
+
104
+ In [2]: R = PolynomialRing(QQ, 2, names=['x', 'y'], order='lex')
105
+
106
+ In [3]: x, y = R.gens()
107
+
108
+ In [4]: I = Ideal([ x*y - 1, (x-2)**2 + (y-1)**2 - 1])
109
+
110
+ In [5]: I.variety(RBF, algorithm='msolve', proof=False)
111
+ Out[5]:
112
+ [{x: [2.76929235423863 +/- 2.08e-15], y: [0.361103080528647 +/- 4.53e-16]},
113
+ {x: 1.000000000000000, y: 1.000000000000000}]
@@ -0,0 +1,74 @@
1
+ ============================================================================
2
+ passagemath: Polynomial system solving through algebraic methods with msolve
3
+ ============================================================================
4
+
5
+ `passagemath <https://github.com/passagemath/passagemath>`__ is open
6
+ source mathematical software in Python, released under the GNU General
7
+ Public Licence GPLv2+.
8
+
9
+ It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
10
+ developed 2005-2025 under the motto “Creating a Viable Open Source
11
+ Alternative to Magma, Maple, Mathematica, and MATLAB”.
12
+
13
+ The passagemath fork uses the motto "Creating a Free Passage Between the
14
+ Scientific Python Ecosystem and Mathematical Software Communities."
15
+ It was created in October 2024 with the following goals:
16
+
17
+ - providing modularized installation with pip,
18
+ - establishing first-class membership in the scientific Python
19
+ ecosystem,
20
+ - giving `clear attribution of upstream
21
+ projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
22
+ - providing independently usable Python interfaces to upstream
23
+ libraries,
24
+ - offering `platform portability and integration testing
25
+ services <https://github.com/passagemath/passagemath/issues/704>`__
26
+ to upstream projects,
27
+ - inviting collaborations with upstream projects,
28
+ - `building a professional, respectful, inclusive
29
+ community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
30
+ - `empowering Sage users to participate in the scientific Python ecosystem
31
+ <https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
32
+ - developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
33
+ serverless deployment with Javascript,
34
+ - developing a native Windows port.
35
+
36
+ `Full documentation <https://passagemath.org/docs/latest/html/en/index.html>`__ is
37
+ available online.
38
+
39
+ passagemath attempts to support and provides binary wheels suitable for
40
+ all major Linux distributions and recent versions of macOS.
41
+
42
+ Binary wheels for native Windows (x86_64) are are available for a subset of
43
+ the passagemath distributions. Use of the full functionality of passagemath
44
+ on Windows currently requires the use of Windows Subsystem for Linux (WSL)
45
+ or virtualization.
46
+
47
+ The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.14.x.
48
+
49
+
50
+ About this pip-installable distribution package
51
+ -----------------------------------------------
52
+
53
+ This pip-installable distribution ``passagemath-msolve`` provides an interface to `msolve <https://msolve.lip6.fr/>`_, which implements computer algebra algorithms for solving polynomial systems (with rational coefficients or coefficients in a prime field).
54
+
55
+
56
+ Examples
57
+ --------
58
+
59
+ A quick way to try it out interactively::
60
+
61
+ $ pipx run --pip-args="--prefer-binary" --spec "passagemath-msolve[test]" ipython
62
+
63
+ In [1]: from passagemath_msolve import *
64
+
65
+ In [2]: R = PolynomialRing(QQ, 2, names=['x', 'y'], order='lex')
66
+
67
+ In [3]: x, y = R.gens()
68
+
69
+ In [4]: I = Ideal([ x*y - 1, (x-2)**2 + (y-1)**2 - 1])
70
+
71
+ In [5]: I.variety(RBF, algorithm='msolve', proof=False)
72
+ Out[5]:
73
+ [{x: [2.76929235423863 +/- 2.08e-15], y: [0.361103080528647 +/- 4.53e-16]},
74
+ {x: 1.000000000000000, y: 1.000000000000000}]
@@ -0,0 +1 @@
1
+ 10.6.47
@@ -0,0 +1,3 @@
1
+ # sage_setup: distribution = sagemath-msolve
2
+
3
+ from sage.all__sagemath_msolve import *
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: passagemath-msolve
3
+ Version: 10.6.47
4
+ Summary: passagemath: Polynomial system solving through algebraic methods with msolve
5
+ Author-email: The Sage Developers <sage-support@googlegroups.com>
6
+ Maintainer: Matthias Köppe, passagemath contributors
7
+ License-Expression: GPL-2.0-or-later
8
+ Project-URL: release notes, https://github.com/passagemath/passagemath/releases
9
+ Project-URL: repo (upstream), https://github.com/sagemath/sage
10
+ Project-URL: repo, https://github.com/passagemath/passagemath
11
+ Project-URL: documentation, https://passagemath.org/docs/latest
12
+ Project-URL: homepage (upstream), https://www.sagemath.org
13
+ Project-URL: discourse, https://passagemath.discourse.group
14
+ Project-URL: tracker (upstream), https://github.com/sagemath/sage/issues
15
+ Project-URL: tracker, https://github.com/passagemath/passagemath/issues
16
+ Classifier: Development Status :: 6 - Mature
17
+ Classifier: Intended Audience :: Education
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Operating System :: POSIX
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Programming Language :: Python :: 3.14
28
+ Classifier: Programming Language :: Python :: Implementation :: CPython
29
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
30
+ Requires-Python: <3.15,>=3.10
31
+ Description-Content-Type: text/x-rst
32
+ Requires-Dist: cysignals!=1.12.4; sys_platform == "win32"
33
+ Requires-Dist: cysignals!=1.12.0,>=1.11.2
34
+ Requires-Dist: passagemath-categories~=10.6.47.0
35
+ Requires-Dist: passagemath-flint~=10.6.47.0
36
+ Requires-Dist: passagemath-modules~=10.6.47.0
37
+ Requires-Dist: passagemath-repl~=10.6.47.0
38
+ Provides-Extra: test
39
+
40
+ ============================================================================
41
+ passagemath: Polynomial system solving through algebraic methods with msolve
42
+ ============================================================================
43
+
44
+ `passagemath <https://github.com/passagemath/passagemath>`__ is open
45
+ source mathematical software in Python, released under the GNU General
46
+ Public Licence GPLv2+.
47
+
48
+ It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
49
+ developed 2005-2025 under the motto “Creating a Viable Open Source
50
+ Alternative to Magma, Maple, Mathematica, and MATLAB”.
51
+
52
+ The passagemath fork uses the motto "Creating a Free Passage Between the
53
+ Scientific Python Ecosystem and Mathematical Software Communities."
54
+ It was created in October 2024 with the following goals:
55
+
56
+ - providing modularized installation with pip,
57
+ - establishing first-class membership in the scientific Python
58
+ ecosystem,
59
+ - giving `clear attribution of upstream
60
+ projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
61
+ - providing independently usable Python interfaces to upstream
62
+ libraries,
63
+ - offering `platform portability and integration testing
64
+ services <https://github.com/passagemath/passagemath/issues/704>`__
65
+ to upstream projects,
66
+ - inviting collaborations with upstream projects,
67
+ - `building a professional, respectful, inclusive
68
+ community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
69
+ - `empowering Sage users to participate in the scientific Python ecosystem
70
+ <https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
71
+ - developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
72
+ serverless deployment with Javascript,
73
+ - developing a native Windows port.
74
+
75
+ `Full documentation <https://passagemath.org/docs/latest/html/en/index.html>`__ is
76
+ available online.
77
+
78
+ passagemath attempts to support and provides binary wheels suitable for
79
+ all major Linux distributions and recent versions of macOS.
80
+
81
+ Binary wheels for native Windows (x86_64) are are available for a subset of
82
+ the passagemath distributions. Use of the full functionality of passagemath
83
+ on Windows currently requires the use of Windows Subsystem for Linux (WSL)
84
+ or virtualization.
85
+
86
+ The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.14.x.
87
+
88
+
89
+ About this pip-installable distribution package
90
+ -----------------------------------------------
91
+
92
+ This pip-installable distribution ``passagemath-msolve`` provides an interface to `msolve <https://msolve.lip6.fr/>`_, which implements computer algebra algorithms for solving polynomial systems (with rational coefficients or coefficients in a prime field).
93
+
94
+
95
+ Examples
96
+ --------
97
+
98
+ A quick way to try it out interactively::
99
+
100
+ $ pipx run --pip-args="--prefer-binary" --spec "passagemath-msolve[test]" ipython
101
+
102
+ In [1]: from passagemath_msolve import *
103
+
104
+ In [2]: R = PolynomialRing(QQ, 2, names=['x', 'y'], order='lex')
105
+
106
+ In [3]: x, y = R.gens()
107
+
108
+ In [4]: I = Ideal([ x*y - 1, (x-2)**2 + (y-1)**2 - 1])
109
+
110
+ In [5]: I.variety(RBF, algorithm='msolve', proof=False)
111
+ Out[5]:
112
+ [{x: [2.76929235423863 +/- 2.08e-15], y: [0.361103080528647 +/- 4.53e-16]},
113
+ {x: 1.000000000000000, y: 1.000000000000000}]
@@ -0,0 +1,18 @@
1
+ MANIFEST.in
2
+ README.rst
3
+ VERSION.txt
4
+ pyproject.toml
5
+ repair_wheel.py
6
+ setup.py
7
+ passagemath_msolve/__init__.py
8
+ passagemath_msolve.egg-info/PKG-INFO
9
+ passagemath_msolve.egg-info/SOURCES.txt
10
+ passagemath_msolve.egg-info/dependency_links.txt
11
+ passagemath_msolve.egg-info/requires.txt
12
+ passagemath_msolve.egg-info/top_level.txt
13
+ sage/all__sagemath_msolve.py
14
+ sage/libs/all__sagemath_msolve.py
15
+ sage/libs/msolve.pyx
16
+ sage/rings/all__sagemath_msolve.py
17
+ sage/rings/polynomial/all__sagemath_msolve.py
18
+ sage/rings/polynomial/msolve.py
@@ -0,0 +1,10 @@
1
+ cysignals!=1.12.0,>=1.11.2
2
+ passagemath-categories~=10.6.47.0
3
+ passagemath-flint~=10.6.47.0
4
+ passagemath-modules~=10.6.47.0
5
+ passagemath-repl~=10.6.47.0
6
+
7
+ [:sys_platform == "win32"]
8
+ cysignals!=1.12.4
9
+
10
+ [test]
@@ -0,0 +1,101 @@
1
+ [build-system]
2
+ # Minimum requirements for the build system to execute.
3
+ requires = [
4
+ 'setuptools >= 77.0.0',
5
+ 'pkgconfig',
6
+ 'passagemath-conf ~= 10.6.47.0 ; sys_platform != "win32"',
7
+ 'passagemath-setup ~= 10.6.47.0',
8
+ 'passagemath-categories ~= 10.6.47.0',
9
+ 'passagemath-environment ~= 10.6.47.0',
10
+ 'passagemath-objects ~= 10.6.47.0',
11
+ 'cython >=3.0.8, <3.3.0', 'cython >=3.0.8,<3.3.0',
12
+ 'cysignals !=1.12.4; sys_platform == "win32"', 'cysignals >=1.11.2, != 1.12.0',
13
+ ]
14
+ build-backend = "setuptools.build_meta"
15
+
16
+ [project]
17
+ name = "passagemath-msolve"
18
+ description = "passagemath: Polynomial system solving through algebraic methods with msolve"
19
+ dependencies = [
20
+ 'cysignals !=1.12.4; sys_platform == "win32"', 'cysignals >=1.11.2, != 1.12.0',
21
+ 'passagemath-categories ~= 10.6.47.0',
22
+ 'passagemath-flint ~= 10.6.47.0', 'passagemath-modules ~= 10.6.47.0', 'passagemath-repl ~= 10.6.47.0', ]
23
+ dynamic = ["version"]
24
+ license = "GPL-2.0-or-later"
25
+ authors = [{name = "The Sage Developers", email = "sage-support@googlegroups.com"}]
26
+ maintainers = [
27
+ {name = "Matthias Köppe"},
28
+ {name = "passagemath contributors"},
29
+ ]
30
+ classifiers = [
31
+ "Development Status :: 6 - Mature",
32
+ "Intended Audience :: Education",
33
+ "Intended Audience :: Science/Research",
34
+ "Operating System :: POSIX",
35
+ "Operating System :: POSIX :: Linux",
36
+ "Operating System :: MacOS :: MacOS X",
37
+ "Programming Language :: Python :: 3 :: Only",
38
+ "Programming Language :: Python :: 3.10",
39
+ "Programming Language :: Python :: 3.11",
40
+ "Programming Language :: Python :: 3.12",
41
+ "Programming Language :: Python :: 3.13",
42
+ "Programming Language :: Python :: 3.14",
43
+ "Programming Language :: Python :: Implementation :: CPython",
44
+ "Topic :: Scientific/Engineering :: Mathematics",
45
+ ]
46
+ requires-python = ">=3.10, <3.15"
47
+
48
+ [project.urls]
49
+ "release notes" = "https://github.com/passagemath/passagemath/releases"
50
+ "repo (upstream)" = "https://github.com/sagemath/sage"
51
+ "repo" = "https://github.com/passagemath/passagemath"
52
+ documentation = "https://passagemath.org/docs/latest"
53
+ "homepage (upstream)" = "https://www.sagemath.org"
54
+ "discourse" = "https://passagemath.discourse.group"
55
+ "tracker (upstream)" = "https://github.com/sagemath/sage/issues"
56
+ "tracker" = "https://github.com/passagemath/passagemath/issues"
57
+
58
+ [project.readme]
59
+ file = "README.rst"
60
+ content-type = "text/x-rst"
61
+
62
+ [project.optional-dependencies]
63
+ test = [
64
+ ]
65
+
66
+ [tool.cibuildwheel.linux]
67
+ repair-wheel-command = [
68
+ 'python3 -m pip install passagemath-conf auditwheel',
69
+ 'python3 {package}/repair_wheel.py {wheel}',
70
+ 'auditwheel repair -w {dest_dir} {wheel}',
71
+ ]
72
+ [tool.cibuildwheel.macos]
73
+ repair-wheel-command = [
74
+ 'python3 -m pip install passagemath-conf auditwheel',
75
+ 'python3 {package}/repair_wheel.py {wheel}',
76
+ 'delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}',
77
+ ]
78
+
79
+ [tool.setuptools]
80
+ include-package-data = false
81
+
82
+ [tool.setuptools.dynamic]
83
+ version = {file = ["VERSION.txt"]}
84
+
85
+ [external]
86
+ # External dependencies in the format proposed by https://peps.python.org/pep-0725
87
+ build-requires = [
88
+ "virtual:compiler/c",
89
+ "virtual:compiler/cpp",
90
+ "pkg:generic/pkg-config",
91
+ ]
92
+
93
+ host-requires = [
94
+ "pkg:generic/msolve",
95
+ "pkg:generic/gmp",
96
+ "pkg:generic/mpc",
97
+ "pkg:generic/mpfr",
98
+ ]
99
+
100
+ dependencies = [
101
+ ]
@@ -0,0 +1,24 @@
1
+ # Add data to the wheel
2
+
3
+ import os
4
+ import shlex
5
+ import sys
6
+
7
+ from pathlib import Path
8
+
9
+ from auditwheel.wheeltools import InWheel
10
+
11
+ from sage_conf import SAGE_LOCAL
12
+
13
+ if "TMPDIR" in os.environ:
14
+ os.environ["TMPDIR"] = str(Path(os.environ["TMPDIR"]).resolve())
15
+
16
+ wheel = Path(sys.argv[1])
17
+
18
+ # SAGE_LOCAL/bin/msolve --> sage_wheels/bin/msolve
19
+ with InWheel(wheel, wheel):
20
+ command = f'set -o pipefail; (cd {shlex.quote(SAGE_LOCAL)} && tar cf - --dereference bin/msolve) | (mkdir -p sage_wheels && cd sage_wheels && tar xvf -)'
21
+ print(f'Running {command}')
22
+ sys.stdout.flush()
23
+ if os.system(f"bash -c {shlex.quote(command)}") != 0:
24
+ sys.exit(1)
@@ -0,0 +1,5 @@
1
+ # sage_setup: distribution = sagemath-msolve
2
+ # delvewheel: patch
3
+
4
+ from sage.all__sagemath_flint import *
5
+ from sage.all__sagemath_modules import *
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-msolve
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-msolve
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-msolve
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-msolve
@@ -0,0 +1,322 @@
1
+ # sage_setup: distribution = sagemath-msolve
2
+ # sage.doctest: optional - msolve
3
+ r"""
4
+ Solution of polynomial systems using msolve
5
+
6
+ `msolve <https://msolve.lip6.fr/>`_ is a multivariate polynomial system solver
7
+ based on Gröbner bases.
8
+
9
+ This module provide implementations of some operations on polynomial ideals
10
+ based on msolve.
11
+
12
+ Note that the :ref:`optional package msolve <spkg_msolve>` must be installed.
13
+
14
+ .. SEEALSO::
15
+
16
+ - :mod:`sage.features.msolve`
17
+ - :mod:`sage.rings.polynomial.multi_polynomial_ideal`
18
+ """
19
+
20
+ import os
21
+ import tempfile
22
+ import subprocess
23
+
24
+ import sage.structure.proof.proof
25
+
26
+ from sage.features.msolve import msolve
27
+ from sage.misc.converting_dict import KeyConvertingDict
28
+ from sage.misc.sage_eval import sage_eval
29
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
30
+ from sage.rings.finite_rings.finite_field_base import FiniteField
31
+ from sage.rings.rational_field import QQ
32
+ from sage.rings.real_arb import RealBallField
33
+ from sage.rings.real_double import RealDoubleField_class
34
+ from sage.rings.real_mpfr import RealField_class
35
+ from sage.rings.real_mpfi import RealIntervalField_class, RealIntervalField
36
+ from sage.structure.sequence import Sequence
37
+
38
+
39
+ def _run_msolve(ideal, options):
40
+ r"""
41
+ Internal utility function
42
+ """
43
+
44
+ base = ideal.base_ring()
45
+ if not (base is QQ or isinstance(base, FiniteField) and
46
+ base.is_prime_field() and base.characteristic() < 2**31):
47
+ raise NotImplementedError(f"unsupported base field: {base}")
48
+
49
+ # Run msolve
50
+
51
+ drlpolring = ideal.ring().change_ring(order='degrevlex')
52
+ polys = ideal.change_ring(drlpolring).gens()
53
+ msolve_in = tempfile.NamedTemporaryFile(mode='w',
54
+ encoding='ascii', delete=False)
55
+ command = [msolve().absolute_filename(), "-f", msolve_in.name] + options
56
+ try:
57
+ print(",".join(drlpolring.variable_names()), file=msolve_in)
58
+ print(base.characteristic(), file=msolve_in)
59
+ print(*(pol._repr_().replace(" ", "") for pol in polys),
60
+ sep=',\n', file=msolve_in)
61
+ msolve_in.close()
62
+ msolve_out = subprocess.run(command, capture_output=True, text=True)
63
+ finally:
64
+ os.unlink(msolve_in.name)
65
+ msolve_out.check_returncode()
66
+
67
+ return msolve_out.stdout
68
+
69
+
70
+ def groebner_basis_degrevlex(ideal, proof=True):
71
+ r"""
72
+ Compute a degrevlex Gröbner basis using msolve
73
+
74
+ EXAMPLES::
75
+
76
+ sage: from sage.rings.polynomial.msolve import groebner_basis_degrevlex
77
+
78
+ sage: # needs sage.libs.singular
79
+ sage: R.<a,b,c> = PolynomialRing(GF(101), 3, order='lex')
80
+ sage: I = sage.rings.ideal.Katsura(R,3)
81
+ sage: gb = groebner_basis_degrevlex(I); gb # optional - msolve
82
+ [a + 2*b + 2*c - 1, b*c - 19*c^2 + 10*b + 40*c,
83
+ b^2 - 41*c^2 + 20*b - 20*c, c^3 + 28*c^2 - 37*b + 13*c]
84
+ sage: gb.universe() is R # optional - msolve
85
+ False
86
+ sage: gb.universe().term_order() # optional - msolve
87
+ Degree reverse lexicographic term order
88
+ sage: ideal(gb).transformed_basis(other_ring=R) # optional - msolve
89
+ [c^4 + 38*c^3 - 6*c^2 - 6*c, 30*c^3 + 32*c^2 + b - 14*c,
90
+ a + 2*b + 2*c - 1]
91
+
92
+ Gröbner bases over the rationals require `proof=False`::
93
+
94
+ sage: R.<x, y> = PolynomialRing(QQ, 2)
95
+ sage: I = Ideal([ x*y - 1, (x-2)^2 + (y-1)^2 - 1])
96
+ sage: I.groebner_basis(algorithm='msolve') # optional - msolve
97
+ Traceback (most recent call last):
98
+ ...
99
+ ValueError: msolve relies on heuristics; please use proof=False
100
+ sage: I.groebner_basis(algorithm='msolve', proof=False) # optional - msolve
101
+ [x*y - 1, x^2 + y^2 - 4*x - 2*y + 4, y^3 - 2*y^2 + x + 4*y - 4]
102
+
103
+ TESTS::
104
+
105
+ sage: # needs sage.rings.finite_rings
106
+ sage: R.<foo, bar> = PolynomialRing(GF(536870909), 2)
107
+ sage: I = Ideal([ foo^2 - 1, bar^2 - 1 ])
108
+ sage: I.groebner_basis(algorithm='msolve') # optional - msolve
109
+ [bar^2 - 1, foo^2 - 1]
110
+ """
111
+
112
+ if ideal.base_ring() is QQ and sage.structure.proof.proof.get_flag(proof, "polynomial"):
113
+ raise ValueError("msolve relies on heuristics; please use proof=False")
114
+
115
+ drlpolring = ideal.ring().change_ring(order='degrevlex')
116
+ msolve_out = _run_msolve(ideal, ["-g", "2"])
117
+ gbasis = sage_eval(msolve_out[:-2], locals=drlpolring.gens_dict())
118
+ return Sequence(gbasis)
119
+
120
+
121
+ def variety(ideal, ring, *, proof=True):
122
+ r"""
123
+ Compute the variety of a zero-dimensional ideal using msolve.
124
+
125
+ Part of the initial implementation was loosely based on the example
126
+ interfaces available as part of msolve, with the authors' permission.
127
+
128
+ EXAMPLES::
129
+
130
+ sage: # needs sage.rings.finite_rings
131
+ sage: from sage.rings.polynomial.msolve import variety
132
+ sage: p = 536870909
133
+ sage: R.<x, y> = PolynomialRing(GF(p), 2, order='lex')
134
+ sage: I = Ideal([ x*y - 1, (x-2)^2 + (y-1)^2 - 1])
135
+ sage: sorted(variety(I, GF(p^2), proof=False), key=str) # optional - msolve
136
+ [{x: 1, y: 1},
137
+ {x: 254228855*z2 + 114981228, y: 232449571*z2 + 402714189},
138
+ {x: 267525699, y: 473946006},
139
+ {x: 282642054*z2 + 154363985, y: 304421338*z2 + 197081624}]
140
+
141
+ TESTS::
142
+
143
+ sage: # needs sage.rings.finite_rings
144
+ sage: p = 536870909
145
+ sage: R.<x, y> = PolynomialRing(GF(p), 2, order='lex')
146
+ sage: I = Ideal([ x*y - 1, (x-2)^2 + (y-1)^2 - 1])
147
+ sage: sorted(I.variety(algorithm='msolve', proof=False), key=str) # optional - msolve
148
+ [{x: 1, y: 1}, {x: 267525699, y: 473946006}]
149
+ sage: K.<a> = GF(p^2)
150
+ sage: sorted(I.variety(K, algorithm='msolve', proof=False), key=str) # optional - msolve
151
+ [{x: 1, y: 1},
152
+ {x: 118750849*a + 194048031, y: 510295713*a + 18174854},
153
+ {x: 267525699, y: 473946006},
154
+ {x: 418120060*a + 75297182, y: 26575196*a + 44750050}]
155
+
156
+ sage: # needs sage.rings.finite_rings
157
+ sage: R.<x, y> = PolynomialRing(GF(2147483659), 2, order='lex')
158
+ sage: ideal([x, y]).variety(algorithm='msolve', proof=False)
159
+ Traceback (most recent call last):
160
+ ...
161
+ NotImplementedError: unsupported base field: Finite Field of size 2147483659
162
+
163
+ sage: R.<x, y> = PolynomialRing(QQ, 2, order='lex')
164
+ sage: I = Ideal([ x*y - 1, (x-2)^2 + (y-1)^2 - 1])
165
+
166
+ sage: I.variety(algorithm='msolve', proof=False) # optional - msolve
167
+ [{x: 1, y: 1}]
168
+ sage: I.variety(RealField(100), algorithm='msolve', proof=False) # optional - msolve
169
+ [{x: 2.7692923542386314152404094643, y: 0.36110308052864737763464656216},
170
+ {x: 1.0000000000000000000000000000, y: 1.0000000000000000000000000000}]
171
+ sage: I.variety(RealIntervalField(100), algorithm='msolve', proof=False) # optional - msolve
172
+ [{x: 2.76929235423863141524040946434?, y: 0.361103080528647377634646562159?},
173
+ {x: 1, y: 1}]
174
+ sage: I.variety(RBF, algorithm='msolve', proof=False) # optional - msolve
175
+ [{x: [2.76929235423863 +/- 2.08e-15], y: [0.361103080528647 +/- 4.53e-16]},
176
+ {x: 1.000000000000000, y: 1.000000000000000}]
177
+ sage: I.variety(RDF, algorithm='msolve', proof=False) # optional - msolve
178
+ [{x: 2.7692923542386314, y: 0.36110308052864737}, {x: 1.0, y: 1.0}]
179
+ sage: I.variety(AA, algorithm='msolve', proof=False) # optional - msolve
180
+ [{x: 2.769292354238632?, y: 0.3611030805286474?},
181
+ {x: 1.000000000000000?, y: 1.000000000000000?}]
182
+ sage: I.variety(QQbar, algorithm='msolve', proof=False) # optional - msolve
183
+ [{x: 2.769292354238632?, y: 0.3611030805286474?},
184
+ {x: 1, y: 1},
185
+ {x: 0.11535382288068429? + 0.5897428050222055?*I, y: 0.3194484597356763? - 1.633170240915238?*I},
186
+ {x: 0.11535382288068429? - 0.5897428050222055?*I, y: 0.3194484597356763? + 1.633170240915238?*I}]
187
+ sage: I.variety(ComplexField(100)) # needs sage.libs.singular
188
+ [{y: 1.0000000000000000000000000000, x: 1.0000000000000000000000000000},
189
+ {y: 0.36110308052864737763464656216, x: 2.7692923542386314152404094643},
190
+ {y: 0.31944845973567631118267671892 - 1.6331702409152376561188467320*I, x: 0.11535382288068429237979526783 + 0.58974280502220550164728074602*I},
191
+ {y: 0.31944845973567631118267671892 + 1.6331702409152376561188467320*I, x: 0.11535382288068429237979526783 - 0.58974280502220550164728074602*I}]
192
+
193
+ sage: Ideal(x^2 + y^2 - 1, x - y).variety(RBF, algorithm='msolve', proof=False)
194
+ [{x: [-0.707106781186547 +/- 6.29e-16], y: [-0.707106781186547 +/- 6.29e-16]},
195
+ {x: [0.707106781186547 +/- 6.29e-16], y: [0.707106781186547 +/- 6.29e-16]}]
196
+ sage: sorted(Ideal(x^2 - 1, y^2 - 1).variety(QQ, algorithm='msolve', proof=False), key=str)
197
+ [{x: -1, y: -1}, {x: -1, y: 1}, {x: 1, y: -1}, {x: 1, y: 1}]
198
+ sage: sorted(Ideal(x^2 - 1, y^2 - 2).variety(CC, algorithm='msolve', proof=False), # abs tol 1e-10
199
+ ....: key=lambda d: (sign(d['x']), sign(d['y'])))
200
+ [{x: -1.00000000000000, y: -1.41421356237309},
201
+ {x: -1.00000000000000, y: 1.41421356237309},
202
+ {x: 1.00000000000000, y: -1.41421356237309},
203
+ {x: 1.00000000000000, y: 1.41421356237309}]
204
+ sage: Ideal([x, y, x + y]).variety(algorithm='msolve', proof=False)
205
+ [{x: 0, y: 0}]
206
+
207
+ sage: Ideal([x, y, x + y - 1]).variety(algorithm='msolve', proof=False) # optional - msolve
208
+ []
209
+ sage: Ideal([x, y, x + y - 1]).variety(RR, algorithm='msolve', proof=False) # optional - msolve
210
+ []
211
+
212
+ sage: Ideal([x*y - 1]).variety(QQbar, algorithm='msolve', proof=False) # optional - msolve
213
+ Traceback (most recent call last):
214
+ ...
215
+ ValueError: positive-dimensional ideal
216
+
217
+ sage: R.<x, y> = PolynomialRing(RR, 2, order='lex')
218
+ sage: Ideal(x, y).variety(algorithm='msolve', proof=False)
219
+ Traceback (most recent call last):
220
+ ...
221
+ NotImplementedError: unsupported base field: Real Field with 53 bits of precision
222
+
223
+ sage: R.<x, y> = PolynomialRing(QQ, 2, order='lex')
224
+ sage: Ideal(x, y).variety(ZZ, algorithm='msolve', proof=False)
225
+ Traceback (most recent call last):
226
+ ...
227
+ ValueError: no coercion from base field Rational Field to output ring Integer Ring
228
+ """
229
+
230
+ proof = sage.structure.proof.proof.get_flag(proof, "polynomial")
231
+ if proof:
232
+ raise ValueError("msolve relies on heuristics; please use proof=False")
233
+
234
+ base = ideal.base_ring()
235
+ if ring is None:
236
+ ring = base
237
+ if not ring.has_coerce_map_from(base):
238
+ raise ValueError(
239
+ f"no coercion from base field {base} to output ring {ring}")
240
+
241
+ if isinstance(ring, (RealIntervalField_class, RealBallField,
242
+ RealField_class, RealDoubleField_class)):
243
+ parameterization = False
244
+ options = ["-p", str(ring.precision())]
245
+ else:
246
+ parameterization = True
247
+ options = ["-P", "1"]
248
+
249
+ msolve_out = _run_msolve(ideal, options)
250
+
251
+ # Interpret output
252
+
253
+ try:
254
+ data = sage_eval(msolve_out[:-2])
255
+ except SyntaxError:
256
+ raise NotImplementedError(f"unsupported msolve output format: {data}")
257
+
258
+ dim = data[0]
259
+ if dim == -1:
260
+ return []
261
+ elif dim > 0:
262
+ raise ValueError("positive-dimensional ideal")
263
+ else:
264
+ assert dim.is_zero()
265
+
266
+ out_ring = ideal.ring().change_ring(ring)
267
+
268
+ if parameterization:
269
+
270
+ def to_poly(p, d=1, *, upol=PolynomialRing(base, 't')):
271
+ assert len(p[1]) == p[0] + 1 or p == [-1, [0]]
272
+ return upol(p[1])/d
273
+
274
+ try:
275
+ char, nvars, deg, vars, _, [one, [elim, den, param]] = data[1]
276
+ except (IndexError, ValueError):
277
+ raise NotImplementedError(
278
+ f"unsupported msolve output format: {data}")
279
+ assert char == ideal.base_ring().characteristic()
280
+ assert one.is_one()
281
+ assert len(vars) == nvars
282
+ ringvars = out_ring.variable_names()
283
+ assert sorted(vars[:len(ringvars)]) == sorted(ringvars)
284
+ vars = [out_ring(name) for name in vars[:len(ringvars)]]
285
+ elim = to_poly(elim)
286
+ # Criterion suggested by Mohab Safey El Din to avoid cases where there
287
+ # is no rational parameterization or where the one returned by msolve
288
+ # has a significant probability of being incorrect.
289
+ if deg >= char > 0 or 0 < char <= 2**17 and deg != elim.degree():
290
+ raise NotImplementedError(f"characteristic {char} too small")
291
+ den = to_poly(den)
292
+ # As of msolve 0.4.4, param is of the form [pol, denom] in char 0, but
293
+ # [pol] in char p > 0. My understanding is that both cases will
294
+ # eventually use the same format, so let's not be too picky.
295
+ param = [to_poly(*f) for f in param]
296
+ elim_roots = elim.roots(ring, multiplicities=False)
297
+ variety = []
298
+ for rt in elim_roots:
299
+ den_of_rt = den(rt)
300
+ point = [-p(rt) / den_of_rt for p in param]
301
+ if len(param) != len(vars):
302
+ point.append(rt)
303
+ assert len(point) == len(vars)
304
+ variety.append(point)
305
+
306
+ else:
307
+
308
+ if len(data[1]) < 2 or len(data[1]) != data[1][0] + 1:
309
+ raise NotImplementedError(
310
+ f"unsupported msolve output format: {data}")
311
+ if isinstance(ring, (RealIntervalField_class, RealBallField)):
312
+ to_out_ring = ring
313
+ else:
314
+ assert isinstance(ring, (RealField_class, RealDoubleField_class))
315
+ myRIF = RealIntervalField(ring.precision())
316
+ to_out_ring = lambda iv: ring.coerce(myRIF(iv).center())
317
+ vars = out_ring.gens()
318
+ variety = [[to_out_ring(iv) for iv in point]
319
+ for l in data[1][1:]
320
+ for point in l]
321
+
322
+ return [KeyConvertingDict(out_ring, zip(vars, point)) for point in variety]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env python
2
+
3
+ # PEP 517 builds do not have . in sys.path
4
+ import os
5
+ import sys
6
+ sys.path.insert(0, os.path.dirname(__file__))
7
+
8
+ from sage_setup import sage_setup
9
+
10
+ sage_setup(['sagemath-msolve'],
11
+ recurse_packages=('sage', 'passagemath_msolve'),
12
+ spkgs=['msolve'],
13
+ package_data={},
14
+ py_limited_api=True)