Changeset 5645:2537226feb05


Ignore:
Timestamp:
08/08/07 13:09:57 (6 years ago)
Author:
'Martin Albrecht <malb@…
Branch:
default
Message:

added libSINGULAR versions of std and slimgb Groebner basis computations
to get rid of conversion overhead for small GB calculations

Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • sage/libs/singular/singular-cdefs.pxi

    r5192 r5645  
    4040 
    4141    ctypedef struct napoly "polyrec" 
     42 
     43    cdef enum tHomog: 
     44        isNotHomog 
     45        isHomog 
     46        testHomog 
    4247 
    4348    cdef enum rRingOrder_t: 
     
    117122    ctypedef struct omBin "omBin_s" 
    118123 
    119     # numbers, i.e. coefficients 
    120      
    121  
    122124 
    123125    # SINGULAR Init 
     
    359361    void idShow(ideal *i) 
    360362    int IDELEMS(ideal *i) 
     363 
     364 
     365    void idSkipZeroes (ideal *ide) 
     366    long idRankFreeModule(ideal *m, ring *r) 
     367    ideal *kStd(ideal *i, ideal *q, tHomog h, intvec *w) 
     368    ideal *t_rep_gb(ring *r,ideal *arg_I, int syz_comp, int F4_mode) 
  • sage/rings/polynomial/multi_polynomial_ideal.py

    r5623 r5645  
    426426        return self.__groebner_basis 
    427427 
     428    def _groebner_basis_using_libsingular(self, algorithm="std"): 
     429        """ 
     430        Return a Groebner basis of this ideal. If a groebner basis for 
     431        this ideal has been calculated before the cached Groebner 
     432        basis is returned regardless of the requested algorithm. 
     433 
     434        ALGORITHM: Uses libSINGULAR. 
     435 
     436        INPUT: 
     437            algorithm -- 'std'      - Buchberger's algorithm 
     438                         'slimgb'   - SlimGB algorithm 
     439 
     440        EXAMPLES: 
     441 
     442        We compute a Groebner basis of 'cyclic 4' relative to 
     443        lexicographic ordering. 
     444         
     445            sage: R.<a,b,c,d> = PolynomialRing(QQ, 4, order='lex') 
     446            sage: I = sage.rings.ideal.Cyclic(R,4); I 
     447            Ideal (a + b + c + d, a*b + a*d + b*c + c*d, a*b*c + a*b*d + a*c*d + b*c*d, a*b*c*d - 1) of Polynomial Ring in a, b, c, d over Rational Field 
     448            sage: I._groebner_basis_using_libsingular() 
     449            [c^2*d^6 - c^2*d^2 - d^4 + 1, c^3*d^2 + c^2*d^3 - c - d, b*d^4 - b + d^5 - d, b*c - b*d^5 + c^2*d^4 + c*d - d^6 - d^2, b^2 + 2*b*d + d^2, a + b + c + d] 
     450        """ 
     451        from sage.rings.polynomial.multi_polynomial_ideal_libsingular import std_libsingular, slimgb_libsingular 
     452 
     453        try: 
     454            return self.__groebner_basis 
     455        except AttributeError: 
     456            if algorithm=="std": 
     457                S = std_libsingular(self) 
     458            elif algorithm=="slimgb": 
     459                S = slimgb_libsingular(self) 
     460            else: 
     461                raise TypeError, "algorithm '%s' unknown"%algorithm 
     462            self.__groebner_basis = S 
     463        return self.__groebner_basis 
     464 
    428465    def _singular_groebner_basis(self): 
    429466        try: 
     
    10401077        elif algorithm.startswith('singular:'): 
    10411078            return self._groebner_basis_using_singular(algorithm[9:]) 
     1079        elif algorithm.startswith('libsingular:'): 
     1080            return self._groebner_basis_using_libsingular(algorithm[len('libsingular:'):]) 
    10421081        elif algorithm == 'macaulay2:gb': 
    10431082            return self._macaulay2_groebner_basis() 
  • sage/rings/polynomial/multi_polynomial_libsingular.pxd

    r5615 r5645  
    2121    cdef ring *_ring 
    2222    cdef int _cmp_c_impl(left, Parent right) except -2 
     23 
  • setup.py

    r5620 r5645  
    425425    Extension('sage.rings.polynomial.multi_polynomial_libsingular', 
    426426              sources = ['sage/rings/polynomial/multi_polynomial_libsingular.pyx'], 
     427              libraries = ['gmp', 'm', 'readline', 'singular', 'singcf', 'singfac', 'omalloc', 'givaro', 'gmpxx'], 
     428              language="c++", 
     429              include_dirs=[SAGE_ROOT +'/local/include/singular']), \ 
     430 
     431    Extension('sage.rings.polynomial.multi_polynomial_ideal_libsingular', 
     432              sources = ['sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx'], 
    427433              libraries = ['gmp', 'm', 'readline', 'singular', 'singcf', 'singfac', 'omalloc', 'givaro', 'gmpxx'], 
    428434              language="c++", 
Note: See TracChangeset for help on using the changeset viewer.