@@ -651,7 +651,7 @@ def augmentation(self, phi, mu, check=True):
651651 from augmented_valuation import AugmentedValuation
652652 return AugmentedValuation (self , phi , mu , check )
653653
654- def mac_lane_step (self , G , assume_squarefree = False , assume_equivalence_irreducible = False , report_degree_bounds = False ):
654+ def mac_lane_step (self , G , assume_squarefree = False , assume_equivalence_irreducible = False , report_degree_bounds_and_caches = False , coefficients = None , valuations = None ):
655655 r"""
656656 Perform an approximation step towards the squarefree monic non-constant
657657 integral polynomial ``G`` which is not an :meth:`equivalence_unit`.
@@ -686,8 +686,10 @@ def mac_lane_step(self, G, assume_squarefree=False, assume_equivalence_irreducib
686686 if not G .is_monic ():
687687 raise ValueError ("G must be monic" )
688688
689- coefficients = list (self .coefficients (G ))
690- valuations = list (self .valuations (G , coefficients = coefficients ))
689+ if coefficients is None :
690+ coefficients = list (self .coefficients (G ))
691+ if valuations is None :
692+ valuations = list (self .valuations (G , coefficients = coefficients ))
691693
692694 if min (valuations ) < 0 :
693695 raise ValueError ("G must be integral" )
@@ -707,7 +709,7 @@ def mac_lane_step(self, G, assume_squarefree=False, assume_equivalence_irreducib
707709 assert len (F ), "%s equivalence-decomposes as an equivalence-unit %s" % (G , F )
708710 if len (F ) == 1 and F [0 ][1 ] == 1 and F [0 ][0 ].degree () == G .degree ():
709711 assert self .is_key (G , assume_equivalence_irreducible = assume_equivalence_irreducible )
710- ret .append ((self .augmentation (G , infinity , check = False ), G .degree ()))
712+ ret .append ((self .augmentation (G , infinity , check = False ), G .degree (), None , None ))
711713 else :
712714 for phi ,e in F :
713715 if G == phi :
@@ -720,7 +722,7 @@ def mac_lane_step(self, G, assume_squarefree=False, assume_equivalence_irreducib
720722 prec = min ([c .precision_absolute () for c in phi .list ()])
721723 g = G .map_coefficients (lambda c :c .add_bigoh (prec ))
722724 assert self .is_key (g )
723- ret .append ((self .augmentation (g , infinity , check = False ), g .degree ()))
725+ ret .append ((self .augmentation (g , infinity , check = False ), g .degree (), None , None ))
724726 assert len (F ) == 1
725727 break
726728
@@ -739,7 +741,9 @@ def mac_lane_step(self, G, assume_squarefree=False, assume_equivalence_irreducib
739741 verbose ("Determining the augmentation for %s" % phi , level = 11 )
740742 old_mu = self (phi )
741743 w = self .augmentation (phi , old_mu , check = False )
742- NP = w .newton_polygon (G ).principal_part ()
744+ w_coefficients = list (w .coefficients (G ))
745+ w_valuations = list (w .valuations (G , coefficients = w_coefficients ))
746+ NP = w .newton_polygon (G , valuations = w_valuations ).principal_part ()
743747 verbose ("Newton-Polygon for v(phi)=%s : %s" % (self (phi ), NP ), level = 11 )
744748 slopes = NP .slopes (repetition = True )
745749 multiplicities = {slope : len ([s for s in slopes if s == slope ]) for slope in slopes }
@@ -768,13 +772,14 @@ def mac_lane_step(self, G, assume_squarefree=False, assume_equivalence_irreducib
768772
769773 phi = G .parent ()(phi )
770774 w = self ._base_valuation .augmentation (phi , infinity , check = False )
771- ret .append ((w , phi .degree ()))
775+ ret .append ((w , phi .degree (), None , None ))
772776 continue
773777
774778 for i , slope in enumerate (slopes ):
775779 slope = slopes [i ]
776780 verbose ("Slope = %s" % slope , level = 12 )
777781 new_mu = old_mu - slope
782+ new_valuations = [val - (j * slope if slope is not - infinity else (0 if j == 0 else - infinity )) for j ,val in enumerate (w_valuations )]
778783 base = self
779784 if phi .degree () == base .phi ().degree ():
780785 assert new_mu > self (phi )
@@ -786,11 +791,11 @@ def mac_lane_step(self, G, assume_squarefree=False, assume_equivalence_irreducib
786791 from sage .rings .all import ZZ
787792 assert (phi .degree () / self .phi ().degree ()) in ZZ
788793 degree_bound = multiplicities [slope ] * self .phi ().degree ()
789- ret .append ((w , degree_bound ))
794+ ret .append ((w , degree_bound , w_coefficients , new_valuations ))
790795
791796 assert ret
792- if not report_degree_bounds :
793- ret = [v for v ,_ in ret ]
797+ if not report_degree_bounds_and_caches :
798+ ret = [v for v ,_ , _ , _ in ret ]
794799 return ret
795800
796801 def is_key (self , phi , explain = False , assume_equivalence_irreducible = False ):
0 commit comments