passagemath-sirocco 10.6.38__cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
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.
- passagemath_sirocco/__init__.py +3 -0
- passagemath_sirocco-10.6.38.dist-info/METADATA +124 -0
- passagemath_sirocco-10.6.38.dist-info/RECORD +12 -0
- passagemath_sirocco-10.6.38.dist-info/WHEEL +6 -0
- passagemath_sirocco-10.6.38.dist-info/top_level.txt +3 -0
- passagemath_sirocco.libs/libgmp-93ebf16a.so.10.5.0 +0 -0
- passagemath_sirocco.libs/libmpfr-9d41ebf1.so.6.2.1 +0 -0
- passagemath_sirocco.libs/libsirocco-c2c2fe95.so.0.0.0 +0 -0
- sage/all__sagemath_sirocco.py +9 -0
- sage/libs/all__sagemath_sirocco.py +1 -0
- sage/libs/sirocco.cpython-314-aarch64-linux-gnu.so +0 -0
- sage/libs/sirocco.pyx +290 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: passagemath-sirocco
|
|
3
|
+
Version: 10.6.38
|
|
4
|
+
Summary: passagemath: Certified root continuation with sirocco
|
|
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-modules~=10.6.38.0
|
|
35
|
+
Provides-Extra: test
|
|
36
|
+
Requires-Dist: passagemath-combinat; extra == "test"
|
|
37
|
+
Requires-Dist: passagemath-graphs; extra == "test"
|
|
38
|
+
Requires-Dist: passagemath-groups; extra == "test"
|
|
39
|
+
Requires-Dist: passagemath-polyhedra; extra == "test"
|
|
40
|
+
Requires-Dist: passagemath-repl; extra == "test"
|
|
41
|
+
Requires-Dist: passagemath-schemes; extra == "test"
|
|
42
|
+
|
|
43
|
+
==================================================================================
|
|
44
|
+
passagemath: Certified root continuation with sirocco
|
|
45
|
+
==================================================================================
|
|
46
|
+
|
|
47
|
+
`passagemath <https://github.com/passagemath/passagemath>`__ is open
|
|
48
|
+
source mathematical software in Python, released under the GNU General
|
|
49
|
+
Public Licence GPLv2+.
|
|
50
|
+
|
|
51
|
+
It is a fork of `SageMath <https://www.sagemath.org/>`__, which has been
|
|
52
|
+
developed 2005-2025 under the motto “Creating a Viable Open Source
|
|
53
|
+
Alternative to Magma, Maple, Mathematica, and MATLAB”.
|
|
54
|
+
|
|
55
|
+
The passagemath fork uses the motto "Creating a Free Passage Between the
|
|
56
|
+
Scientific Python Ecosystem and Mathematical Software Communities."
|
|
57
|
+
It was created in October 2024 with the following goals:
|
|
58
|
+
|
|
59
|
+
- providing modularized installation with pip,
|
|
60
|
+
- establishing first-class membership in the scientific Python
|
|
61
|
+
ecosystem,
|
|
62
|
+
- giving `clear attribution of upstream
|
|
63
|
+
projects <https://groups.google.com/g/sage-devel/c/6HO1HEtL1Fs/m/G002rPGpAAAJ>`__,
|
|
64
|
+
- providing independently usable Python interfaces to upstream
|
|
65
|
+
libraries,
|
|
66
|
+
- offering `platform portability and integration testing
|
|
67
|
+
services <https://github.com/passagemath/passagemath/issues/704>`__
|
|
68
|
+
to upstream projects,
|
|
69
|
+
- inviting collaborations with upstream projects,
|
|
70
|
+
- `building a professional, respectful, inclusive
|
|
71
|
+
community <https://groups.google.com/g/sage-devel/c/xBzaINHWwUQ>`__,
|
|
72
|
+
- `empowering Sage users to participate in the scientific Python ecosystem
|
|
73
|
+
<https://github.com/passagemath/passagemath/issues/248>`__ by publishing packages,
|
|
74
|
+
- developing a port to `Pyodide <https://pyodide.org/en/stable/>`__ for
|
|
75
|
+
serverless deployment with Javascript,
|
|
76
|
+
- developing a native Windows port.
|
|
77
|
+
|
|
78
|
+
`Full documentation <https://passagemath.org/docs/latest/html/en/index.html>`__ is
|
|
79
|
+
available online.
|
|
80
|
+
|
|
81
|
+
passagemath attempts to support and provides binary wheels suitable for
|
|
82
|
+
all major Linux distributions and recent versions of macOS.
|
|
83
|
+
|
|
84
|
+
Binary wheels for native Windows (x86_64) are are available for a subset of
|
|
85
|
+
the passagemath distributions. Use of the full functionality of passagemath
|
|
86
|
+
on Windows currently requires the use of Windows Subsystem for Linux (WSL)
|
|
87
|
+
or virtualization.
|
|
88
|
+
|
|
89
|
+
The supported Python versions in the passagemath 10.6.x series are 3.10.x-3.13.x.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
About this pip-installable distribution package
|
|
93
|
+
-----------------------------------------------
|
|
94
|
+
|
|
95
|
+
This pip-installable distribution ``passagemath-sirocco`` provides a Cython interface
|
|
96
|
+
to the `sirocco <https://github.com/miguelmarco/SIROCCO2>`_ library for computing
|
|
97
|
+
topologically certified root continuation of bivariate polynomials.
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
What is included
|
|
101
|
+
----------------
|
|
102
|
+
|
|
103
|
+
* `sage.libs.sirocco <https://github.com/passagemath/passagemath/blob/main/src/sage/libs/sirocco.pyx>`_
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
Examples
|
|
107
|
+
--------
|
|
108
|
+
|
|
109
|
+
::
|
|
110
|
+
|
|
111
|
+
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-sirocco[test]" ipython
|
|
112
|
+
|
|
113
|
+
In [1]: from passagemath_sirocco import *
|
|
114
|
+
|
|
115
|
+
In [2]: from sage.libs.sirocco import contpath
|
|
116
|
+
|
|
117
|
+
In [3]: pol = list(map(RR,[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
|
|
118
|
+
|
|
119
|
+
In [4]: contpath(2, pol, RR(0), RR(0))
|
|
120
|
+
Out[4]:
|
|
121
|
+
[(0.0, 0.0, 0.0),
|
|
122
|
+
(0.3535533905932738, -0.12500000000000003, 0.0),
|
|
123
|
+
(0.7071067811865476, -0.5000000000000001, 0.0),
|
|
124
|
+
(1.0, -1.0, 0.0)]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
passagemath_sirocco/__init__.py,sha256=13fj3jvtMS6cIdUTHWR6olfV09gKD0e2Wi5JIMSxNik,88
|
|
2
|
+
passagemath_sirocco.libs/libgmp-93ebf16a.so.10.5.0,sha256=J_oguU4vvekVCVuY5w0xJjRsPinQWaZ9HqUVq6yFhas,668537
|
|
3
|
+
passagemath_sirocco.libs/libmpfr-9d41ebf1.so.6.2.1,sha256=FOAwd1MXi2r6neQQ8hK2PLPyEaTxHfBd-h6phIuPp0U,932097
|
|
4
|
+
passagemath_sirocco.libs/libsirocco-c2c2fe95.so.0.0.0,sha256=oJEbCojjaNwxZVzx1D_-0HPpJusjTGf--8hWjmUowOA,1194777
|
|
5
|
+
sage/all__sagemath_sirocco.py,sha256=DETVlVgWYtPIsdw2wOM9oqCp-RfID9ymRYZCbm70-io,188
|
|
6
|
+
sage/libs/all__sagemath_sirocco.py,sha256=BnLb9I-8oMsUKI5uRle_hxp92wdAAez3PgwDyMK-KRc,46
|
|
7
|
+
sage/libs/sirocco.cpython-314-aarch64-linux-gnu.so,sha256=kSjdh423RLjM5xNvJTGTCtRm5n-KJ2_SWjhRG1ERcUI,922737
|
|
8
|
+
sage/libs/sirocco.pyx,sha256=SX_40zdJcrptjAArU19WaB7QLIT6DGPs6I9V9x2pz-Y,11171
|
|
9
|
+
passagemath_sirocco-10.6.38.dist-info/METADATA,sha256=hoBuqxJ8QByTGfYym7M-VFlztLExdEANmG8u3SRKPvE,5400
|
|
10
|
+
passagemath_sirocco-10.6.38.dist-info/WHEEL,sha256=4fkoHk_tgAA2CUj2UHa3pcykOfluXe7NKeeQtUAHAq0,154
|
|
11
|
+
passagemath_sirocco-10.6.38.dist-info/top_level.txt,sha256=WaBfhxtou-FhXK710boiIi1wnus0aQ5K02SO4T3yCrg,26
|
|
12
|
+
passagemath_sirocco-10.6.38.dist-info/RECORD,,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-sirocco
|
|
Binary file
|
sage/libs/sirocco.pyx
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# cython: boundscheck=False, wraparound=False
|
|
2
|
+
# distutils: libraries = sirocco
|
|
3
|
+
# distutils: language = c++
|
|
4
|
+
# sage_setup: distribution = sagemath-sirocco
|
|
5
|
+
|
|
6
|
+
r"""
|
|
7
|
+
Cython wrapper for sirocco library
|
|
8
|
+
|
|
9
|
+
This is used to call the sirocco library directly from Python.
|
|
10
|
+
|
|
11
|
+
AUTHORS:
|
|
12
|
+
|
|
13
|
+
- Miguel Marco (2016-07-19): initial version.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from cysignals.signals cimport sig_on, sig_off
|
|
17
|
+
from cysignals.memory cimport check_allocarray, sig_free as free
|
|
18
|
+
|
|
19
|
+
from sage.libs.mpfr cimport *
|
|
20
|
+
from sage.rings.real_mpfr cimport RealNumber
|
|
21
|
+
from sage.rings.real_mpfr import RealField
|
|
22
|
+
|
|
23
|
+
cdef extern from "sirocco.h":
|
|
24
|
+
mpfr_t* homotopyPath_mp(int degree, mpfr_t *_coef, mpfr_t _y0R, mpfr_t _y0I, int prec)
|
|
25
|
+
double* homotopyPath(int degree, double *_coef, double _y0R, double _y0I)
|
|
26
|
+
mpfr_t* homotopyPath_mp_comps(int degree, mpfr_t *_coef, mpfr_t _y0R, mpfr_t _y0I, int prec, int nothercomps, int *degreescomps, mpfr_t *_coefscomps)
|
|
27
|
+
double* homotopyPath_comps(int degree, double *_coef, double _y0R, double _y0I, int nothercomps, int *degreescomps, double *_coefscomps)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
cpdef list[list] contpath_mp(int deg, list values, RealNumber y0r, RealNumber y0i, int prec) noexcept:
|
|
31
|
+
"""
|
|
32
|
+
Mimics :func:`contpath`, but with the following differences:
|
|
33
|
+
|
|
34
|
+
- The floating point numbers can be arbitrary precision RealNumbers.
|
|
35
|
+
|
|
36
|
+
- A extra argument is needed, indicating the bits of precision used
|
|
37
|
+
in the computations.
|
|
38
|
+
|
|
39
|
+
EXAMPLES::
|
|
40
|
+
|
|
41
|
+
sage: from sage.libs.sirocco import contpath_mp # optional - sirocco
|
|
42
|
+
sage: from sage.rings.real_mpfr import RR
|
|
43
|
+
sage: pol = list(map(RR, [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
|
|
44
|
+
sage: contpath_mp(2, pol, RR(0), RR(0), 53) # optional - sirocco # abs tol 1e-15
|
|
45
|
+
[(0.000000000000000, 0.000000000000000, 0.000000000000000),
|
|
46
|
+
(0.500000000000000, -0.250000000000000, 0.000000000000000),
|
|
47
|
+
(1.00000000000000, -1.00000000000000, 0.000000000000000)]
|
|
48
|
+
"""
|
|
49
|
+
cdef mpfr_t* cvalues = <mpfr_t*> check_allocarray(len(values), sizeof(mpfr_t))
|
|
50
|
+
cdef mpfr_t* rop
|
|
51
|
+
cdef int i, j
|
|
52
|
+
cdef mpfr_t y0R
|
|
53
|
+
cdef mpfr_t y0I
|
|
54
|
+
|
|
55
|
+
for j in range(len(values)):
|
|
56
|
+
mpfr_init2(cvalues[j], prec)
|
|
57
|
+
mpfr_set(cvalues[j], (<RealNumber>values[j]).value, MPFR_RNDN)
|
|
58
|
+
|
|
59
|
+
sig_on()
|
|
60
|
+
mpfr_init2(y0R, prec)
|
|
61
|
+
mpfr_set(y0R, (<RealNumber>y0r).value, MPFR_RNDN)
|
|
62
|
+
mpfr_init2(y0I, prec)
|
|
63
|
+
mpfr_set(y0I, (<RealNumber>y0i).value, MPFR_RNDN)
|
|
64
|
+
rop = homotopyPath_mp(deg, cvalues, y0R, y0I, prec)
|
|
65
|
+
sig_off()
|
|
66
|
+
|
|
67
|
+
for j in range(len(values)):
|
|
68
|
+
mpfr_clear(cvalues[j])
|
|
69
|
+
free(cvalues)
|
|
70
|
+
|
|
71
|
+
if rop == NULL:
|
|
72
|
+
raise ValueError("libsirocco could not guarantee one step")
|
|
73
|
+
|
|
74
|
+
cdef int n = mpfr_get_si(rop[0], MPFR_RNDN)
|
|
75
|
+
cdef list l = []
|
|
76
|
+
cdef list inner
|
|
77
|
+
cdef RealNumber RN
|
|
78
|
+
field = RealField(prec)
|
|
79
|
+
for i in range(n):
|
|
80
|
+
inner = []
|
|
81
|
+
for j in range(3*i+1, 3*(i+1)+1):
|
|
82
|
+
RN = <RealNumber> RealNumber.__new__(RealNumber, field)
|
|
83
|
+
mpfr_set(RN.value, rop[j], MPFR_RNDN)
|
|
84
|
+
mpfr_clear(rop[j])
|
|
85
|
+
inner.append(RN)
|
|
86
|
+
l.append(tuple(inner))
|
|
87
|
+
free(rop)
|
|
88
|
+
return l
|
|
89
|
+
|
|
90
|
+
cpdef list[list] contpath_mp_comps(int deg, list values, RealNumber y0r, RealNumber y0i, int prec, list otherdegs, list othercoefs) noexcept:
|
|
91
|
+
"""
|
|
92
|
+
Mimics :func:`contpath`, but with the following differences:
|
|
93
|
+
|
|
94
|
+
- The floating point numbers can be arbitrary precision RealNumbers.
|
|
95
|
+
|
|
96
|
+
- A extra argument is needed, indicating the bits of precision used
|
|
97
|
+
in the computations.
|
|
98
|
+
|
|
99
|
+
EXAMPLES::
|
|
100
|
+
|
|
101
|
+
sage: from sage.libs.sirocco import contpath_mp_comps # optional - sirocco
|
|
102
|
+
sage: from sage.rings.real_mpfr import RR
|
|
103
|
+
sage: pol = list(map(RR,[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
|
|
104
|
+
sage: fac = list(map(RR,[0, 0, 0.1, 0.2, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
|
|
105
|
+
sage: contpath_mp_comps(2, pol, RR(0), RR(0), 53, [2], fac) # optional - sirocco # abs tol 1e-15
|
|
106
|
+
[(0.000000000000000, 0.000000000000000, 0.000000000000000),
|
|
107
|
+
(0.125000000000000, -0.0156250000000000, 0.000000000000000),
|
|
108
|
+
(0.250000000000000, -0.0625000000000000, 0.000000000000000),
|
|
109
|
+
(0.375000000000000, -0.140625000000000, 0.000000000000000),
|
|
110
|
+
(0.500000000000000, -0.250000000000000, 0.000000000000000),
|
|
111
|
+
(0.625000000000000, -0.390625000000000, 0.000000000000000),
|
|
112
|
+
(0.750000000000000, -0.562500000000000, 0.000000000000000),
|
|
113
|
+
(0.875000000000000, -0.765625000000000, 0.000000000000000),
|
|
114
|
+
(1.00000000000000, -1.00000000000000, 0.000000000000000)]
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
cdef mpfr_t* cvalues = <mpfr_t*> check_allocarray(len(values), sizeof(mpfr_t))
|
|
118
|
+
cdef mpfr_t* cothercoefs = <mpfr_t*> check_allocarray(len(othercoefs), sizeof(mpfr_t))
|
|
119
|
+
cdef int* cotherdegs = <int*> check_allocarray(len(otherdegs), sizeof(int))
|
|
120
|
+
cdef mpfr_t* rop
|
|
121
|
+
cdef int i, j
|
|
122
|
+
cdef mpfr_t y0R
|
|
123
|
+
cdef mpfr_t y0I
|
|
124
|
+
|
|
125
|
+
for j in range(len(values)):
|
|
126
|
+
mpfr_init2(cvalues[j], prec)
|
|
127
|
+
mpfr_set(cvalues[j], (<RealNumber>values[j]).value, MPFR_RNDN)
|
|
128
|
+
|
|
129
|
+
for j in range(len(othercoefs)):
|
|
130
|
+
mpfr_init2(cothercoefs[j], prec)
|
|
131
|
+
mpfr_set(cothercoefs[j], (<RealNumber>othercoefs[j]).value, MPFR_RNDN)
|
|
132
|
+
|
|
133
|
+
for j in range(len(otherdegs)):
|
|
134
|
+
cotherdegs[j] = int(otherdegs[j])
|
|
135
|
+
sig_on()
|
|
136
|
+
mpfr_init2(y0R, prec)
|
|
137
|
+
mpfr_set(y0R, (<RealNumber>y0r).value, MPFR_RNDN)
|
|
138
|
+
mpfr_init2(y0I, prec)
|
|
139
|
+
mpfr_set(y0I, (<RealNumber>y0i).value, MPFR_RNDN)
|
|
140
|
+
rop = homotopyPath_mp_comps(deg, cvalues, y0R, y0I, prec, int(len(otherdegs)), cotherdegs, cothercoefs)
|
|
141
|
+
sig_off()
|
|
142
|
+
for j in range(len(values)):
|
|
143
|
+
mpfr_clear(cvalues[j])
|
|
144
|
+
free(cvalues)
|
|
145
|
+
for j in range(len(othercoefs)):
|
|
146
|
+
mpfr_clear(cothercoefs[j])
|
|
147
|
+
free(cothercoefs)
|
|
148
|
+
free(cotherdegs)
|
|
149
|
+
if rop == NULL:
|
|
150
|
+
raise ValueError("libsirocco could not guarantee one step")
|
|
151
|
+
cdef int n = mpfr_get_si(rop[0], MPFR_RNDN)
|
|
152
|
+
cdef list l = []
|
|
153
|
+
cdef list inner
|
|
154
|
+
cdef RealNumber RN
|
|
155
|
+
field = RealField(prec)
|
|
156
|
+
for i in range(n):
|
|
157
|
+
inner = []
|
|
158
|
+
for j in range(3*i+1, 3*(i+1)+1):
|
|
159
|
+
RN = <RealNumber> RealNumber.__new__(RealNumber, field)
|
|
160
|
+
mpfr_set(RN.value, rop[j], MPFR_RNDN)
|
|
161
|
+
mpfr_clear(rop[j])
|
|
162
|
+
inner.append(RN)
|
|
163
|
+
l.append(tuple(inner))
|
|
164
|
+
free(rop)
|
|
165
|
+
return l
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
cpdef list[list] contpath(int deg, list values, double y0r, double y0i) noexcept:
|
|
169
|
+
"""
|
|
170
|
+
INPUT:
|
|
171
|
+
|
|
172
|
+
- An integer, representing the degree of the polynomial
|
|
173
|
+
|
|
174
|
+
- A list of floating point numbers. Each four consecutive elements
|
|
175
|
+
of this list represent the interval corresponding to a coefficient.
|
|
176
|
+
Coefficients are listed in increasing deglex order, and inside each
|
|
177
|
+
coefficients, the four numbers represent the lower real, upper real,
|
|
178
|
+
lower imaginary and real imaginary limits of the interval.
|
|
179
|
+
|
|
180
|
+
- A float representing the real part of the initial root approximation
|
|
181
|
+
|
|
182
|
+
- A float representing the imaginary part of the initial root.
|
|
183
|
+
|
|
184
|
+
OUTPUT:
|
|
185
|
+
|
|
186
|
+
A list of tuples. Each tuple represents the `x` value (between 0 and 1)
|
|
187
|
+
and the real and imaginary parts of the `y` value of a vertex in
|
|
188
|
+
the piecewise linear approximation of the path tracked by the root.
|
|
189
|
+
|
|
190
|
+
EXAMPLES::
|
|
191
|
+
|
|
192
|
+
sage: from sage.libs.sirocco import contpath # optional - sirocco
|
|
193
|
+
sage: from sage.rings.real_mpfr import RR
|
|
194
|
+
sage: pol = list(map(RR,[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
|
|
195
|
+
sage: contpath(2, pol, RR(0), RR(0)) # optional - sirocco # abs tol 1e-15
|
|
196
|
+
[(0.0, 0.0, 0.0),
|
|
197
|
+
(0.3535533905932738, -0.12500000000000003, 0.0),
|
|
198
|
+
(0.7071067811865476, -0.5000000000000001, 0.0),
|
|
199
|
+
(1.0, -1.0, 0.0)]
|
|
200
|
+
"""
|
|
201
|
+
cdef double* rop
|
|
202
|
+
cdef double* c_values = <double*> check_allocarray(len(values), sizeof(double))
|
|
203
|
+
cdef int clen = <int> len(values)
|
|
204
|
+
cdef int i
|
|
205
|
+
for i, v in enumerate(values):
|
|
206
|
+
c_values[i] = values[i]
|
|
207
|
+
cdef double y0R = y0r
|
|
208
|
+
cdef double y0I = y0i
|
|
209
|
+
sig_on()
|
|
210
|
+
rop = homotopyPath(deg, c_values, y0R, y0I)
|
|
211
|
+
sig_off()
|
|
212
|
+
if rop == NULL:
|
|
213
|
+
raise ValueError("libsirocco could not guarantee one step")
|
|
214
|
+
cdef int n = int(rop[0])
|
|
215
|
+
cdef list l = [0] * n
|
|
216
|
+
for i in range(n):
|
|
217
|
+
l[i] = (rop[3*i+1], rop[3*i+2], rop[3*i+3])
|
|
218
|
+
free(rop)
|
|
219
|
+
free(c_values)
|
|
220
|
+
return l
|
|
221
|
+
|
|
222
|
+
cpdef list[list] contpath_comps(int deg, list values, double y0r, double y0i, list otherdegrees, list othercoefs) noexcept:
|
|
223
|
+
"""
|
|
224
|
+
INPUT:
|
|
225
|
+
|
|
226
|
+
- An integer, representing the degree of the polynomial
|
|
227
|
+
|
|
228
|
+
- A list of floating point numbers. Each four consecutive elements
|
|
229
|
+
of this list represent the interval corresponding to a coefficient.
|
|
230
|
+
Coefficients are listed in increasing deglex order, and inside each
|
|
231
|
+
coefficients, the four numbers represent the lower real, upper real,
|
|
232
|
+
lower imaginary and real imaginary limits of the interval.
|
|
233
|
+
|
|
234
|
+
- A float representing the real part of the initial root approximation
|
|
235
|
+
|
|
236
|
+
- A float representing the imaginary part of the initial root.
|
|
237
|
+
|
|
238
|
+
OUTPUT:
|
|
239
|
+
|
|
240
|
+
A list of tuples. Each tuple represents the `x` value (between 0 and 1)
|
|
241
|
+
and the real and imaginary parts of the `y` value of a vertex in
|
|
242
|
+
the piecewise linear approximation of the path tracked by the root.
|
|
243
|
+
|
|
244
|
+
EXAMPLES::
|
|
245
|
+
|
|
246
|
+
sage: from sage.libs.sirocco import contpath_comps # optional - sirocco
|
|
247
|
+
sage: from sage.rings.real_mpfr import RR
|
|
248
|
+
sage: pol = list(map(RR,[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
|
|
249
|
+
sage: fac = list(map(RR,[0, 0, 0.1, 0.2, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))
|
|
250
|
+
sage: contpath_comps(2, pol, RR(0), RR(0), [2], fac) # optional - sirocco # abs tol 1e-15
|
|
251
|
+
[(0.0, 0.0, 0.0),
|
|
252
|
+
(0.125, -0.015625, 0.0),
|
|
253
|
+
(0.25, -0.0625, 0.0),
|
|
254
|
+
(0.375, -0.140625, 0.0),
|
|
255
|
+
(0.5, -0.25, 0.0),
|
|
256
|
+
(0.625, -0.390625, 0.0),
|
|
257
|
+
(0.75, -0.5625, 0.0),
|
|
258
|
+
(0.875, -0.765625, 0.0),
|
|
259
|
+
(1.0, -1.0, 0.0)]
|
|
260
|
+
"""
|
|
261
|
+
cdef double* rop
|
|
262
|
+
cdef double* c_values = <double*> check_allocarray(len(values), sizeof(double))
|
|
263
|
+
cdef int* c_otherdegrees = <int*> check_allocarray(len(otherdegrees), sizeof(int))
|
|
264
|
+
cdef double* c_othercoefs = <double*> check_allocarray(len(othercoefs), sizeof(double))
|
|
265
|
+
cdef int clen = <int> len(values)
|
|
266
|
+
cdef int i
|
|
267
|
+
for i, v in enumerate(values):
|
|
268
|
+
c_values[i] = values[i]
|
|
269
|
+
|
|
270
|
+
for i, v in enumerate(otherdegrees):
|
|
271
|
+
c_otherdegrees[i] = otherdegrees[i]
|
|
272
|
+
for i, v in enumerate(othercoefs):
|
|
273
|
+
c_othercoefs[i] = othercoefs[i]
|
|
274
|
+
|
|
275
|
+
cdef double y0R = y0r
|
|
276
|
+
cdef double y0I = y0i
|
|
277
|
+
sig_on()
|
|
278
|
+
rop = homotopyPath_comps(deg, c_values, y0R, y0I, int(len(otherdegrees)), c_otherdegrees, c_othercoefs)
|
|
279
|
+
sig_off()
|
|
280
|
+
if rop == NULL:
|
|
281
|
+
raise ValueError("libsirocco could not guarantee one step")
|
|
282
|
+
cdef int n = int(rop[0])
|
|
283
|
+
cdef list l = [0] * n
|
|
284
|
+
for i in range(n):
|
|
285
|
+
l[i] = (rop[3*i+1], rop[3*i+2], rop[3*i+3])
|
|
286
|
+
free(rop)
|
|
287
|
+
free(c_values)
|
|
288
|
+
free(c_otherdegrees)
|
|
289
|
+
free(c_othercoefs)
|
|
290
|
+
return l
|