def maximal_isotropic_subgroup(self): r""" Returns the maximal isotropic subgroup of self. """ S=list() for a in self._D: if(self.Q(a)==0 and a<>0): S.append(a) # S is now a list of all isotropic elements except 0 PS=list(powerset(S)) PS.reverse() # PS now contains all subsets of isotropic elements (except 0) # with decreasing sizes. We now need to find the first, which together with 0 # is a group. #print "PS=",PS for A in PS: A.append(0) #print "Test the isotropic set: S=",A ok=True for x in A: for y in A: z=red_mod1(x+y) if(not z in A): #print "S was not a subgroup!" ok=False if(ok): A.sort() return A raise ArithmeticError, "Could not find maximal isotropic subgroup!"
def maximal_isotropic_subgroup(self): r""" Returns the maximal isotropic subgroup of self. """ S=list() for a in self._D: if self.Q(a) == 0 and a != 0: S.append(a) # S is now a list of all isotropic elements except 0 PS=list(powerset(S)) PS.reverse() # PS now contains all subsets of isotropic elements (except 0) # with decreasing sizes. We now need to find the first, which together with 0 # is a group. #print "PS=",PS for A in PS: A.append(0) #print "Test the isotropic set: S=",A ok=True for x in A: for y in A: z=red_mod1(x+y) if(not z in A): #print "S was not a subgroup!" ok=False if(ok): A.sort() return A raise ArithmeticError("Could not find maximal isotropic subgroup!")
def invariant_trace_field_generators(self): gens = self.generators() if min([abs(self(g).trace()) for g in gens]) < 0.001: raise ValueError( "Algorithm fails when a generator has trace 0, see page 125 of ML" ) gens = [2 * g for g in gens] enough_elts = [ ''.join(sorted(s)) for s in powerset(gens) if len(s) > 0 ] return [self(w).trace() for w in enough_elts]
def trace_field_generators(self): gens = self.generators() enough_elts = [ ''.join(sorted(s)) for s in powerset(gens) if len(s) > 0 ] return [self(w).trace() for w in enough_elts]