(self)
return G0
Compute syzygies. See [SCA, algorithm 2.5.4].
Compute syzygies. See [SCA, algorithm 2.5.4].
Compute syzygies . See [ SCA algorithm 2 . 5 . 4 ] .
def _syzygies(self):
        """Compute syzygies. See [SCA, algorithm 2.5.4]."""
        # NOTE if self.gens is a standard basis, this can be done more
        #      efficiently using Schreyer's theorem
        from sympy.matrices import eye

        # First bullet point
        k = len(self.gens)
        r = self.rank
        im = eye(k)
        Rkr = self.ring.free_module(r + k)
        newgens = []
        for j, f in enumerate(self.gens):
            m = [0]*(r + k)
            for i, v in enumerate(f):
                m[i] = f[i]
            for i in range(k):
                m[r + i] = im[j, i]
            newgens.append(Rkr.convert(m))
        # Note: we need *descending* order on module index, and TOP=False to
        #       get an eliminetaion order
        F = Rkr.submodule(*newgens, order='ilex', TOP=False)

        # Second bullet point: standard basis of F
        G = F._groebner_vec()

        # Third bullet point: G0 = G intersect the new k components
        G0 = [x[r:] for x in G if all(y == self.ring.convert(0)
                                      for y in x[:r])]

        # Fourth and fifth bullet points: we are done
        return G0
def _syzygies ( self ) : # NOTE if self.gens is a standard basis, this can be done more #      efficiently using Schreyer's theorem from sympy . matrices import eye # First bullet point k = len ( self . gens ) r = self . rank im = eye ( k ) Rkr = self . ring . free_module ( r + k ) newgens = [ ] for j , f in enumerate ( self . gens ) : m = [ 0 ] * ( r + k ) for i , v in enumerate ( f ) : m [ i ] = f [ i ] for i in range ( k ) : m [ r + i ] = im [ j , i ] newgens . append ( Rkr . convert ( m ) ) # Note: we need *descending* order on module index, and TOP=False to #       get an eliminetaion order F = Rkr . submodule ( * newgens , order = 'ilex' , TOP = False ) # Second bullet point: standard basis of F G = F . _groebner_vec ( ) # Third bullet point: G0 = G intersect the new k components G0 = [ x [ r : ] for x in G if all ( y == self . ring . convert ( 0 ) for y in x [ : r ] ) ] # Fourth and fifth bullet points: we are done return G0