Ticket #9583: trac_9583.patch

File trac_9583.patch, 46.5 KB (added by ddrake, 12 years ago)

backout attachment:trac1396-singular_options.2.patch

  • sage/interfaces/singular.py

    # HG changeset patch
    # User Dan Drake <drake@kaist.edu>
    # Date 1280131142 25200
    # Node ID 0433a0a6f6d7e6a00fc534fbab1061faebea672b
    # Parent  d8087a9cb7b6dfacc5e5595ed1da519b1b912dd3
    ticket 9583: backout ticket 1396
    
    This ticket is the inverse of
    http://trac.sagemath.org/sage_trac/attachment/ticket/1396/trac1396-singular_options.2.patch.
    The patch caused Sage to segfault on startup on t2.math, so for now
    we're pulling it out.
    
    diff --git a/sage/interfaces/singular.py b/sage/interfaces/singular.py
    a b  
    381381        self.option("redTail")
    382382        self.option("redThrough")
    383383        self.option("intStrategy")
    384         self._saved_options = self.option('get')
    385384
    386385    def __reduce__(self):
    387386        """
  • sage/libs/singular/option.pyx

    diff --git a/sage/libs/singular/option.pyx b/sage/libs/singular/option.pyx
    a b  
    1717By default, tail reductions are performed::
    1818
    1919    sage: from sage.libs.singular.option import opt, opt_ctx
    20     sage: opt['red_tail']
     20    sage: opt['redTail']
    2121    True
    2222    sage: std(I)[-1]
    2323    d^2*e^6 + 28*b*c*d + ...
     
    2525If we don't want this, we can create an option context, which disables
    2626this::
    2727
    28     sage: with opt_ctx(red_tail=False, red_sb=False):
     28    sage: with opt_ctx(redTail=False,redSB=False):
    2929    ...      std(I)[-1]
    3030    d^2*e^6 + 8*c^3 + ...
    3131
    3232However, this does not affect the global state::
    3333
    34     sage: opt['red_tail']
     34    sage: opt['redTail']
    3535    True
    3636
    3737On the other hand, any assignment to an option object will immediately
    3838change the global state::
    3939
    40     sage: opt['red_tail'] = False
    41     sage: opt['red_tail']
     40    sage: opt['redTail'] = False
     41    sage: opt['redTail']
    4242    False
    43     sage: opt['red_tail'] = True
    44     sage: opt['red_tail']
     43    sage: opt['redTail'] = True
     44    sage: opt['redTail']
    4545    True
    4646
    4747Assigning values within an option context, only affects this context::
    4848
    4949    sage: with opt_ctx:
    50     ...      opt['red_tail'] = False
     50    ...      opt['redTail'] = False
    5151
    52     sage: opt['red_tail']
     52    sage: opt['redTail']
    5353    True
    5454
    5555Option contexts can also be safely stacked::
    5656
    5757    sage: with opt_ctx:
    58     ...       opt['red_tail'] = False
     58    ...       opt['redTail'] = False
    5959    ...       print opt
    6060    ...       with opt_ctx:
    61     ...           opt['red_through'] = False
     61    ...           opt['redThrough'] = False
    6262    ...           print opt
    6363    ...
    6464    general options for libSingular (current value 0x00000082)
     
    6767    sage: print opt
    6868    general options for libSingular (current value 0x02000082)
    6969
    70 Furthermore, the integer valued options ``deg_bound`` and
    71 ``mult_bound`` can be used::
    72 
    73     sage: R.<x,y> = QQ[]
    74     sage: I = R*[x^3+y^2,x^2*y+1]
    75     sage: opt['deg_bound'] = 2
    76     sage: std(I)
    77     [x^2*y + 1, x^3 + y^2]
    78     sage: opt['deg_bound'] = 0
    79     sage: std(I)
    80     [y^3 - x, x^2*y + 1, x^3 + y^2]
    8170
    8271The same interface is available for verbosity options::
    8372
    8473    sage: from sage.libs.singular.option import opt_verb
    85     sage: opt_verb['not_warn_sb']
     74    sage: opt_verb['notWarnSB']
    8675    False
    87     sage: opt.reset_default()  # needed to avoid side effects
    88     sage: opt_verb.reset_default()  # needed to avoid side effects
    8976
    9077AUTHOR:
    9178
    9279- Martin Albrecht (2009-08): initial implementation
    9380- Martin Albrecht (2010-01): better interface, verbosity options
    94 - Simon King (2010-07): Python-ic option names; deg_bound and mult_bound
    9581"""
    9682#*****************************************************************************
    9783#       Copyright (C) 2010 Martin Albrecht <M.R.Albrecht@rhul.ac.uk>
     
    10086#                  http://www.gnu.org/licenses/
    10187#*****************************************************************************
    10288
    103 from sage.libs.singular.decl cimport singular_options, singular_verbose_options, Kstd1_deg, Kstd1_mu
     89from sage.libs.singular.decl cimport singular_options, singular_verbose_options
    10490
    105 from sage.libs.singular.decl cimport OPT_PROT, OPT_REDSB, OPT_NOT_BUCKETS, OPT_NOT_SUGAR, OPT_SUGARCRIT, OPT_REDTHROUGH, OPT_DEGBOUND, OPT_MULTBOUND
     91from sage.libs.singular.decl cimport OPT_PROT, OPT_REDSB, OPT_NOT_BUCKETS, OPT_NOT_SUGAR, OPT_SUGARCRIT, OPT_REDTHROUGH
    10692from sage.libs.singular.decl cimport OPT_RETURN_SB, OPT_FASTHC, OPT_OLDSTD, OPT_REDTAIL, OPT_INTSTRATEGY, OPT_NOTREGULARITY
    10793from sage.libs.singular.decl cimport OPT_WEIGHTM, Sy_bit
    10894
     
    11096from sage.libs.singular.decl cimport V_LOAD_PROC, V_DEF_RES, V_DEBUG_MEM, V_SHOW_USE, V_IMAP, V_PROMPT
    11197from sage.libs.singular.decl cimport V_NSB, V_CONTENTSB, V_CANCELUNIT, V_DEG_STOP
    11298
    113 _options_py_to_singular={'return_sb':'returnSB',
    114                          'fast_hc':'fastHC',
    115                          'inf_red_tail':'infRedTail',
    116                          'int_strategy':'intStrategy',
    117                          'not_regularity':'notRegularity',
    118                          'not_sugar':'notSugar',
    119                          'not_buckets':'notBuckets',
    120                          'qring_nf':'qringNF',
    121                          'redsb':'redSB',
    122                          'red_sb':'redSB',
    123                          'red_tail':'redTail',
    124                          'red_through':'redThrough',
    125                          'sugar_crit':'sugarCrit',
    126                          'weight_m':'weightM',
    127                          'content_sb':'contentSB',
    128                          'mult_bound':'multBound',
    129                          'deg_bound':'degBound',
    130                          'imap':'Imap',
    131                          'debug_lib':'debugLib',
    132                          'def_res':'defRes',
    133                          'load_lib':'loadLib',
    134                          'load_proc':'loadProc',
    135                          'not_warn_sb':'notWarnSB'}
    13699
    137100cdef class LibSingularOptions_abstract:
    138101    """
     
    157120            sage: opt['redTail'] = True
    158121            sage: opt['redTail']
    159122            True
    160             sage: opt['deg_bound'] = 2
    161 
    162         The options can be named in Python or Singular style::
    163 
    164             sage: opt['degBound']
    165             2
    166123        """
    167124        for k,v in kwds.iteritems():
    168125            self[k] = v
     
    172129        EXAMPLE::
    173130
    174131            sage: from sage.libs.singular.option import opt
    175             sage: opt['red_tail']
     132            sage: opt['redTail']
    176133            True
    177             sage: opt['deg_bound'] = 2
    178 
    179         The options can be named in Python or Singular style::
    180 
    181             sage: opt['degBound']
    182             2
    183             sage: opt.reset_default()  # needed to avoid side effects
    184134        """
    185         name = _options_py_to_singular.get(name,name)
    186         if name == "degBound":
    187             if bool(self.global_options[0] & self.name_map[name]):
    188                 return Kstd1_deg
    189             return int(0)
    190         if name == "multBound":
    191             if bool(self.global_options[0] & self.name_map[name]):
    192                 return Kstd1_mu
    193             return int(0)
    194135        try:
    195136            return bool(self.global_options[0] & self.name_map[name])
    196137        except KeyError:
     
    207148            ...      opt['redTail'] = False
    208149            ...      opt['redTail']
    209150            False
    210             sage: opt['red_tail']
    211             True
    212             sage: opt.reset_default()  # needed to avoid side effects
    213151        """
    214         name = _options_py_to_singular.get(name,name)
    215152        try:
    216153            if value:
    217154                self.global_options[0] = self.global_options[0] | self.name_map[name]
    218155            else:
    219156                self.global_options[0] = self.global_options[0] & ~self.name_map[name]
    220             if name == 'degBound':
    221                 global Kstd1_deg
    222                 Kstd1_deg = value
    223             elif name == 'multBound':
    224                 global Kstd1_mu
    225                 Kstd1_mu = value
    226157        except KeyError:
    227158            raise NameError("Option '%s' unknown."%(name,))
    228159
     
    232163
    233164            sage: from sage.libs.singular.option import opt
    234165            sage: hex(int(opt))
    235             '0x6000082'
     166            '0x2000082'
    236167        """
    237168        return int(self.global_options[0])
    238169
    239     def save(self):
    240         """
    241         Return a triple of integers that allow reconstruction of the options.
    242 
    243         EXAMPLE::
    244 
    245             sage: from sage.libs.singular.option import opt
    246             sage: opt['deg_bound']
    247             0
    248             sage: opt['red_tail']
    249             True
    250             sage: s = opt.save()
    251             sage: opt['deg_bound'] = 2
    252             sage: opt['red_tail'] = False
    253             sage: opt['deg_bound']
    254             2
    255             sage: opt['red_tail']
    256             False
    257             sage: opt.load(s)
    258             sage: opt['deg_bound']
    259             0
    260             sage: opt['red_tail']
    261             True
    262             sage: opt.reset_default()  # needed to avoid side effects
    263         """
    264         return (int(self.global_options[0]), self['deg_bound'], self['mult_bound'])
    265 
    266170    def load(self, value=None):
    267171        """
    268172        EXAMPLE::
    269173
    270174            sage: from sage.libs.singular.option import opt as sopt
    271             sage: bck = sopt.save(); hex(bck[0]), bck[1], bck[2]
    272             ('0x6000082', 0, 0)
     175            sage: bck = int(sopt); hex(bck)
     176            '0x2000082'
    273177            sage: sopt['redTail'] = False
    274178            sage: hex(int(sopt))
    275             '0x4000082'
     179            '0x82'
    276180            sage: sopt.load(bck)
    277181            sage: sopt['redTail']
    278182            True
    279183        """
    280         if value == None:
    281             value = (None,0,0)
    282         self.global_options[0] = int(value[0])
    283         global Kstd1_deg
    284         global Kstd1_mu
    285         Kstd1_deg = value[1]
    286         Kstd1_mu  = value[2]
     184        self.global_options[0] = int(value)
    287185
    288186    def __repr__(self):
    289187        """
     
    291189
    292190            sage: from sage.libs.singular.option import opt as sopt
    293191            sage: sopt
    294             general options for libSingular (current value 0x06000082)
     192            general options for libSingular (current value 0x02000082)
    295193        """
    296194        return "%s options for libSingular (current value 0x%08x)"%(self.name, self.global_options[0])
    297195
     
    302200
    303201    Supported options are:
    304202
    305      - ``return_sb`` or ``returnSB`` - the functions ``syz``,
    306        ``intersect``, ``quotient``, ``modulo`` return a standard
    307        base instead of a generating set if ``return_sb``
    308        is set. This option should not be used for ``lift``.
     203     - ``returnSB`` - the functions syz, intersect, quotient, modulo
     204       return a standard base instead of a generating set if returnSB
     205       is set. This option should not be used for lift.
    309206
    310      - ``fast_hc`` or ``fastHC`` - tries to find the highest corner
    311        of the staircase (HC) as fast as possible during a standard
    312        basis computation (only used for local orderings).
     207     - ``fastHC`` - tries to find the highest corner of the
     208       staircase (HC) as fast as possible during a standard basis
     209       computation (only used for local orderings).
    313210
    314      - ``int_strategy`` or ``intStrategy`` - avoids division of
    315        coefficients during standard basis computations. This option
    316        is ring dependent. By default, it is set for rings with
    317        characteristic 0 and not set for all other rings.
     211     - ``intStrategy`` - avoids division of coefficients during
     212       standard basis computations. This option is ring dependent. By
     213       default, it is set for rings with characteristic 0 and not set
     214       for all other rings.
    318215
    319216     - ``lazy`` - uses a more lazy approach in std computations, which
    320217       was used in SINGULAR version before 2-0 (and which may lead to
    321        faster or slower computations, depending on the example).
     218       faster or slower computations, depending on the example)
    322219
    323      - ``length`` - select shorter reducers in std computations.
     220     - ``length`` - select shorter reducers in std computations,
    324221
    325      - ``not_regularity`` or ``notRegularity`` - disables the
    326        regularity bound for ``res`` and ``mres``.
     222     - ``notRegularity`` - disables the regularity bound for ``res`` and
     223       ``mres`` (see regularity).
    327224
    328      - ``not_sugar`` or ``notSugar`` - disables the sugar strategy
    329        during standard basis computation.
     225     - ``notSugar`` - disables the sugar strategy during standard
     226       basis computation.
    330227
    331      - ``not_buckets`` or ``notBuckets`` - disables the bucket
    332        representation of polynomials during standard basis
    333        computations. This option usually decreases the memory
    334        usage but increases the computation time. It should only
    335        be set for memory-critical standard basis computations.
     228     - ``notBuckets`` - disables the bucket representation of
     229       polynomials during standard basis computations. This option
     230       usually decreases the memory usage but increases the
     231       computation time. It should only be set for memory-critical
     232       standard basis computations.
    336233
    337      - ``old_std`` or ``oldStd`` - uses a more lazy approach in std
    338        computations, which was used in SINGULAR version before 2-0
    339        (and which may lead to faster or slower computations, depending
    340        on the example).
     234     - ``oldStd`` - uses a more lazy approach in std computations,
     235       which was used in SINGULAR version before 2-0 (and which may
     236       lead to faster or slower computations, depending on the
     237       example)
    341238
    342239     - ``prot`` - shows protocol information indicating the progress
    343240       during the following computations: ``facstd``, ``fglm``,
    344241       ``groebner``, ``lres``, ``mres``, ``minres``, ``mstd``,
    345        ``res``, ``slimgb``, ``sres``, ``std``, ``stdfglm``,
     242       ``res``, ``slimgb``,``sres``, ``std``, ``stdfglm``,
    346243       ``stdhilb``, ``syz``.
    347244
    348      - `red_sb`` or ``redSB`` - computes a reduced standard basis in
    349        any standard basis computation.
     245     - ``redSB`` - computes a reduced standard basis in any standard
     246       basis computation.
    350247
    351      - ``red_tail`` or ``redTail`` - reduction of the tails of
    352        polynomials during standard basis computations. This option
    353        is ring dependent. By default, it is set for rings with global
    354        degree orderings and not set for all other rings.
     248     - ``redTail`` - reduction of the tails of polynomials during
     249       standard basis computations. This option is ring dependent. By
     250       default, it is set for rings with global degree orderings and
     251       not set for all other rings.
    355252
    356      - ``red_through`` or ``redThrough`` - for inhomogenous input,
    357        polynomial reductions during standard basis computations are
    358        never postponed, but always finished through. This option is
    359        ring dependent. By default, it is set for rings with global
    360        degree orderings and not set for all other rings.
     253     - ``redThrough`` - for inhomogenous input, polynomial reductions
     254       during standard basis computations are never postponed, but
     255       always finished through. This option is ring dependent. By
     256       default, it is set for rings with global degree orderings and
     257       not set for all other rings.
    361258
    362      - ``sugar_crit`` or ``sugarCrit`` - uses criteria similar to the
    363        homogeneous case to keep more useless pairs.
     259     - ``sugarCrit`` - uses criteria similar to the homogeneous case
     260       to keep more useless pairs.
    364261
    365      - ``weight_m`` or ``weightM`` - automatically computes suitable
    366        weights for the weighted ecart and the weighted sugar method.
    367    
    368     In addition, two integer valued parameters are supported, namely:
    369 
    370     - ``deg_bound`` or ``degBound`` - The standard basis computation
    371       is stopped if the total (weighted) degree exceeds ``deg_bound``.
    372       ``deg_bound`` should not be used for a global ordering with
    373       inhomogeneous input. Reset this bound by setting ``deg_bound``
    374       to 0. The exact meaning of "degree" depends on the ring odering
    375       and the command: ``slimgb`` uses always the total degree with
    376       weights 1, ``std`` does so for block orderings, only.
    377 
    378     - ``mult_bound`` or ``multBound`` - The standard basis computation
    379       is stopped if the ideal is zero-dimensional in a ring with local
    380       ordering and its multiplicity is lower than ``mult_bound``.
    381       Reset this bound by setting ``mult_bound`` to 0.
    382 
     262     - ``weightM`` - automatically computes suitable weights for the
     263       weighted ecart and the weighted sugar method.
     264               
    383265    EXAMPLE::
    384266
    385267        sage: from sage.libs.singular.option import LibSingularOptions
    386268        sage: libsingular_options = LibSingularOptions()
    387269        sage: libsingular_options
    388         general options for libSingular (current value 0x06000082)
    389 
    390     Here we demonstrate the intended way of using libSingular options::
    391 
    392         sage: R.<x,y> = QQ[]
    393         sage: I = R*[x^3+y^2,x^2*y+1]
    394         sage: I.groebner_basis(deg_bound=2)
    395         [x^3 + y^2, x^2*y + 1]
    396         sage: I.groebner_basis()
    397         [x^3 + y^2, x^2*y + 1, y^3 - x]
    398 
    399     The option ``mult_bound`` is only relevant in the local case::
    400 
    401         sage: Rlocal.<x,y,z> = PolynomialRing(QQ, order='ds')
    402         sage: x^2<x
    403         True
    404         sage: J = [x^7+y^7+z^6,x^6+y^8+z^7,x^7+y^5+z^8, x^2*y^3+y^2*z^3+x^3*z^2,x^3*y^2+y^3*z^2+x^2*z^3]*Rlocal
    405         sage: J.groebner_basis(mult_bound=100)
    406         [x^3*y^2 + y^3*z^2 + x^2*z^3, x^2*y^3 + x^3*z^2 + y^2*z^3, y^5, x^6 + x*y^4*z^5, x^4*z^2 - y^4*z^2 - x^2*y*z^3 + x*y^2*z^3, z^6 - x*y^4*z^4 - x^3*y*z^5]
    407         sage: J.groebner_basis()
    408         [x^3*y^2 + y^3*z^2 + x^2*z^3, x^2*y^3 + x^3*z^2 + y^2*z^3, y^5, x^6, x^4*z^2 - y^4*z^2 - x^2*y*z^3 + x*y^2*z^3, z^6, y^4*z^3 - y^3*z^4 - x^2*z^5, x^3*y*z^4 - x^2*y^2*z^4 + x*y^3*z^4, x^3*z^5, x^2*y*z^5 + y^3*z^5, x*y^3*z^5]
    409 
     270        general options for libSingular (current value 0x02000082)
    410271    """
    411272    def __init__(self, **kwds):
    412273        """
     
    417278            sage: from sage.libs.singular.option import LibSingularOptions
    418279            sage: libsingular_options = LibSingularOptions()
    419280            sage: libsingular_options
    420             general options for libSingular (current value 0x06000082)
     281            general options for libSingular (current value 0x02000082)
    421282        """
    422283        self.global_options = &singular_options
    423284        self.name = "general"
     
    433294                         "redTail":       Sy_bit(OPT_REDTAIL),
    434295                         "intStrategy":   Sy_bit(OPT_INTSTRATEGY),
    435296                         "notRegularity": Sy_bit(OPT_NOTREGULARITY),
    436                          "weightM":       Sy_bit(OPT_WEIGHTM),
    437                          "degBound":      Sy_bit(OPT_DEGBOUND),
    438                          "multBound":     Sy_bit(OPT_MULTBOUND)}
     297                         "weightM":       Sy_bit(OPT_WEIGHTM)}
    439298        LibSingularOptions_abstract.__init__(self, **kwds)
    440299
    441     def reset_default(self):
    442         """
    443         Reset libSingular's default options.
    444 
    445         EXAMPLE::
    446 
    447             sage: from sage.libs.singular.option import opt
    448             sage: opt['red_tail']
    449             True
    450             sage: opt['red_tail'] = False
    451             sage: opt['red_tail']
    452             False
    453             sage: opt['deg_bound']
    454             0
    455             sage: opt['deg_bound'] = 2
    456             sage: opt['deg_bound']
    457             2
    458             sage: opt.reset_default()
    459             sage: opt['red_tail']
    460             True
    461             sage: opt['deg_bound']
    462             0
    463         """
    464         from sage.libs.singular.singular import _saved_options
    465         self.load(_saved_options)
    466 
    467 
    468300
    469301#############
    470302
     
    474306
    475307    Supported options are:
    476308
    477      - ``mem`` - shows memory usage in square brackets.
    478      - ``yacc`` - Only available in debug version.
    479      - ``redefine`` - warns about variable redefinitions.
    480      - ``reading`` - shows the number of characters read from a file.
    481      - ``loadLib`` or ``load_lib`` - shows loading of libraries.
    482      - ``debugLib`` or ``debug_lib`` - warns about syntax errors
    483        when loading a library.
    484      - ``loadProc`` or ``load_proc`` - shows loading of procedures
    485        from libraries.
    486      - ``defRes`` or ``def_res`` - shows the names of the syzygy
    487        modules while converting ``resolution`` to ``list``.
    488      - ``usage`` - shows correct usage in error messages.
    489      - ``Imap`` or ``imap`` - shows the mapping of variables with
    490        the ``fetch`` and ``imap`` commands.
    491      - ``notWarnSB`` or ``not_warn_sb`` - do not warn if
    492        a basis is not a standard basis
    493      - ``contentSB`` or ``content_sb`` - avoids to divide by the
    494        content of a polynomial in ``std`` and related algorithms.
    495        Should usually not be used.
    496      - ``cancelunit`` - avoids to divide polynomials by non-constant
    497        units in ``std`` in the local case. Should usually not be used.
    498          
     309     - ``mem`` -
     310     - ``yacc`` -
     311     - ``redefine`` -
     312     - ``reading`` -
     313     - ``loadLib`` -
     314     - ``debugLib`` -
     315     - ``loadProc`` -
     316     - ``defRes`` -
     317     - ``debugMem`` -
     318     - ``usage`` -
     319     - ``Imap`` -
     320     - ``prompt`` -
     321     - ``notWarnSB`` - do not warn if a basis is not a standard basis
     322     - ``contentSB`` -
     323     - ``cancelunit`` -
     324               
    499325    EXAMPLE::
    500326
    501327        sage: from sage.libs.singular.option import LibSingularVerboseOptions
     
    524350                         "debugLib": Sy_bit(V_DEBUG_LIB),
    525351                         "loadProc": Sy_bit(V_LOAD_PROC),
    526352                         "defRes":   Sy_bit(V_DEF_RES),   
    527                          #"debugMem": Sy_bit(V_DEBUG_MEM),
     353                         "debugMem": Sy_bit(V_DEBUG_MEM),
    528354                         "usage":    Sy_bit(V_SHOW_USE), 
    529355                         "Imap":     Sy_bit(V_IMAP),     
    530                          #"prompt":   Sy_bit(V_PROMPT),   
    531                          "notWarnSB":Sy_bit(V_NSB),
     356                         "prompt":   Sy_bit(V_PROMPT),   
     357                         "notWarnSB":Sy_bit(V_NSB),       
    532358                         "contentSB":Sy_bit(V_CONTENTSB),
    533                          "cancelunit":Sy_bit(V_CANCELUNIT)
     359                         "cancelunit":Sy_bit(V_CANCELUNIT),
    534360                         }
    535361        LibSingularOptions_abstract.__init__(self, **kwds)
    536362
    537     def reset_default(self):
    538         """
    539         Return to libSingular's default verbosity options
    540 
    541         EXAMPLE::
    542 
    543             sage: from sage.libs.singular.option import opt_verb
    544             sage: opt_verb['not_warn_sb']
    545             False
    546             sage: opt_verb['not_warn_sb'] = True
    547             sage: opt_verb['not_warn_sb']
    548             True
    549             sage: opt_verb.reset_default()
    550             sage: opt_verb['not_warn_sb']
    551             False
    552 
    553         """
    554         from sage.libs.singular.singular import _saved_verbose_options
    555         self.global_options[0] = int(_saved_verbose_options)
    556 
    557363cdef class LibSingularOptionsContext:
    558364    """
    559365    Option context
     
    564370
    565371        sage: from sage.libs.singular.option import opt, opt_ctx
    566372        sage: opt
    567         general options for libSingular (current value 0x06000082)
     373        general options for libSingular (current value 0x02000082)
    568374
    569375    ::
    570376
     
    573379        ...       with opt_ctx(redThrough=False):
    574380        ...           print opt
    575381        ...
    576         general options for libSingular (current value 0x04000082)
    577         general options for libSingular (current value 0x04000002)
     382        general options for libSingular (current value 0x00000082)
     383        general options for libSingular (current value 0x00000002)
    578384
    579385        sage: print opt
    580         general options for libSingular (current value 0x06000082)
     386        general options for libSingular (current value 0x02000082)
    581387    """
    582388    cdef list bck
    583     cdef list bck_degBound
    584     cdef list bck_multBound
    585389    cdef public LibSingularOptions_abstract opt
    586390    cdef object options
    587391
     
    596400            general options context for libSingular
    597401        """
    598402        self.bck = []
    599         self.bck_degBound = []
    600         self.bck_multBound = []
    601403        self.options = kwds
    602404        self.opt = opt
    603405
     
    613415            False
    614416        """
    615417        self.bck.append(self.opt.global_options[0])
    616         self.bck_degBound.append(Kstd1_deg)
    617         self.bck_multBound.append(Kstd1_mu)
    618418        opt = self.opt.__class__()
    619419        for k,v in self.options.iteritems():
    620420            opt[k] = v
     
    647447            False
    648448        """
    649449        self.opt.global_options[0] = self.bck.pop()
    650         global Kstd1_deg
    651         global Kstd1_mu
    652         Kstd1_deg = self.bck_degBound.pop()
    653         Kstd1_mu  = self.bck_multBound.pop()
    654450
    655451    def __repr__(self):
    656452        """
     
    664460
    665461
    666462opt = LibSingularOptions()
    667 opt.reset_default()
    668463opt_verb = LibSingularVerboseOptions()
    669 opt_verb.reset_default()
    670464opt_ctx = LibSingularOptionsContext(opt)
    671465opt_verb_ctx = LibSingularOptionsContext(opt_verb)
  • sage/libs/singular/singular-cdefs.pxi

    diff --git a/sage/libs/singular/singular-cdefs.pxi b/sage/libs/singular/singular-cdefs.pxi
    a b  
    1414cdef extern from "stdlib.h":
    1515    void delete "delete" (void *ptr)
    1616
     17
    1718cdef extern from "factory.h":
    1819
    1920    #
     
    996997        leftv  *m
    997998        void (*Init)(int n)
    998999
    999 cdef extern from "kstd1.h":
    1000     cdef extern int Kstd1_deg   # degBound, default 0
    1001     cdef extern int Kstd1_mu    # multBound, default 0
    1002 
    10031000cdef extern from "intvec.h":
    10041001    # for the moment we need only new, as we use the cleanup of sleftv
    10051002    # to get rid of it again
  • sage/libs/singular/singular.pyx

    diff --git a/sage/libs/singular/singular.pyx b/sage/libs/singular/singular.pyx
    a b  
    2626from sage.misc.misc_c import is_64_bit
    2727
    2828from sage.libs.singular.decl cimport intvec
    29 from sage.libs.singular.decl cimport SR_HDL, SR_INT, SR_TO_INT, singular_options, singular_verbose_options
     29from sage.libs.singular.decl cimport SR_HDL, SR_INT, SR_TO_INT, singular_options
    3030from sage.libs.singular.decl cimport On, Off, SW_USE_NTL, SW_USE_NTL_GCD_0, SW_USE_EZGCD, SW_USE_NTL_SORT, SW_USE_NTL_GCD_P
    3131from sage.libs.singular.decl cimport napoly, lnumber, Sy_bit, OPT_REDSB, OPT_INTSTRATEGY, OPT_REDTAIL, OPT_REDTHROUGH
    3232from sage.libs.singular.decl cimport nlGetNom, nlGetDenom, nlDelete, nlInit2gmp
     
    4848from sage.structure.parent_base cimport ParentWithBase
    4949from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomial_libsingular
    5050
    51 _saved_options = (int(0),0,0)
    52 
    5351cdef Rational si2sa_QQ(number *n, ring *_ring):
    5452    """
    5553    TESTS::
     
    647645    far is to load the library again and to specify ``RTLD_GLOBAL``.
    648646    """
    649647    global singular_options
    650     global singular_verbose_options
    651648    global max_exponent_size
    652649
    653650    cdef void *handle = NULL
     
    670667
    671668    dlclose(handle)
    672669
    673     # we set and save some global Singular options
     670    # we set some global Singular options
    674671    singular_options = singular_options | Sy_bit(OPT_REDSB) | Sy_bit(OPT_INTSTRATEGY) | Sy_bit(OPT_REDTAIL) | Sy_bit(OPT_REDTHROUGH)
    675     global _saved_options
    676     global _saved_verbose_options
    677     _saved_options = (int(singular_options), 0, 0)
    678     _saved_verbose_options = int(singular_verbose_options)
    679 
     672       
    680673    On(SW_USE_NTL)
    681674    On(SW_USE_NTL_GCD_0)
    682675    On(SW_USE_NTL_GCD_P)
  • sage/rings/polynomial/multi_polynomial_ideal.py

    diff --git a/sage/rings/polynomial/multi_polynomial_ideal.py b/sage/rings/polynomial/multi_polynomial_ideal.py
    a b  
    244244import sage.rings.polynomial.toy_variety as toy_variety
    245245import sage.rings.polynomial.toy_d_basis as toy_d_basis
    246246
    247 class LibSingularDefaultContext:
    248     def __init__(self, singular=singular_default):
    249         from sage.libs.singular.option import opt_ctx
    250         self.libsingular_option_context = opt_ctx
    251     def __enter__(self):
    252         """
    253         EXAMPLE::
    254 
    255             sage: from sage.rings.polynomial.multi_polynomial_ideal import SingularDefaultContext
    256             sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
    257             sage: I = sage.rings.ideal.Katsura(P,3)
    258             sage: singular.option('noredTail')
    259             sage: singular.option('noredThrough')
    260             sage: Is = I._singular_()
    261             sage: with SingularDefaultContext(): rgb = Is.groebner()
    262             sage: rgb
    263             84*c^4-40*c^3+c^2+c,
    264             7*b+210*c^3-79*c^2+3*c,
    265             7*a-420*c^3+158*c^2+8*c-7
    266         """
    267         self.libsingular_option_context.__enter__()
    268         self.libsingular_option_context.opt.reset_default()
    269         self.libsingular_option_context.opt['red_sb'] = True
    270         self.libsingular_option_context.opt['red_tail'] = True
    271         self.libsingular_option_context.opt['deg_bound'] = 0
    272         self.libsingular_option_context.opt['mult_bound'] = 0
    273 
    274     def __exit__(self, typ, value, tb):
    275         """
    276         EXAMPLE::
    277 
    278             sage: from sage.rings.polynomial.multi_polynomial_ideal import SingularDefaultContext
    279             sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
    280             sage: I = sage.rings.ideal.Katsura(P,3)
    281             sage: singular.option('noredTail')
    282             sage: singular.option('noredThrough')
    283             sage: Is = I._singular_()
    284             sage: with SingularDefaultContext(): rgb = Is.groebner()
    285             sage: rgb
    286             84*c^4-40*c^3+c^2+c,
    287             7*b+210*c^3-79*c^2+3*c,
    288             7*a-420*c^3+158*c^2+8*c-7
    289         """
    290         self.libsingular_option_context.__exit__(typ,value,tb)
    291 
    292 
    293 class SingularDefaultContext:
     247class RedSBContext:
    294248    """
    295249    Within this context all Singular Groebner basis calculations are
    296250    reduced automatically.
     
    298252    AUTHORS:
    299253
    300254    - Martin Albrecht
    301     - Simon King
    302255    """
    303256    def __init__(self, singular=singular_default):
    304257        """
     
    311264       
    312265        EXAMPLE::
    313266       
    314             sage: from sage.rings.polynomial.multi_polynomial_ideal import SingularDefaultContext
     267            sage: from sage.rings.polynomial.multi_polynomial_ideal import RedSBContext
    315268            sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
    316269            sage: I = sage.rings.ideal.Katsura(P,3)
    317270            sage: singular.option('noredTail')
     
    326279        ::
    327280       
    328281            sage: from __future__ import with_statement
    329             sage: with SingularDefaultContext(): rgb = Is.groebner()
     282            sage: with RedSBContext(): rgb = Is.groebner()
    330283            sage: rgb
    331284            84*c^4-40*c^3+c^2+c,
    332285            7*b+210*c^3-79*c^2+3*c,
     
    346299           Groebner basis is computed so the user does not need to use
    347300           it manually.
    348301        """
     302        from sage.libs.singular.option import opt_ctx
    349303        self.singular = singular
     304        self.libsingular_option_context = opt_ctx
    350305
    351306    def __enter__(self):
    352307        """
    353308        EXAMPLE::
    354309       
    355             sage: from sage.rings.polynomial.multi_polynomial_ideal import SingularDefaultContext
     310            sage: from sage.rings.polynomial.multi_polynomial_ideal import RedSBContext
    356311            sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
    357312            sage: I = sage.rings.ideal.Katsura(P,3)
    358313            sage: singular.option('noredTail')
    359314            sage: singular.option('noredThrough')
    360315            sage: Is = I._singular_()
    361             sage: with SingularDefaultContext(): rgb = Is.groebner()
     316            sage: with RedSBContext(): rgb = Is.groebner()
    362317            sage: rgb
    363318            84*c^4-40*c^3+c^2+c,
    364319            7*b+210*c^3-79*c^2+3*c,
    365320            7*a-420*c^3+158*c^2+8*c-7
    366321        """
    367         try:
    368             self.bck_degBound = int(self.singular.eval('degBound'))
    369         except RuntimeError:
    370             self.bck_degBound = int(0)
    371         try:
    372             self.bck_multBound = int(self.singular.eval('multBound'))
    373         except RuntimeError:
    374             self.bck_multBound = int(0)
    375322        self.o = self.singular.option("get")
    376         self.singular.option('set',self.singular._saved_options)
    377323        self.singular.option("redSB")
    378         self.singular.option("redTail")
    379         try:
    380             self.singular.eval('degBound=0')
    381         except RuntimeError:
    382             pass
    383         try:
    384             self.singular.eval('multBound=0')
    385         except RuntimeError:
    386             pass
     324        self.libsingular_option_context.__enter__()
     325        self.libsingular_option_context.opt['redSB'] = True
     326        self.libsingular_option_context.opt['redTail'] = True
    387327
    388328    def __exit__(self, typ, value, tb):
    389329        """
    390330        EXAMPLE::
    391331       
    392             sage: from sage.rings.polynomial.multi_polynomial_ideal import SingularDefaultContext
     332            sage: from sage.rings.polynomial.multi_polynomial_ideal import RedSBContext
    393333            sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
    394334            sage: I = sage.rings.ideal.Katsura(P,3)
    395335            sage: singular.option('noredTail')
    396336            sage: singular.option('noredThrough')
    397337            sage: Is = I._singular_()
    398             sage: with SingularDefaultContext(): rgb = Is.groebner()
     338            sage: with RedSBContext(): rgb = Is.groebner()
    399339            sage: rgb
    400340            84*c^4-40*c^3+c^2+c,
    401341            7*b+210*c^3-79*c^2+3*c,
    402342            7*a-420*c^3+158*c^2+8*c-7
    403343        """
    404344        self.singular.option("set",self.o)
    405         try:
    406             self.singular.eval('degBound=%d'%self.bck_degBound)
    407         except RuntimeError:
    408             pass
    409         try:
    410             self.singular.eval('multBound=%d'%self.bck_multBound)
    411         except RuntimeError:
    412             pass
     345        self.libsingular_option_context.__exit__(typ,value,tb)
    413346
    414 def singular_standard_options(func):
     347def redSB(func):
    415348    """
    416349    Decorator to force a reduced Singular groebner basis.
    417350   
     
    430363    """
    431364    def wrapper(*args, **kwds):
    432365        """
    433         Execute function in ``SingularDefaultContext``.
     366        Execute function in ``RedSBContext``.
    434367        """
    435         with SingularDefaultContext():
     368        with RedSBContext():
    436369            return func(*args, **kwds)
    437370
    438371    from sage.misc.sageinspect import sage_getsource
     
    441374    wrapper.__doc__ = func.__doc__
    442375    return wrapper
    443376
    444 def libsingular_standard_options(func):
    445     """
    446     Decorator to force a reduced Singular groebner basis.
    447 
    448     TESTS::
    449 
    450         sage: P.<a,b,c,d,e> = PolynomialRing(GF(127))
    451         sage: J = sage.rings.ideal.Cyclic(P).homogenize()
    452         sage: from sage.misc.sageinspect import sage_getsource
    453         sage: "buchberger" in sage_getsource(J.interreduced_basis)
    454         True
    455 
    456     .. note::
    457 
    458        This decorator is used automatically internally so the user
    459        does not need to use it manually.
    460     """
    461     def wrapper(*args, **kwds):
    462         """
    463         Execute function in ``LibSingularDefaultContext``.
    464         """
    465         with LibSingularDefaultContext():
    466             return func(*args, **kwds)
    467 
    468     from sage.misc.sageinspect import sage_getsource
    469     wrapper._sage_src_ = lambda: sage_getsource(func)
    470     wrapper.__name__ = func.__name__
    471     wrapper.__doc__ = func.__doc__
    472     return wrapper
    473 
    474377class RequireField(MethodDecorator):
    475378    """
    476379    Decorator which throws an exception if a computation over a
     
    705608        I.plot()
    706609
    707610    @require_field
    708     @libsingular_standard_options
     611    @redSB
    709612    def complete_primary_decomposition(self, algorithm="sy"):
    710613        r"""
    711614        Return a list of primary ideals and their associated primes such
     
    869772        return [I for I, _ in self.complete_primary_decomposition(algorithm)]
    870773
    871774    @require_field
     775    @redSB
    872776    def associated_primes(self, algorithm='sy'):
    873777        r"""
    874778        Return a list of the associated primes of primary ideals of
     
    933837        return [P for _,P in self.complete_primary_decomposition(algorithm)]
    934838           
    935839    @require_field
    936     @singular_standard_options
    937     @libsingular_standard_options
    938840    def triangular_decomposition(self, algorithm=None, singular=singular_default):
    939841        """
    940842        Decompose zero-dimensional ideal ``self`` into triangular
     
    11811083        else:
    11821084            return vd
    11831085
    1184     @singular_standard_options
     1086    @redSB
    11851087    def _groebner_basis_singular(self, algorithm="groebner", *args, **kwds):
    11861088        """
    11871089        Return the reduced Groebner basis of this ideal. If the
     
    12441146        S =  Sequence([R(S[i+1]) for i in range(len(S))], R, check=False, immutable=True)
    12451147        return S
    12461148
    1247     @cached_method
    12481149    def _groebner_basis_singular_raw(self, algorithm="groebner", singular=singular_default, *args, **kwds):
    12491150        r"""
    12501151        Return a Groebner basis in Singular format.
     
    12581159            b*d^4 - b + d^5 - d, b*c - b*d + c^2*d^4 + c*d - 2*d^2,
    12591160            b^2 + 2*b*d + d^2, a + b + c + d]
    12601161        """
    1261         #try:
    1262         #    return self.__gb_singular
    1263         #except AttributeError:
    1264         #    pass
    1265         # singular options are preserved by @singular_standard_options,
    1266         # so we don't eed to do that here too
    1267         from sage.libs.singular.option import _options_py_to_singular
    1268         S = self._singular_()   # for degBound, we need to ensure
    1269                                 # that a ring is defined
    1270         for o,v in kwds.iteritems():
    1271             o = _options_py_to_singular.get(o,o)
    1272             if v:
    1273                 if o in ['degBound','multBound']:
    1274                     singular.eval(o+'=%d'%v)
    1275                 else:
    1276                     singular.option(o)
    1277             else:
    1278                 if o in ['degBound','multBound']:
    1279                     singular.eval(o+'=0')
    1280                 else:
    1281                     singular.option("no"+o)
     1162        try:
     1163            return self.__gb_singular
     1164        except AttributeError:
     1165            pass
     1166        # singular options are preserved by @redSB so we don't
     1167        # need to do that here too
     1168        for o,v in kwds.iteritems():
     1169            if v:
     1170                singular.option(o)
     1171            else:
     1172                singular.option("no"+o)
    12821173
    12831174        if algorithm=="groebner":
    12841175            S = self._singular_().groebner()
     
    12951186        self.__gb_singular = S
    12961187        return S
    12971188
    1298     @libsingular_standard_options
    1299     def _groebner_basis_libsingular(self, algorithm="groebner", *args, **kwds):
     1189    @redSB
     1190    def _groebner_basis_libsingular(self, algorithm="groebner", redsb=True, red_tail=True):
    13001191        """
    13011192        Return the reduced Groebner basis of this ideal. If the
    13021193        Groebner basis for this ideal has been calculated before the
     
    13521243
    13531244        import sage.libs.singular
    13541245        groebner = sage.libs.singular.ff.groebner
    1355         from sage.all import get_verbose
    13561246
    1357         if get_verbose()>=2:
    1358             opt['prot'] = True
    1359         for name,value in kwds.iteritems():
    1360             if value is not None:
    1361                 opt[name] = value
     1247        opt['redSB'] = redsb
     1248        opt['redTail'] = red_tail
    13621249
    13631250        T = self.ring().term_order()
    13641251       
     
    14101297            self.__genus = Integer(genus(self))
    14111298            return self.__genus
    14121299
    1413     @libsingular_standard_options
     1300    @redSB
    14141301    def intersection(self, other):
    14151302        """
    14161303        Return the intersection of the two ideals.
     
    14461333        return R.ideal(K)
    14471334
    14481335    @require_field
    1449     @libsingular_standard_options
     1336    @redSB
    14501337    def minimal_associated_primes(self):
    14511338        """
    14521339        OUTPUT:
     
    14741361        return [R.ideal(J) for J in M]
    14751362
    14761363    @require_field
    1477     @libsingular_standard_options
     1364    @redSB
    14781365    def radical(self):
    14791366        r"""
    14801367        The radical of this ideal.
     
    15271414        return S.ideal(r)
    15281415
    15291416    @require_field
    1530     @libsingular_standard_options
     1417    @redSB
    15311418    def integral_closure(self, p=0, r=True, singular=singular_default):
    15321419        """
    15331420        Let `I` = ``self``.
     
    15541441            sage: I.integral_closure()
    15551442            [x^2, y^5, -x*y^3]
    15561443       
    1557         ALGORITHM: Use libSingular
     1444        ALGORITHM: Use Singular
    15581445        """
    15591446        R = self.ring()
    15601447        import sage.libs.singular
     
    15921479        S = syz(self)
    15931480        return matrix(self.ring(), S)
    15941481
     1482    @redSB
    15951483    def reduced_basis(self):
    15961484        r"""
    15971485        .. warning::
     
    16351523        deprecation("This function is deprecated. It will be removed in a future release of Sage. Please use the interreduced_basis() function instead.")
    16361524        return self.interreduced_basis()
    16371525
    1638     @singular_standard_options
    1639     @libsingular_standard_options
     1526    @redSB
    16401527    def interreduced_basis(self):
    16411528        r"""
    16421529        If this ideal is spanned by `(f_1, ..., f_n)` this method
     
    17031590        return ret
    17041591
    17051592    @cached_method
    1706     @singular_standard_options
    17071593    def basis_is_groebner(self, singular=singular_default):
    17081594        r"""
    17091595        Returns ``True`` if the generators of this ideal
     
    18091695        return True
    18101696
    18111697    @require_field
    1812     @singular_standard_options
    1813     @libsingular_standard_options
     1698    @redSB
    18141699    def transformed_basis(self, algorithm="gwalk", other_ring=None, singular=singular_default):
    18151700        """
    18161701        Returns a lex or ``other_ring`` Groebner Basis for this ideal.
     
    19031788        else:
    19041789            raise TypeError, "Cannot convert basis with given algorithm"
    19051790
    1906     @libsingular_standard_options
     1791    @redSB
    19071792    def elimination_ideal(self, variables):
    19081793        r"""
    19091794        Returns the elimination ideal this ideal with respect to the
     
    19381823        Is = MPolynomialIdeal(R,self.groebner_basis())
    19391824        return MPolynomialIdeal(R, eliminate(Is, prod(variables)) )
    19401825
    1941     @libsingular_standard_options
     1826    @redSB
    19421827    def quotient(self, J):
    19431828        r"""
    19441829        Given ideals `I` = ``self`` and `J` in the same polynomial
     
    25202405                                        symmetry=symmetry, verbose=verbose)
    25212406
    25222407    @cached_method
    2523     def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, *args, **kwds):
     2408    def groebner_basis(self, algorithm='', *args, **kwds):
    25242409        """
    2525         Return the reduced Groebner basis of this ideal.
    2526 
    2527         A Groebner basis `g_1,...,g_n` for an ideal `I` is a
    2528         generating set such that `<LM(g_i)> = LM(I)`, i.e.,
    2529         the leading monomial ideal of `I` is spanned by the
    2530         leading terms of `g_1,...,g_n`. Groebner bases are
    2531         the key concept in computational ideal theory in
    2532         multivariate polynomial rings which allows a variety
    2533         of problems to be solved.
    2534 
     2410        Return the reduced Groebner basis of this ideal. A Groebner
     2411        basis `g_1,...,g_n` for an ideal `I` is a basis such that
     2412        `<LM(g_i)> = LM(I)`, i.e., the leading monomial ideal of
     2413        `I` is spanned by the leading terms of
     2414        `g_1,...,g_n`. Groebner bases are the key concept in
     2415        computational ideal theory in multivariate polynomial rings
     2416        which allows a variety of problems to be solved.
    25352417        Additionally, a *reduced* Groebner basis `G` is a unique
    2536         representation for the ideal `<G>` with respect to the
    2537         chosen monomial ordering.
     2418        representation for the ideal `<G>` with respect to the chosen
     2419        monomial ordering.
    25382420       
    25392421        INPUT:
    25402422       
     
    26842566            sage: I.groebner_basis('magma:GroebnerBasis') # optional - magma
    26852567            [a - 60*c^3 + 158/7*c^2 + 8/7*c - 1, b + 30*c^3 - 79/7*c^2 + 3/7*c, c^4 - 10/21*c^3 + 1/84*c^2 + 1/84*c]
    26862568       
    2687         Singular and libSingular can compute Groebner basis with degree
    2688         restrictions::
    2689 
    2690             sage: R.<x,y> = QQ[]
    2691             sage: I = R*[x^3+y^2,x^2*y+1]
    2692             sage: I.groebner_basis(algorithm='singular')
    2693             [x^3 + y^2, x^2*y + 1, y^3 - x]
    2694             sage: I.groebner_basis(algorithm='singular',deg_bound=2)
    2695             [x^3 + y^2, x^2*y + 1]
    2696             sage: I.groebner_basis()
    2697             [x^3 + y^2, x^2*y + 1, y^3 - x]
    2698             sage: I.groebner_basis(deg_bound=2)
    2699             [x^3 + y^2, x^2*y + 1]
    2700 
    2701         In the case of libSingular, a protocol is printed, if the
    2702         verbosity level is at least 2, or if the argument ``prot``
    2703         is provided. For some reason, the protocol does not appear
    2704         during doctests, so, we skip the examples with protocol
    2705         output.
    2706         ::
    2707 
    2708             sage: set_verbose(2)
    2709             sage: I = R*[x^3+y^2,x^2*y+1]
    2710             sage: I.groebner_basis()  # not tested
    2711             std in (0),(x,y),(dp(2),C)
    2712             [4294967295:2]3ss4s6
    2713             (S:2)--
    2714             product criterion:1 chain criterion:0
    2715             [x^3 + y^2, x^2*y + 1, y^3 - x]
    2716             sage: I.groebner_basis(prot=False)
    2717             [x^3 + y^2, x^2*y + 1, y^3 - x]
    2718             sage: set_verbose(0)
    2719             sage: I.groebner_basis(prot=True)  # not tested
    2720             std in (0),(x,y),(dp(2),C)
    2721             [4294967295:2]3ss4s6
    2722             (S:2)--
    2723             product criterion:1 chain criterion:0
    2724             [x^3 + y^2, x^2*y + 1, y^3 - x]
    2725 
    2726         The list of available options is provided at
    2727         :class:`~sage.libs.singular.option.LibSingularOptions`.
    2728 
    27292569        Groebner bases over `\ZZ` can be computed. ::
    27302570       
    27312571            sage: P.<a,b,c> = PolynomialRing(ZZ,3)
     
    28082648
    28092649        if algorithm is '':
    28102650            try:
    2811                 gb = self._groebner_basis_libsingular("groebner", deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
     2651                gb = self._groebner_basis_libsingular("groebner", *args, **kwds)
    28122652            except (TypeError,NameError), msg: # conversion to Singular not supported
    28132653                try:
    2814                     gb = self._groebner_basis_singular("groebner", deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
     2654                    gb = self._groebner_basis_singular("groebner", *args, **kwds)
    28152655                except (TypeError,NameError), msg: # conversion to Singular not supported
    28162656                    if self.ring().term_order().is_global() and is_IntegerModRing(self.ring().base_ring()) and not self.ring().base_ring().is_field():
    28172657                        verbose("Warning: falling back to very slow toy implementation.", level=0)
     
    28322672                            raise TypeError, "Local/unknown orderings not supported by 'toy_buchberger' implementation."
    28332673
    28342674        elif algorithm.startswith('singular:'):
    2835             gb = self._groebner_basis_singular(algorithm[9:], deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
     2675            gb = self._groebner_basis_singular(algorithm[9:])
    28362676        elif algorithm.startswith('libsingular:'):
    2837             gb = self._groebner_basis_libsingular(algorithm[len('libsingular:'):], deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
     2677            gb = self._groebner_basis_libsingular(algorithm[len('libsingular:'):], *args, **kwds)
    28382678        elif algorithm == 'macaulay2:gb':
    28392679            gb = self._groebner_basis_macaulay2(*args, **kwds)
    28402680        elif algorithm == 'magma:GroebnerBasis':