Ticket #9599: trac_9599.patch

File trac_9599.patch, 45.8 KB (added by malb, 11 years ago)
  • sage/interfaces/singular.py

    # HG changeset patch
    # User Simon King <simon.king@nuigalway.ie>
    # Date 1279223562 -3600
    # Node ID f43f11d9444eaaaa093257d6a83efb9d011fd1db
    # Parent  8485225018572f38a74c2c39c404873da376daf3
    #1396 and #9599 Allow Singular's options in libSingular
    use a method decorator to ensure default options unless requested otherwise.
    
    diff -r 848522501857 -r f43f11d9444e 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')
    384385
    385386    def __reduce__(self):
    386387        """
  • sage/libs/singular/option.pyx

    diff -r 848522501857 -r f43f11d9444e 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['redTail']
     20    sage: opt['red_tail']
    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(redTail=False,redSB=False):
     28    sage: with opt_ctx(red_tail=False, red_sb=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['redTail']
     34    sage: opt['red_tail']
    3535    True
    3636
    3737On the other hand, any assignment to an option object will immediately
    3838change the global state::
    3939
    40     sage: opt['redTail'] = False
    41     sage: opt['redTail']
     40    sage: opt['red_tail'] = False
     41    sage: opt['red_tail']
    4242    False
    43     sage: opt['redTail'] = True
    44     sage: opt['redTail']
     43    sage: opt['red_tail'] = True
     44    sage: opt['red_tail']
    4545    True
    4646
    4747Assigning values within an option context, only affects this context::
    4848
    4949    sage: with opt_ctx:
    50     ...      opt['redTail'] = False
     50    ...      opt['red_tail'] = False
    5151
    52     sage: opt['redTail']
     52    sage: opt['red_tail']
    5353    True
    5454
    5555Option contexts can also be safely stacked::
    5656
    5757    sage: with opt_ctx:
    58     ...       opt['redTail'] = False
     58    ...       opt['red_tail'] = False
    5959    ...       print opt
    6060    ...       with opt_ctx:
    61     ...           opt['redThrough'] = False
     61    ...           opt['red_through'] = 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
     70Furthermore, 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]
    7081
    7182The same interface is available for verbosity options::
    7283
    7384    sage: from sage.libs.singular.option import opt_verb
    74     sage: opt_verb['notWarnSB']
     85    sage: opt_verb['not_warn_sb']
    7586    False
     87    sage: opt.reset_default()  # needed to avoid side effects
     88    sage: opt_verb.reset_default()  # needed to avoid side effects
    7689
    7790AUTHOR:
    7891
    7992- Martin Albrecht (2009-08): initial implementation
    8093- Martin Albrecht (2010-01): better interface, verbosity options
     94- Simon King (2010-07): Python-ic option names; deg_bound and mult_bound
    8195"""
    8296#*****************************************************************************
    8397#       Copyright (C) 2010 Martin Albrecht <M.R.Albrecht@rhul.ac.uk>
     
    86100#                  http://www.gnu.org/licenses/
    87101#*****************************************************************************
    88102
    89 from sage.libs.singular.decl cimport singular_options, singular_verbose_options
     103from sage.libs.singular.decl cimport singular_options, singular_verbose_options, Kstd1_deg, Kstd1_mu
    90104
    91 from sage.libs.singular.decl cimport OPT_PROT, OPT_REDSB, OPT_NOT_BUCKETS, OPT_NOT_SUGAR, OPT_SUGARCRIT, OPT_REDTHROUGH
     105from sage.libs.singular.decl cimport OPT_PROT, OPT_REDSB, OPT_NOT_BUCKETS, OPT_NOT_SUGAR, OPT_SUGARCRIT, OPT_REDTHROUGH, OPT_DEGBOUND, OPT_MULTBOUND
    92106from sage.libs.singular.decl cimport OPT_RETURN_SB, OPT_FASTHC, OPT_OLDSTD, OPT_REDTAIL, OPT_INTSTRATEGY, OPT_NOTREGULARITY
    93107from sage.libs.singular.decl cimport OPT_WEIGHTM, Sy_bit
    94108
     
    96110from sage.libs.singular.decl cimport V_LOAD_PROC, V_DEF_RES, V_SHOW_USE, V_IMAP, V_PROMPT
    97111from sage.libs.singular.decl cimport V_NSB, V_CONTENTSB, V_CANCELUNIT, V_DEG_STOP
    98112
     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'}
    99136
    100137cdef class LibSingularOptions_abstract:
    101138    """
     
    120157            sage: opt['redTail'] = True
    121158            sage: opt['redTail']
    122159            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
    123166        """
    124167        for k,v in kwds.iteritems():
    125168            self[k] = v
     
    129172        EXAMPLE::
    130173
    131174            sage: from sage.libs.singular.option import opt
    132             sage: opt['redTail']
     175            sage: opt['red_tail']
    133176            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
    134184        """
     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)
    135194        try:
    136195            return bool(self.global_options[0] & self.name_map[name])
    137196        except KeyError:
     
    148207            ...      opt['redTail'] = False
    149208            ...      opt['redTail']
    150209            False
     210            sage: opt['red_tail']
     211            True
     212            sage: opt.reset_default()  # needed to avoid side effects
    151213        """
     214        name = _options_py_to_singular.get(name,name)
    152215        try:
    153216            if value:
    154217                self.global_options[0] = self.global_options[0] | self.name_map[name]
    155218            else:
    156219                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
    157226        except KeyError:
    158227            raise NameError("Option '%s' unknown."%(name,))
    159228
     
    163232
    164233            sage: from sage.libs.singular.option import opt
    165234            sage: hex(int(opt))
    166             '0x2000082'
     235            '0x6000082'
    167236        """
    168237        return int(self.global_options[0])
    169238
     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
    170266    def load(self, value=None):
    171267        """
    172268        EXAMPLE::
    173269
    174270            sage: from sage.libs.singular.option import opt as sopt
    175             sage: bck = int(sopt); hex(bck)
    176             '0x2000082'
     271            sage: bck = sopt.save(); hex(bck[0]), bck[1], bck[2]
     272            ('0x6000082', 0, 0)
    177273            sage: sopt['redTail'] = False
    178274            sage: hex(int(sopt))
    179             '0x82'
     275            '0x4000082'
    180276            sage: sopt.load(bck)
    181277            sage: sopt['redTail']
    182278            True
    183279        """
    184         self.global_options[0] = int(value)
     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]
    185287
    186288    def __repr__(self):
    187289        """
     
    189291
    190292            sage: from sage.libs.singular.option import opt as sopt
    191293            sage: sopt
    192             general options for libSingular (current value 0x02000082)
     294            general options for libSingular (current value 0x06000082)
    193295        """
    194296        return "%s options for libSingular (current value 0x%08x)"%(self.name, self.global_options[0])
    195297
     
    200302
    201303    Supported options are:
    202304
    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.
     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``.
    206309
    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).
     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).
    210313
    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.
     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.
    215318
    216319     - ``lazy`` - uses a more lazy approach in std computations, which
    217320       was used in SINGULAR version before 2-0 (and which may lead to
    218        faster or slower computations, depending on the example)
     321       faster or slower computations, depending on the example).
    219322
    220      - ``length`` - select shorter reducers in std computations,
     323     - ``length`` - select shorter reducers in std computations.
    221324
    222      - ``notRegularity`` - disables the regularity bound for ``res`` and
    223        ``mres`` (see regularity).
     325     - ``not_regularity`` or ``notRegularity`` - disables the
     326       regularity bound for ``res`` and ``mres``.
    224327
    225      - ``notSugar`` - disables the sugar strategy during standard
    226        basis computation.
     328     - ``not_sugar`` or ``notSugar`` - disables the sugar strategy
     329       during standard basis computation.
    227330
    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.
     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.
    233336
    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)
     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).
    238341
    239342     - ``prot`` - shows protocol information indicating the progress
    240343       during the following computations: ``facstd``, ``fglm``,
    241344       ``groebner``, ``lres``, ``mres``, ``minres``, ``mstd``,
    242        ``res``, ``slimgb``,``sres``, ``std``, ``stdfglm``,
     345       ``res``, ``slimgb``, ``sres``, ``std``, ``stdfglm``,
    243346       ``stdhilb``, ``syz``.
    244347
    245      - ``redSB`` - computes a reduced standard basis in any standard
    246        basis computation.
     348     - `red_sb`` or ``redSB`` - computes a reduced standard basis in
     349       any standard basis computation.
    247350
    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.
     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.
    252355
    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.
     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.
    258361
    259      - ``sugarCrit`` - uses criteria similar to the homogeneous case
    260        to keep more useless pairs.
     362     - ``sugar_crit`` or ``sugarCrit`` - uses criteria similar to the
     363       homogeneous case to keep more useless pairs.
    261364
    262      - ``weightM`` - automatically computes suitable weights for the
    263        weighted ecart and the weighted sugar method.
    264                
     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
    265383    EXAMPLE::
    266384
    267385        sage: from sage.libs.singular.option import LibSingularOptions
    268386        sage: libsingular_options = LibSingularOptions()
    269387        sage: libsingular_options
    270         general options for libSingular (current value 0x02000082)
     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
    271410    """
    272411    def __init__(self, **kwds):
    273412        """
     
    278417            sage: from sage.libs.singular.option import LibSingularOptions
    279418            sage: libsingular_options = LibSingularOptions()
    280419            sage: libsingular_options
    281             general options for libSingular (current value 0x02000082)
     420            general options for libSingular (current value 0x06000082)
    282421        """
    283422        self.global_options = &singular_options
    284423        self.name = "general"
     
    294433                         "redTail":       Sy_bit(OPT_REDTAIL),
    295434                         "intStrategy":   Sy_bit(OPT_INTSTRATEGY),
    296435                         "notRegularity": Sy_bit(OPT_NOTREGULARITY),
    297                          "weightM":       Sy_bit(OPT_WEIGHTM)}
     436                         "weightM":       Sy_bit(OPT_WEIGHTM),
     437                         "degBound":      Sy_bit(OPT_DEGBOUND),
     438                         "multBound":     Sy_bit(OPT_MULTBOUND)}
    298439        LibSingularOptions_abstract.__init__(self, **kwds)
    299440
     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
    300468
    301469#############
    302470
     
    306474
    307475    Supported options are:
    308476
    309      - ``mem`` -
    310      - ``yacc`` -
    311      - ``redefine`` -
    312      - ``reading`` -
    313      - ``loadLib`` -
    314      - ``debugLib`` -
    315      - ``loadProc`` -
    316      - ``defRes`` -
    317      - ``usage`` -
    318      - ``Imap`` -
    319      - ``prompt`` -
    320      - ``notWarnSB`` - do not warn if a basis is not a standard basis
    321      - ``contentSB`` -
    322      - ``cancelunit`` -
     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.
    323498               
    324499    EXAMPLE::
    325500
     
    358533                         }
    359534        LibSingularOptions_abstract.__init__(self, **kwds)
    360535
     536    def reset_default(self):
     537        """
     538        Return to libSingular's default verbosity options
     539
     540        EXAMPLE::
     541
     542            sage: from sage.libs.singular.option import opt_verb
     543            sage: opt_verb['not_warn_sb']
     544            False
     545            sage: opt_verb['not_warn_sb'] = True
     546            sage: opt_verb['not_warn_sb']
     547            True
     548            sage: opt_verb.reset_default()
     549            sage: opt_verb['not_warn_sb']
     550            False
     551
     552        """
     553        from sage.libs.singular.singular import _saved_verbose_options
     554        self.global_options[0] = int(_saved_verbose_options)
     555
    361556cdef class LibSingularOptionsContext:
    362557    """
    363558    Option context
     
    368563
    369564        sage: from sage.libs.singular.option import opt, opt_ctx
    370565        sage: opt
    371         general options for libSingular (current value 0x02000082)
     566        general options for libSingular (current value 0x06000082)
    372567
    373568    ::
    374569
     
    377572        ...       with opt_ctx(redThrough=False):
    378573        ...           print opt
    379574        ...
    380         general options for libSingular (current value 0x00000082)
    381         general options for libSingular (current value 0x00000002)
     575        general options for libSingular (current value 0x04000082)
     576        general options for libSingular (current value 0x04000002)
    382577
    383578        sage: print opt
    384         general options for libSingular (current value 0x02000082)
     579        general options for libSingular (current value 0x06000082)
    385580    """
    386581    cdef list bck
     582    cdef list bck_degBound
     583    cdef list bck_multBound
    387584    cdef public LibSingularOptions_abstract opt
    388585    cdef object options
    389586
     
    398595            general options context for libSingular
    399596        """
    400597        self.bck = []
     598        self.bck_degBound = []
     599        self.bck_multBound = []
    401600        self.options = kwds
    402601        self.opt = opt
    403602
     
    413612            False
    414613        """
    415614        self.bck.append(self.opt.global_options[0])
     615        self.bck_degBound.append(Kstd1_deg)
     616        self.bck_multBound.append(Kstd1_mu)
    416617        opt = self.opt.__class__()
    417618        for k,v in self.options.iteritems():
    418619            opt[k] = v
     
    445646            False
    446647        """
    447648        self.opt.global_options[0] = self.bck.pop()
     649        global Kstd1_deg
     650        global Kstd1_mu
     651        Kstd1_deg = self.bck_degBound.pop()
     652        Kstd1_mu  = self.bck_multBound.pop()
    448653
    449654    def __repr__(self):
    450655        """
     
    458663
    459664
    460665opt = LibSingularOptions()
     666opt.reset_default()
    461667opt_verb = LibSingularVerboseOptions()
     668opt_verb.reset_default()
    462669opt_ctx = LibSingularOptionsContext(opt)
    463670opt_verb_ctx = LibSingularOptionsContext(opt_verb)
  • sage/libs/singular/singular-cdefs.pxi

    diff -r 848522501857 -r f43f11d9444e sage/libs/singular/singular-cdefs.pxi
    a b  
    1414cdef extern from "stdlib.h":
    1515    void delete "delete" (void *ptr)
    1616
    17 
    1817cdef extern from "factory.h":
    1918
    2019    #
     
    996995        leftv  *m
    997996        void (*Init)(int n)
    998997
     998cdef extern from "kstd1.h":
     999    cdef extern int Kstd1_deg   # degBound, default 0
     1000    cdef extern int Kstd1_mu    # multBound, default 0
     1001
    9991002cdef extern from "intvec.h":
    10001003    # for the moment we need only new, as we use the cleanup of sleftv
    10011004    # to get rid of it again
  • sage/libs/singular/singular.pyx

    diff -r 848522501857 -r f43f11d9444e 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
     29from sage.libs.singular.decl cimport SR_HDL, SR_INT, SR_TO_INT, singular_options, singular_verbose_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 nlGetNumerator, nlGetDenom, nlDelete, nlInit2gmp
     
    4949from sage.structure.parent_base cimport ParentWithBase
    5050from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomial_libsingular
    5151
     52_saved_options = (int(0),0,0)
     53
    5254cdef Rational si2sa_QQ(number *n, ring *_ring):
    5355    """
    5456    TESTS::
     
    646648    far is to load the library again and to specify ``RTLD_GLOBAL``.
    647649    """
    648650    global singular_options
     651    global singular_verbose_options
    649652    global max_exponent_size
    650653    global WerrorS_callback
    651654    global error_messages
     
    670673
    671674    dlclose(handle)
    672675
    673     # we set some global Singular options
     676    # we set and save some global Singular options
    674677    singular_options = singular_options | Sy_bit(OPT_REDSB) | Sy_bit(OPT_INTSTRATEGY) | Sy_bit(OPT_REDTAIL) | Sy_bit(OPT_REDTHROUGH)
    675        
     678    global _saved_options
     679    global _saved_verbose_options
     680    _saved_options = (int(singular_options), 0, 0)
     681    _saved_verbose_options = int(singular_verbose_options)
     682
    676683    On(SW_USE_NTL)
    677684    On(SW_USE_NTL_GCD_0)
    678685    On(SW_USE_NTL_GCD_P)
  • sage/rings/polynomial/multi_polynomial_ideal.py

    diff -r 848522501857 -r f43f11d9444e 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 RedSBContext:
     247class 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
     293class SingularDefaultContext:
    248294    """
    249295    Within this context all Singular Groebner basis calculations are
    250296    reduced automatically.
     
    252298    AUTHORS:
    253299
    254300    - Martin Albrecht
     301    - Simon King
    255302    """
    256303    def __init__(self, singular=singular_default):
    257304        """
     
    264311       
    265312        EXAMPLE::
    266313       
    267             sage: from sage.rings.polynomial.multi_polynomial_ideal import RedSBContext
     314            sage: from sage.rings.polynomial.multi_polynomial_ideal import SingularDefaultContext
    268315            sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
    269316            sage: I = sage.rings.ideal.Katsura(P,3)
    270317            sage: singular.option('noredTail')
     
    279326        ::
    280327       
    281328            sage: from __future__ import with_statement
    282             sage: with RedSBContext(): rgb = Is.groebner()
     329            sage: with SingularDefaultContext(): rgb = Is.groebner()
    283330            sage: rgb
    284331            84*c^4-40*c^3+c^2+c,
    285332            7*b+210*c^3-79*c^2+3*c,
     
    299346           Groebner basis is computed so the user does not need to use
    300347           it manually.
    301348        """
    302         from sage.libs.singular.option import opt_ctx
    303349        self.singular = singular
    304         self.libsingular_option_context = opt_ctx
    305350
    306351    def __enter__(self):
    307352        """
    308353        EXAMPLE::
    309354       
    310             sage: from sage.rings.polynomial.multi_polynomial_ideal import RedSBContext
     355            sage: from sage.rings.polynomial.multi_polynomial_ideal import SingularDefaultContext
    311356            sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
    312357            sage: I = sage.rings.ideal.Katsura(P,3)
    313358            sage: singular.option('noredTail')
    314359            sage: singular.option('noredThrough')
    315360            sage: Is = I._singular_()
    316             sage: with RedSBContext(): rgb = Is.groebner()
     361            sage: with SingularDefaultContext(): rgb = Is.groebner()
    317362            sage: rgb
    318363            84*c^4-40*c^3+c^2+c,
    319364            7*b+210*c^3-79*c^2+3*c,
    320365            7*a-420*c^3+158*c^2+8*c-7
    321366        """
     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)
    322375        self.o = self.singular.option("get")
     376        self.singular.option('set',self.singular._saved_options)
    323377        self.singular.option("redSB")
    324         self.libsingular_option_context.__enter__()
    325         self.libsingular_option_context.opt['redSB'] = True
    326         self.libsingular_option_context.opt['redTail'] = True
     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
    327387
    328388    def __exit__(self, typ, value, tb):
    329389        """
    330390        EXAMPLE::
    331391       
    332             sage: from sage.rings.polynomial.multi_polynomial_ideal import RedSBContext
     392            sage: from sage.rings.polynomial.multi_polynomial_ideal import SingularDefaultContext
    333393            sage: P.<a,b,c> = PolynomialRing(QQ,3, order='lex')
    334394            sage: I = sage.rings.ideal.Katsura(P,3)
    335395            sage: singular.option('noredTail')
    336396            sage: singular.option('noredThrough')
    337397            sage: Is = I._singular_()
    338             sage: with RedSBContext(): rgb = Is.groebner()
     398            sage: with SingularDefaultContext(): rgb = Is.groebner()
    339399            sage: rgb
    340400            84*c^4-40*c^3+c^2+c,
    341401            7*b+210*c^3-79*c^2+3*c,
    342402            7*a-420*c^3+158*c^2+8*c-7
    343403        """
    344404        self.singular.option("set",self.o)
    345         self.libsingular_option_context.__exit__(typ,value,tb)
    346 
    347 def redSB(func):
     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
     413
     414def singular_standard_options(func):
    348415    """
    349416    Decorator to force a reduced Singular groebner basis.
    350417   
     
    363430    """
    364431    def wrapper(*args, **kwds):
    365432        """
    366         Execute function in ``RedSBContext``.
     433        Execute function in ``SingularDefaultContext``.
    367434        """
    368         with RedSBContext():
     435        with SingularDefaultContext():
    369436            return func(*args, **kwds)
    370437
    371438    from sage.misc.sageinspect import sage_getsource
     
    374441    wrapper.__doc__ = func.__doc__
    375442    return wrapper
    376443
     444def 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
    377474class RequireField(MethodDecorator):
    378475    """
    379476    Decorator which throws an exception if a computation over a
     
    608705        I.plot()
    609706
    610707    @require_field
    611     @redSB
     708    @libsingular_standard_options
    612709    def complete_primary_decomposition(self, algorithm="sy"):
    613710        r"""
    614711        Return a list of primary ideals and their associated primes such
     
    772869        return [I for I, _ in self.complete_primary_decomposition(algorithm)]
    773870
    774871    @require_field
    775     @redSB
    776872    def associated_primes(self, algorithm='sy'):
    777873        r"""
    778874        Return a list of the associated primes of primary ideals of
     
    837933        return [P for _,P in self.complete_primary_decomposition(algorithm)]
    838934           
    839935    @require_field
     936    @singular_standard_options
     937    @libsingular_standard_options
    840938    def triangular_decomposition(self, algorithm=None, singular=singular_default):
    841939        """
    842940        Decompose zero-dimensional ideal ``self`` into triangular
     
    10831181        else:
    10841182            return vd
    10851183
    1086     @redSB
     1184    @singular_standard_options
    10871185    def _groebner_basis_singular(self, algorithm="groebner", *args, **kwds):
    10881186        """
    10891187        Return the reduced Groebner basis of this ideal. If the
     
    11461244        S =  Sequence([R(S[i+1]) for i in range(len(S))], R, check=False, immutable=True)
    11471245        return S
    11481246
     1247    @cached_method
    11491248    def _groebner_basis_singular_raw(self, algorithm="groebner", singular=singular_default, *args, **kwds):
    11501249        r"""
    11511250        Return a Groebner basis in Singular format.
     
    11591258            b*d^4 - b + d^5 - d, b*c - b*d + c^2*d^4 + c*d - 2*d^2,
    11601259            b^2 + 2*b*d + d^2, a + b + c + d]
    11611260        """
    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)
     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)
    11731282
    11741283        if algorithm=="groebner":
    11751284            S = self._singular_().groebner()
     
    11861295        self.__gb_singular = S
    11871296        return S
    11881297
    1189     @redSB
    1190     def _groebner_basis_libsingular(self, algorithm="groebner", redsb=True, red_tail=True):
     1298    @libsingular_standard_options
     1299    def _groebner_basis_libsingular(self, algorithm="groebner", *args, **kwds):
    11911300        """
    11921301        Return the reduced Groebner basis of this ideal. If the
    11931302        Groebner basis for this ideal has been calculated before the
     
    12431352
    12441353        import sage.libs.singular
    12451354        groebner = sage.libs.singular.ff.groebner
    1246 
    1247         opt['redSB'] = redsb
    1248         opt['redTail'] = red_tail
     1355        from sage.all import get_verbose
     1356
     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
    12491362
    12501363        T = self.ring().term_order()
    12511364       
     
    12971410            self.__genus = Integer(genus(self))
    12981411            return self.__genus
    12991412
    1300     @redSB
     1413    @libsingular_standard_options
    13011414    def intersection(self, other):
    13021415        """
    13031416        Return the intersection of the two ideals.
     
    13331446        return R.ideal(K)
    13341447
    13351448    @require_field
    1336     @redSB
     1449    @libsingular_standard_options
    13371450    def minimal_associated_primes(self):
    13381451        """
    13391452        OUTPUT:
     
    13611474        return [R.ideal(J) for J in M]
    13621475
    13631476    @require_field
    1364     @redSB
     1477    @libsingular_standard_options
    13651478    def radical(self):
    13661479        r"""
    13671480        The radical of this ideal.
     
    14141527        return S.ideal(r)
    14151528
    14161529    @require_field
    1417     @redSB
     1530    @libsingular_standard_options
    14181531    def integral_closure(self, p=0, r=True, singular=singular_default):
    14191532        """
    14201533        Let `I` = ``self``.
     
    14411554            sage: I.integral_closure()
    14421555            [x^2, y^5, -x*y^3]
    14431556       
    1444         ALGORITHM: Use Singular
     1557        ALGORITHM: Use libSingular
    14451558        """
    14461559        R = self.ring()
    14471560        import sage.libs.singular
     
    14791592        S = syz(self)
    14801593        return matrix(self.ring(), S)
    14811594
    1482     @redSB
    14831595    def reduced_basis(self):
    14841596        r"""
    14851597        .. warning::
     
    15231635        deprecation("This function is deprecated. It will be removed in a future release of Sage. Please use the interreduced_basis() function instead.")
    15241636        return self.interreduced_basis()
    15251637
    1526     @redSB
     1638    @singular_standard_options
     1639    @libsingular_standard_options
    15271640    def interreduced_basis(self):
    15281641        r"""
    15291642        If this ideal is spanned by `(f_1, ..., f_n)` this method
     
    15901703        return ret
    15911704
    15921705    @cached_method
     1706    @singular_standard_options
    15931707    def basis_is_groebner(self, singular=singular_default):
    15941708        r"""
    15951709        Returns ``True`` if the generators of this ideal
     
    16951809        return True
    16961810
    16971811    @require_field
    1698     @redSB
     1812    @singular_standard_options
     1813    @libsingular_standard_options
    16991814    def transformed_basis(self, algorithm="gwalk", other_ring=None, singular=singular_default):
    17001815        """
    17011816        Returns a lex or ``other_ring`` Groebner Basis for this ideal.
     
    17881903        else:
    17891904            raise TypeError, "Cannot convert basis with given algorithm"
    17901905
    1791     @redSB
     1906    @libsingular_standard_options
    17921907    def elimination_ideal(self, variables):
    17931908        r"""
    17941909        Returns the elimination ideal this ideal with respect to the
     
    18231938        Is = MPolynomialIdeal(R,self.groebner_basis())
    18241939        return MPolynomialIdeal(R, eliminate(Is, prod(variables)) )
    18251940
    1826     @redSB
     1941    @libsingular_standard_options
    18271942    def quotient(self, J):
    18281943        r"""
    18291944        Given ideals `I` = ``self`` and `J` in the same polynomial
     
    24142529                                        symmetry=symmetry, verbose=verbose)
    24152530
    24162531    @cached_method
    2417     def groebner_basis(self, algorithm='', *args, **kwds):
     2532    def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, *args, **kwds):
    24182533        """
    2419         Return the reduced Groebner basis of this ideal. A Groebner
    2420         basis `g_1,...,g_n` for an ideal `I` is a basis such that
    2421         `<LM(g_i)> = LM(I)`, i.e., the leading monomial ideal of
    2422         `I` is spanned by the leading terms of
    2423         `g_1,...,g_n`. Groebner bases are the key concept in
    2424         computational ideal theory in multivariate polynomial rings
    2425         which allows a variety of problems to be solved.
     2534        Return the reduced Groebner basis of this ideal.
     2535
     2536        A Groebner basis `g_1,...,g_n` for an ideal `I` is a
     2537        generating set such that `<LM(g_i)> = LM(I)`, i.e.,
     2538        the leading monomial ideal of `I` is spanned by the
     2539        leading terms of `g_1,...,g_n`. Groebner bases are
     2540        the key concept in computational ideal theory in
     2541        multivariate polynomial rings which allows a variety
     2542        of problems to be solved.
     2543
    24262544        Additionally, a *reduced* Groebner basis `G` is a unique
    2427         representation for the ideal `<G>` with respect to the chosen
    2428         monomial ordering.
     2545        representation for the ideal `<G>` with respect to the
     2546        chosen monomial ordering.
    24292547       
    24302548        INPUT:
    24312549       
     
    25752693            sage: I.groebner_basis('magma:GroebnerBasis') # optional - magma
    25762694            [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]
    25772695       
     2696        Singular and libSingular can compute Groebner basis with degree
     2697        restrictions::
     2698
     2699            sage: R.<x,y> = QQ[]
     2700            sage: I = R*[x^3+y^2,x^2*y+1]
     2701            sage: I.groebner_basis(algorithm='singular')
     2702            [x^3 + y^2, x^2*y + 1, y^3 - x]
     2703            sage: I.groebner_basis(algorithm='singular',deg_bound=2)
     2704            [x^3 + y^2, x^2*y + 1]
     2705            sage: I.groebner_basis()
     2706            [x^3 + y^2, x^2*y + 1, y^3 - x]
     2707            sage: I.groebner_basis(deg_bound=2)
     2708            [x^3 + y^2, x^2*y + 1]
     2709
     2710        In the case of libSingular, a protocol is printed, if the
     2711        verbosity level is at least 2, or if the argument ``prot``
     2712        is provided. For some reason, the protocol does not appear
     2713        during doctests, so, we skip the examples with protocol
     2714        output.
     2715        ::
     2716
     2717            sage: set_verbose(2)
     2718            sage: I = R*[x^3+y^2,x^2*y+1]
     2719            sage: I.groebner_basis()  # 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            sage: I.groebner_basis(prot=False)
     2726            [x^3 + y^2, x^2*y + 1, y^3 - x]
     2727            sage: set_verbose(0)
     2728            sage: I.groebner_basis(prot=True)  # not tested
     2729            std in (0),(x,y),(dp(2),C)
     2730            [4294967295:2]3ss4s6
     2731            (S:2)--
     2732            product criterion:1 chain criterion:0
     2733            [x^3 + y^2, x^2*y + 1, y^3 - x]
     2734
     2735        The list of available options is provided at
     2736        :class:`~sage.libs.singular.option.LibSingularOptions`.
     2737
    25782738        Groebner bases over `\ZZ` can be computed. ::
    25792739       
    25802740            sage: P.<a,b,c> = PolynomialRing(ZZ,3)
     
    26572817
    26582818        if algorithm is '':
    26592819            try:
    2660                 gb = self._groebner_basis_libsingular("groebner", *args, **kwds)
     2820                gb = self._groebner_basis_libsingular("groebner", deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
    26612821            except (TypeError,NameError), msg: # conversion to Singular not supported
    26622822                try:
    2663                     gb = self._groebner_basis_singular("groebner", *args, **kwds)
     2823                    gb = self._groebner_basis_singular("groebner", deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
    26642824                except (TypeError,NameError), msg: # conversion to Singular not supported
    26652825                    if self.ring().term_order().is_global() and is_IntegerModRing(self.ring().base_ring()) and not self.ring().base_ring().is_field():
    26662826                        verbose("Warning: falling back to very slow toy implementation.", level=0)
     
    26812841                            raise TypeError, "Local/unknown orderings not supported by 'toy_buchberger' implementation."
    26822842
    26832843        elif algorithm.startswith('singular:'):
    2684             gb = self._groebner_basis_singular(algorithm[9:])
     2844            gb = self._groebner_basis_singular(algorithm[9:], deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
    26852845        elif algorithm.startswith('libsingular:'):
    2686             gb = self._groebner_basis_libsingular(algorithm[len('libsingular:'):], *args, **kwds)
     2846            gb = self._groebner_basis_libsingular(algorithm[len('libsingular:'):], deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
    26872847        elif algorithm == 'macaulay2:gb':
    26882848            gb = self._groebner_basis_macaulay2(*args, **kwds)
    26892849        elif algorithm == 'magma:GroebnerBasis':