Ticket #4539: plural_1.sage4.4.4.patch
File plural_1.sage4.4.4.patch, 3.3 KB (added by , 7 years ago) 


module_list.py
# HG changeset patch # User Burcin Erocal <burcin@erocal.org> # Date 1223885551 7200 # Node ID 13d10923e377463ab5aebbd5c989c185fd5ad33a # Parent 6be6b5118fe7d90ce71eed8ffa00cc40ec18a17d Initial wrapper for plural. diff git a/module_list.py b/module_list.py
a b 1302 1302 include_dirs = [SAGE_ROOT +'/local/include/singular'], 1303 1303 depends = [SAGE_ROOT + "/local/include/libsingular.h"]), 1304 1304 1305 Extension('sage.rings.polynomial.plural', 1306 sources = ['sage/rings/polynomial/plural.pyx'], 1307 libraries = ['m', 'readline', 'singular', 'givaro', 'gmpxx', 'gmp'], 1308 language="c++", 1309 include_dirs = [SAGE_ROOT +'/local/include/singular'], 1310 depends = [SAGE_ROOT + "/local/include/libsingular.h"]), 1311 1305 1312 Extension('sage.rings.polynomial.multi_polynomial_libsingular', 1306 1313 sources = ['sage/rings/polynomial/multi_polynomial_libsingular.pyx'], 1307 1314 libraries = ['m', 'readline', 'singular', 'givaro', 'gmpxx', 'gmp'], 
sage/libs/singular/singularcdefs.pxi
diff git a/sage/libs/singular/singularcdefs.pxi b/sage/libs/singular/singularcdefs.pxi
a b 999 999 1000 1000 cdef int LANG_TOP 1001 1001 1002 # Plural functions 1003 1004 int nc_CallPlural(matrix* CC, matrix* DD, poly* CN, poly* DN, ring* r) 1005 1002 1006 cdef extern from "stairc.h": 1003 1007 # Computes the monomial basis for R[x]/I 1004 1008 ideal *scKBase(int deg, ideal *s, ideal *Q) 
new file sage/rings/polynomial/plural.pxd
diff git a/sage/rings/polynomial/plural.pxd b/sage/rings/polynomial/plural.pxd new file mode 100644
 + 1 include "../../libs/singular/singularcdefs.pxi" 2 3 from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular, MPolynomial_libsingular 4 5 cdef class MPolynomialRing_plural(MPolynomialRing_libsingular): 6 pass 7 
new file sage/rings/polynomial/plural.pyx
diff git a/sage/rings/polynomial/plural.pyx b/sage/rings/polynomial/plural.pyx new file mode 100644
 + 1 include "sage/ext/stdsage.pxi" 2 include "sage/ext/interrupt.pxi" 3 4 cdef class MPolynomialRing_plural(MPolynomialRing_libsingular): 5 def __init__(self, base_ring, n, names, order='degrevlex'): 6 MPolynomialRing_libsingular.__init__(self, base_ring, n, names, order) 7 8 cdef matrix* matc=mpNew(n,n) 9 cdef matrix* matd=mpNew(n,n) 10 11 for i from 0 <= i < n: 12 for j from i+1 <= j < n: 13 matc.m[n*i+j] = p_ISet(1, self._ring) 14 15 for i from 0 <= i < n: 16 for j from i+1 <= j < n: 17 matd.m[n*i+j] = p_ISet(1, self._ring) 18 19 nc_CallPlural(matc, matd, NULL, NULL, self._ring) 20 21 id_Delete(<ideal**>&matc, self._ring) 22 id_Delete(<ideal**>&matd, self._ring) 23 24 def _repr_(self): 25 """ 26 EXAMPLE: 27 sage: from sage.rings.polynomial.plural import MPolynomial_plural 28 sage: P = MPolynomialRing_plural(QQ, 2, 'x,y') 29 sage: P # indirect doctest 30 Multivariate Polynomial Ring in x, y over Rational Field 31 """ 32 #TODO: print the relations 33 varstr = ", ".join([ rRingVar(i,self._ring) for i in range(self.__ngens) ]) 34 return "Noncommutative Multivariate Polynomial Ring in %s over %s"%(varstr,self.base_ring())