File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1402,6 +1402,13 @@ def _repr_(self):
14021402 if self ._name in s :
14031403 if self .get_custom_name () is None and self .type () == 'matrix' :
14041404 s = self .parent ().eval ('pmat(%s,20)' % (self .name ()))
1405+ # compatibility for singular 4.3.2p10 and before
1406+ if s .startswith ("polynomial ring," ):
1407+ from sage .rings .polynomial .term_order import singular_name_mapping
1408+ # this is our cue that singular uses `rp` instead of `ip`
1409+ if singular_name_mapping ['invlex' ] == 'rp' :
1410+ s = re .sub ('^(// .*block.* : ordering )rp$' , '\\ 1ip' ,
1411+ s , 0 , re .MULTILINE );
14051412 return s
14061413
14071414 def __copy__ (self ):
Original file line number Diff line number Diff line change @@ -49,6 +49,13 @@ cdef extern from "factory/factory.h":
4949 cdef int SW_USE_NTL_SORT
5050
5151cdef extern from " singular/Singular/libsingular.h" :
52+ """
53+ // compatibility for singular 4.3.2p10 and before
54+ #if SINGULAR_VERSION <= 4330
55+ #define ringorder_ip ringorder_rp
56+ #define BIGINTVEC_CMD INTVEC_CMD
57+ #endif
58+ """
5259
5360 #
5461 # OPTIONS
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ AUTHORS:
1717# https://www.gnu.org/licenses/
1818# ****************************************************************************
1919
20- from sage.cpython.string cimport str_to_bytes
20+ from sage.cpython.string cimport str_to_bytes, bytes_to_str
2121
2222from sage.libs.gmp.types cimport __mpz_struct
2323from sage.libs.gmp.mpz cimport mpz_init_set_ui
@@ -72,6 +72,16 @@ order_dict = {
7272 " a" : ringorder_a,
7373}
7474
75+ cdef extern from " singular/Singular/libsingular.h" :
76+ cdef char * rSimpleOrdStr(rRingOrder_t)
77+
78+ if bytes_to_str(rSimpleOrdStr(ringorder_ip)) == " rp" :
79+ # compatibility for singular 4.3.2p10 and before
80+ order_dict[" rp" ] = ringorder_ip
81+ # also patch term_order mappings
82+ from sage.rings.polynomial import term_order
83+ term_order.singular_name_mapping[' invlex' ] = ' rp'
84+ term_order.inv_singular_name_mapping[' rp' ] = ' invlex'
7585
7686# ############################################################################
7787cdef ring * singular_ring_new(base_ring, n, names, term_order) except NULL :
You can’t perform that action at this time.
0 commit comments