# HG changeset patch
# User jackperry@rabmoj.local
# Date 1232762280 21600
# Node ID f315aa5e8e95a69493aeff59b326330e12230637
# Parent b457e27d3ace23ebde8d16fa029b3e284a587f4a
Added Singular options.
diff r b457e27d3ace r f315aa5e8e95 sage/rings/polynomial/multi_polynomial_ideal.py
a

b


840  840  return vdim 
841  841  
842  842  @redSB 
843   def _groebner_basis_singular(self, algorithm="groebner", *args, **kwds): 
 843  def _groebner_basis_singular(self, algorithm="groebner", lazy=False, \ 
 844  redTail=False, redSB=True, notSugar=False,\ 
 845  *args, **kwds): 
844  846  r""" 
845  847  Return the reduced Groebner basis of this ideal. If the Groebner 
846  848  basis for this ideal has been calculated before the cached 
… 
… 

887  889  one. 
888  890  """ 
889  891  R = self.ring() 
890   S = self._groebner_basis_singular_raw(algorithm=algorithm, *args, **kwds) 
 892  S = self._groebner_basis_singular_raw(algorithm=algorithm, lazy=lazy, \ 
 893  redTail=redTail, redSB=redSB, notSugar=notSugar,\ 
 894  *args, **kwds) 
891  895  S = Sequence([R(S[i+1]) for i in range(len(S))], R, check=False, immutable=True) 
892  896  return S 
893  897  
894   def _groebner_basis_singular_raw(self, algorithm="groebner", singular=singular_default, *args, **kwds): 
 898  def _groebner_basis_singular_raw(self, algorithm="groebner", lazy=False, \ 
 899  redTail=False, redSB=True, notSugar=False, \ 
 900  singular=singular_default, *args, **kwds): 
895  901  r""" 
896  902  Return a Grobner basis in \Singular format. 
897  903  
… 
… 

903  909  b*d^4  b + d^5  d, b*c  b*d + c^2*d^4 + c*d  2*d^2, 
904  910  b^2 + 2*b*d + d^2, a + b + c + d] 
905  911  """ 
 912  
906  913  try: 
907  914  return self.__gb_singular 
908  915  except AttributeError: 
… 
… 

914  921  singular.option(o) 
915  922  else: 
916  923  singular.option("no"+o) 
 924  
 925  # userspecified Singular options 
 926  s = self._singular_().parent() 
 927  before_options = s.option("get") 
 928  if lazy: 
 929  s.option("lazy") 
 930  else: 
 931  s.option("nolazy") 
 932  if notSugar: 
 933  s.option("notSugar") 
 934  else: 
 935  s.option("nonotSugar") 
 936  if redTail: 
 937  s.option("redTail") 
 938  else: 
 939  s.option("noredTail") 
 940  if redSB: 
 941  s.option("redSB") 
 942  else: 
 943  s.option("noredSB") 
917  944  
918  945  if algorithm=="groebner": 
919   S = self._singular_().groebner() 
 946  S = singular(self).groebner() 
920  947  elif algorithm=="std": 
921  948  S = self._singular_().std() 
922  949  elif algorithm=="slimgb": 
… 
… 

928  955  else: 
929  956  raise TypeError, "algorithm '%s' unknown"%algorithm 
930  957  self.__gb_singular = S 
 958  singular.option("set",before_options) 
931  959  return S 
932  960  
933  961  def _groebner_basis_libsingular(self, algorithm="std"): 
… 
… 

1827  1855  symmetry=symmetry, verbose=verbose) 
1828  1856  
1829  1857  @cached_method 
1830   def groebner_basis(self, algorithm='', *args, **kwds): 
 1858  def groebner_basis(self, algorithm='', lazy=False, redTail=False, redSB=True,\ 
 1859  notSugar=False, *args, **kwds): 
1831  1860  r""" 
1832  1861  Return the reduced Groebner basis of this ideal. A Groeber basis 
1833  1862  $g_1,...,g_n$ for an ideal $I$ is a basis such that 
… 
… 

1963  1992  available), or toy implementation. 
1964  1993  """ 
1965  1994  from sage.rings.integer_mod_ring import is_IntegerModRing 
1966   
 1995  
1967  1996  if algorithm.lower() == "magma": 
1968  1997  algorithm = "magma:GroebnerBasis" 
1969  1998  elif algorithm.lower() == "singular": 
… 
… 

1972  2001  algorithm = "macaulay2:gb" 
1973  2002  elif algorithm.lower() == "toy": 
1974  2003  algorithm = "toy:buchberger2" 
1975   
 2004  
1976  2005  if algorithm is '': 
1977  2006  if self.ring().base_ring() is ZZ: 
1978  2007  try: 
… 
… 

1996  2025  gb = filter(lambda f: f,[R(f) for f in gb]) 
1997  2026  else: 
1998  2027  try: 
1999   gb = self._groebner_basis_singular("groebner", *args, **kwds) 
 2028  gb = self._groebner_basis_singular("groebner", lazy=lazy, \ 
 2029  redTail=redTail, redSB=redSB, \ 
 2030  notSugar=notSugar, *args, **kwds) 
2000  2031  except TypeError, msg: # conversion to Singular not supported 
2001  2032  if self.ring().term_order().is_global(): 
2002  2033  verbose("Warning: falling back to very slow toy implementation.", level=0) 