Skip to content

Commit

Permalink
Merge branch 'singular-4.4' into singular-4.3.2p16
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Mar 9, 2024
2 parents e66c299 + 680283a commit 713f73a
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 15 deletions.
7 changes: 5 additions & 2 deletions src/sage/interfaces/singular.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,14 +1211,14 @@ def current_ring(self):
polynomial ring, over a field, global ordering
// coefficients: ZZ/127
// number of vars : 3
// block 1 : ordering rp
// block 1 : ordering ip
// : names x y z
// block 2 : ordering C
sage: singular.current_ring()
polynomial ring, over a field, global ordering
// coefficients: ZZ/127
// number of vars : 3
// block 1 : ordering rp
// block 1 : ordering ip
// : names x y z
// block 2 : ordering C
"""
Expand Down Expand Up @@ -2040,6 +2040,9 @@ def _sage_(self, R=None):
elif typ == 'intvec':
from sage.modules.free_module_element import vector
return vector([sage.rings.integer.Integer(str(e)) for e in self])
elif typ == 'bigintvec':
from sage.modules.free_module_element import vector
return vector([sage.rings.rational.Rational(str(e)) for e in self])
elif typ == 'intmat':
from sage.matrix.constructor import matrix
from sage.rings.integer_ring import ZZ
Expand Down
7 changes: 6 additions & 1 deletion src/sage/libs/singular/decl.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ cdef extern from "singular/Singular/libsingular.h":
ringorder_s
ringorder_lp
ringorder_dp
ringorder_rp
ringorder_ip
ringorder_Dp
ringorder_wp
ringorder_Wp
Expand Down Expand Up @@ -291,6 +291,10 @@ cdef extern from "singular/Singular/libsingular.h":
int row
int col

cdef cppclass bigintmat:
int (*length)()
number* (*get)(int i)

# omalloc bins

ctypedef struct omBin "omBin_s"
Expand Down Expand Up @@ -921,6 +925,7 @@ cdef extern from "singular/Singular/libsingular.h":
cdef int MATRIX_CMD
cdef int LIST_CMD
cdef int INTVEC_CMD
cdef int BIGINTVEC_CMD
cdef int NONE
cdef int RESOLUTION_CMD
cdef int PACKAGE_CMD
Expand Down
12 changes: 7 additions & 5 deletions src/sage/libs/singular/function.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ from sage.rings.polynomial.multi_polynomial_sequence import PolynomialSequence_g
from sage.libs.singular.decl cimport *
from sage.libs.singular.option import opt_ctx
from sage.libs.singular.polynomial cimport singular_vector_maximal_component
from sage.libs.singular.singular cimport sa2si, si2sa, si2sa_intvec
from sage.libs.singular.singular cimport sa2si, si2sa, si2sa_intvec, si2sa_bigintvec
from sage.libs.singular.singular import error_messages

from sage.interfaces.singular import get_docstring
Expand Down Expand Up @@ -954,6 +954,8 @@ cdef class Converter(SageObject):
return si2sa(<number *>to_convert.data, self._singular_ring, self._sage_ring.base_ring())
elif rtyp == INTVEC_CMD:
return si2sa_intvec(<intvec *> to_convert.data)
elif rtyp == BIGINTVEC_CMD:
return si2sa_bigintvec(<bigintmat *> to_convert.data)
elif rtyp == STRING_CMD:
# TODO: Need to determine what kind of data can be returned by a
# STRING_CMD--is it just ASCII strings or can it be an arbitrary
Expand Down Expand Up @@ -1231,7 +1233,7 @@ cdef class SingularFunction(SageObject):
Traceback (most recent call last):
...
RuntimeError: error in Singular function call 'size':
Wrong number of arguments (got 2 arguments, arity code is 302)
Wrong number of arguments (got 2 arguments, arity code is 303)
sage: size('foobar', ring=P)
6
Expand Down Expand Up @@ -1634,17 +1636,17 @@ def singular_function(name):
Traceback (most recent call last):
...
RuntimeError: error in Singular function call 'factorize':
Wrong number of arguments (got 0 arguments, arity code is 305)
Wrong number of arguments (got 0 arguments, arity code is 306)
sage: factorize(f, 1, 2)
Traceback (most recent call last):
...
RuntimeError: error in Singular function call 'factorize':
Wrong number of arguments (got 3 arguments, arity code is 305)
Wrong number of arguments (got 3 arguments, arity code is 306)
sage: factorize(f, 1, 2, 3)
Traceback (most recent call last):
...
RuntimeError: error in Singular function call 'factorize':
Wrong number of arguments (got 4 arguments, arity code is 305)
Wrong number of arguments (got 4 arguments, arity code is 306)
The Singular function ``list`` can be called with any number of
arguments::
Expand Down
4 changes: 2 additions & 2 deletions src/sage/libs/singular/ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ from sage.libs.gmp.mpz cimport mpz_init_set_ui
from sage.libs.singular.decl cimport ring, currRing
from sage.libs.singular.decl cimport rChangeCurrRing, rComplete, rDelete, idInit
from sage.libs.singular.decl cimport omAlloc0, omStrDup, omAlloc
from sage.libs.singular.decl cimport ringorder_dp, ringorder_Dp, ringorder_lp, ringorder_rp, ringorder_ds, ringorder_Ds, ringorder_ls, ringorder_M, ringorder_c, ringorder_C, ringorder_wp, ringorder_Wp, ringorder_ws, ringorder_Ws, ringorder_a, rRingOrder_t
from sage.libs.singular.decl cimport ringorder_dp, ringorder_Dp, ringorder_lp, ringorder_ip, ringorder_ds, ringorder_Ds, ringorder_ls, ringorder_M, ringorder_c, ringorder_C, ringorder_wp, ringorder_Wp, ringorder_ws, ringorder_Ws, ringorder_a, rRingOrder_t
from sage.libs.singular.decl cimport prCopyR
from sage.libs.singular.decl cimport n_unknown, n_algExt, n_transExt, n_Z, n_Zn, n_Znm, n_Z2m
from sage.libs.singular.decl cimport n_coeffType
Expand Down Expand Up @@ -60,7 +60,7 @@ order_dict = {
"dp": ringorder_dp,
"Dp": ringorder_Dp,
"lp": ringorder_lp,
"rp": ringorder_rp,
"ip": ringorder_ip,
"ds": ringorder_ds,
"Ds": ringorder_Ds,
"ls": ringorder_ls,
Expand Down
3 changes: 2 additions & 1 deletion src/sage/libs/singular/singular.pxd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sage.libs.singular.decl cimport ring, poly, number, intvec
from sage.libs.singular.decl cimport ring, poly, number, intvec, bigintmat
from sage.libs.singular.function cimport Resolution

from sage.rings.rational cimport Rational
Expand Down Expand Up @@ -29,6 +29,7 @@ cdef object si2sa_ZZmod(number *n, ring *_ring, object base) noexcept
cdef object si2sa_NF(number *n, ring *_ring, object base) noexcept

cdef object si2sa_intvec(intvec *v) noexcept
cdef object si2sa_bigintvec(bigintmat *v) noexcept

# dispatches to all the above.
cdef object si2sa(number *n, ring *_ring, object base) noexcept
Expand Down
19 changes: 19 additions & 0 deletions src/sage/libs/singular/singular.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,25 @@ cdef object si2sa_intvec(intvec *v) noexcept:
l.append(v.get(r))
return tuple(l)

cdef object si2sa_bigintvec(bigintmat *v) noexcept:
r"""
create a sage tuple from a singular vector of big integers
INPUT:
- ``v`` -- a (pointer to) singular bigintmat
OUTPUT:
a sage tuple
"""
cdef int r
cdef list l = list()
for r in range(v.length()):
n = v.get(r)
l.append(si2sa_QQ(n, &n, currRing))
return tuple(l)

# ==============
# Initialisation
# ==============
Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
polynomial ring, over a field, global ordering
// coefficients: ZZ/2[a]/(a^8+a^4+a^3+a^2+1)
// number of vars : 10
// block 1 : ordering rp
// block 1 : ordering ip
// : names x0 x1 x2 x3 x4 x5 x6 x7 x8 x9
// block 2 : ordering C
Expand All @@ -1294,7 +1294,7 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
polynomial ring, over a field, global ordering
// coefficients: ZZ/127
// number of vars : 2
// block 1 : ordering rp
// block 1 : ordering ip
// : names x0 x1
// block 2 : ordering C
Expand All @@ -1303,7 +1303,7 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base):
polynomial ring, over a field, global ordering
// coefficients: QQ
// number of vars : 2
// block 1 : ordering rp
// block 1 : ordering ip
// : names x0 x1
// block 2 : ordering C
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/term_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@

singular_name_mapping = {
'lex' : 'lp',
'invlex' : 'rp',
'invlex' : 'ip',
'degrevlex' : 'dp',
'deglex' : 'Dp',
'neglex' : 'ls',
Expand Down

0 comments on commit 713f73a

Please sign in to comment.