Ticket #4539: plural_1.sage-4.4.4.patch

File plural_1.sage-4.4.4.patch, 3.3 KB (added by burcin, 6 years ago)

rebased to 4.4.4

  • 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  
    13021302              include_dirs = [SAGE_ROOT +'/local/include/singular'],
    13031303              depends = [SAGE_ROOT + "/local/include/libsingular.h"]),
    13041304
     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
    13051312    Extension('sage.rings.polynomial.multi_polynomial_libsingular',
    13061313              sources = ['sage/rings/polynomial/multi_polynomial_libsingular.pyx'],
    13071314              libraries = ['m', 'readline', 'singular', 'givaro', 'gmpxx', 'gmp'],
  • sage/libs/singular/singular-cdefs.pxi

    diff --git a/sage/libs/singular/singular-cdefs.pxi b/sage/libs/singular/singular-cdefs.pxi
    a b  
    999999
    10001000    cdef int LANG_TOP
    10011001
     1002# Plural functions
     1003   
     1004    int nc_CallPlural(matrix* CC, matrix* DD, poly* CN, poly* DN, ring* r)
     1005
    10021006cdef extern from "stairc.h":
    10031007    # Computes the monomial basis for R[x]/I
    10041008    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
    - +  
     1include "../../libs/singular/singular-cdefs.pxi"
     2
     3from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular, MPolynomial_libsingular
     4
     5cdef 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
    - +  
     1include "sage/ext/stdsage.pxi"
     2include "sage/ext/interrupt.pxi"
     3
     4cdef 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())