You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sagemathgh-39075: Allow more rings to be used with libsingular & rework signal detection system
Somewhat related: sagemath#33319
Anyway, this allows many more rings to be used with libsingular.
Previously it fallback to the expect interface.
It seems weird that both Sage and Singular has different types for
`GF(5)` and `Zmod(5)`, but okay.
### 📝 Checklist
<!-- Put an `x` in all the boxes that apply. -->
- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.
### ⌛ Dependencies
<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
URL: sagemath#39075
Reported by: user202729
Reviewer(s): Martin Rubey, user202729
cdef ring *singular_ring_new(base_ring, n, names, term_order) exceptNULL:
83
-
"""
84
+
r"""
84
85
Create a new Singular ring over the ``base_ring`` in ``n``
85
86
variables with the names ``names`` and the term order
86
87
``term_order``.
@@ -159,17 +160,136 @@ cdef ring *singular_ring_new(base_ring, n, names, term_order) except NULL:
159
160
sage: R.<x,y,z> = F[]
160
161
sage: from sage.libs.singular.function import singular_function
161
162
sage: sing_print = singular_function('print')
162
-
sage: sing_print(R)
163
-
'polynomial ring, over a field, global ordering\n// coefficients: ZZ/7(a, b)\n// number of vars : 3\n// block 1 : ordering dp\n// : names x y z\n// block 2 : ordering C'
163
+
sage: print(sing_print(R))
164
+
polynomial ring, over a field, global ordering
165
+
// coefficients: ZZ/7(a, b)
166
+
// number of vars : 3
167
+
// block 1 : ordering dp
168
+
// : names x y z
169
+
// block 2 : ordering C
164
170
165
171
::
166
172
167
173
sage: F = PolynomialRing(QQ, 's,t').fraction_field()
168
174
sage: R.<x,y,z> = F[]
169
175
sage: from sage.libs.singular.function import singular_function
170
-
sage: sing_print = singular_function('print')
171
-
sage: sing_print(R)
172
-
'polynomial ring, over a field, global ordering\n// coefficients: QQ(s, t)\n// number of vars : 3\n// block 1 : ordering dp\n// : names x y z\n// block 2 : ordering C'
176
+
sage: print(sing_print(R))
177
+
polynomial ring, over a field, global ordering
178
+
// coefficients: QQ(s, t)
179
+
// number of vars : 3
180
+
// block 1 : ordering dp
181
+
// : names x y z
182
+
// block 2 : ordering C
183
+
184
+
Small primes::
185
+
186
+
sage: R = PolynomialRing(GF(2), ("a", "b"), implementation="singular"); print(sing_print(R))
187
+
polynomial ring, over a field, global ordering
188
+
// coefficients: ZZ/2
189
+
// number of vars : 2
190
+
// block 1 : ordering dp
191
+
// : names a b
192
+
// block 2 : ordering C
193
+
sage: R = PolynomialRing(GF(3), ("a", "b"), implementation="singular"); print(sing_print(R))
194
+
polynomial ring, over a field, global ordering
195
+
// coefficients: ZZ/3
196
+
// number of vars : 2
197
+
// block 1 : ordering dp
198
+
// : names a b
199
+
// block 2 : ordering C
200
+
sage: R = PolynomialRing(GF(1000000007), ("a", "b"), implementation="singular"); print(sing_print(R))
201
+
polynomial ring, over a field, global ordering
202
+
// coefficients: ZZ/1000000007
203
+
// number of vars : 2
204
+
// block 1 : ordering dp
205
+
// : names a b
206
+
// block 2 : ordering C
207
+
208
+
When ``Zmod`` is used, use a different Singular type
209
+
(note that the print is wrong, the field in fact doesn't have zero-divisors)::
210
+
211
+
sage: R = PolynomialRing(Zmod(2), ("a", "b"), implementation="singular"); print(sing_print(R))
212
+
polynomial ring, over a ring (with zero-divisors), global ordering
213
+
// coefficients: ZZ/(2)
214
+
// number of vars : 2
215
+
// block 1 : ordering dp
216
+
// : names a b
217
+
// block 2 : ordering C
218
+
sage: R = PolynomialRing(Zmod(3), ("a", "b"), implementation="singular"); print(sing_print(R))
219
+
polynomial ring, over a ring (with zero-divisors), global ordering
220
+
// coefficients: ZZ/(3)
221
+
// number of vars : 2
222
+
// block 1 : ordering dp
223
+
// : names a b
224
+
// block 2 : ordering C
225
+
226
+
Large prime (note that the print is wrong, the field in fact doesn't have zero-divisors)::
227
+
228
+
sage: R = PolynomialRing(GF(2^128+51), ("a", "b"), implementation="singular"); print(sing_print(R))
229
+
polynomial ring, over a ring (with zero-divisors), global ordering
0 commit comments