Esempio n. 1
0
 def sum(self,other):
     '''Compute the sum of this and the ideal.
     '''
     s = jas.application.Ideal(self.pset);
     t = jas.application.Ideal(other.pset);
     N = s.sum( t );
     return Ideal(self.ring,"",N.getList());
Esempio n. 2
0
 def optimize(self):
     '''Optimize the term order on the variables.
     '''
     p = self.pset;
     o = TermOrderOptimization.optimizeTermOrder(p);
     r = Ring("",o.ring);
     return Ideal(r,"",o.list);
Esempio n. 3
0
 def element(self,polystr):
     '''Create an element from a string.
     '''
     I = Ideal(self, "( " + polystr + " )");
     list = I.pset.list;
     if len(list) > 0:
         return RingElem( list[0] );
Esempio n. 4
0
 def toModular(self,mf):
     '''Convert integer coefficients to modular coefficients.
     '''
     p = self.pset;
     l = p.list;
     r = p.ring;
     rm = GenPolynomialRing( mf, r.nvar, r.tord, r.vars );
     pm = PolyUtil.fromIntegerCoefficients(rm,l);
     r = Ring("",rm);
     return Ideal(r,"",pm);
Esempio n. 5
0
 def toInteger(self):
     '''Convert rational coefficients to integer coefficients.
     '''
     p = self.pset;
     l = p.list;
     r = p.ring;
     ri = GenPolynomialRing( BigInteger(), r.nvar, r.tord, r.vars );
     pi = PolyUtil.integerFromRationalCoefficients(ri,l);
     r = Ring("",ri);
     return Ideal(r,"",pi);
Esempio n. 6
0
 def NF(self,reducer):
     '''Compute a normal form of this ideal with respect to reducer.
     '''
     s = self.pset;
     F = s.list;
     G = reducer.list;
     t = System.currentTimeMillis();
     N = ReductionSeq().normalform(G,F);
     t = System.currentTimeMillis() - t;
     print "sequential NF executed in %s ms" % t; 
     return Ideal(self.ring,"",N);
Esempio n. 7
0
 def parTwosidedGB(self,th):
     '''Compute a two-sided Groebner base in parallel.
     '''
     s = self.pset;
     F = s.list;
     bbpar = SolvableGroebnerBaseParallel(th);
     t = System.currentTimeMillis();
     G = bbpar.twosidedGB(F);
     t = System.currentTimeMillis() - t;
     bbpar.terminate();
     print "parallel %s twosidedGB executed in %s ms" % (th, t); 
     return Ideal(self.ring,"",G);
Esempio n. 8
0
 def parOldGB(self,th):
     '''Compute in parallel a Groebner base.
     '''
     s = self.pset;
     F = s.list;
     bbpar = GroebnerBaseParallel(th);
     t = System.currentTimeMillis();
     G = bbpar.GB(F);
     t = System.currentTimeMillis() - t;
     bbpar.terminate();
     print "parallel-old %s executed in %s ms" % (th, t); 
     return Ideal(self.ring,"",G);
Esempio n. 9
0
 def distGB(self,th=2,machine="examples/machines.localhost",port=7114):
     '''Compute on a distributed system a Groebner base.
     '''
     s = self.pset;
     F = s.list;
     t = System.currentTimeMillis();
     # G = GroebnerBaseDistributed.Server(F,th);
     #G = GBDist(th,machine,port).execute(F);
     gbd = GBDist(th,machine,port);
     t1 = System.currentTimeMillis();
     G = gbd.execute(F);
     t1 = System.currentTimeMillis() - t1;
     gbd.terminate(0);
     t = System.currentTimeMillis() - t;
     print "distributed %s executed in %s ms (%s ms start-up)" % (th,t1,t-t1); 
     return Ideal(self.ring,"",G);
Esempio n. 10
0
 def GB(self):
     '''Compute a Groebner base.
     '''
     s = self.pset;
     cofac = s.ring.coFac;
     F = s.list;
     t = System.currentTimeMillis();
     if cofac.isField():
         G = GroebnerBaseSeq().GB(F);
     else:
         v = None;
         try:
             v = cofac.vars;
         except:
             pass
         if v == None:
             G = GroebnerBasePseudoSeq(cofac).GB(F);
         else:
             G = GroebnerBasePseudoRecSeq(cofac).GB(F);
     t = System.currentTimeMillis() - t;
     print "sequential GB executed in %s ms" % t; 
     return Ideal(self.ring,"",G);
Esempio n. 11
0
 def ideal(self,ringstr="",list=None):
     '''Create an ideal.
     '''
     return Ideal(self,ringstr,list);
Esempio n. 12
0
 def isGB(self):
     '''Test if this is a Groebner base.
     '''
     I = Ideal(self.ring,"",self.pset.list);
     return I.isGB();
Esempio n. 13
0
 def GB(self):
     '''Compute a Groebner base.
     '''
     I = Ideal(self.ring,"",self.pset.list);
     g = I.GB();
     return ParamIdeal(g.ring,"",g.pset.list);
Esempio n. 14
0
 def intersect(self,ring):
     '''Compute the intersection of this and the given polynomial ring.
     '''
     s = jas.application.Ideal(self.pset);
     N = s.intersect(ring.ring);
     return Ideal(self.ring,"",N.getList());
Esempio n. 15
0
"""

for t in (2, 3, 5, 7, 11, 13, 17, 19, 23, 27, 31, 37, 43):
    #for t in (5,7):
    r1 = SolvableRing(rs1 % t)
    r1c = SolvableRing(rs1c)
    #print "SolvableRing: " + str(r1);
    #print "SolvableRing: " + str(r1c);
    #print;
    it = r1.ideal(ps % (t, t))
    #print "SolvableIdeal: " + str(it);
    #print;
    # compute I_{\phi_t} \cap WA_1^opp
    x = it.leftGB()
    print "seq left x:", x
    y = Ideal(x.pset).intersect(r1c.ring)
    len = y.list.size()
    print "seq left y: ", y
    print "seq left y len: ", len
    #print;
    #-------------------------------------
    r2 = SolvableRing(rs2 % t)
    r2c = SolvableRing(rs2c % t)
    #print "SolvableRing: " + str(r2);
    #print "SolvableRing: " + str(r2c);
    #print;
    ikt = r2.ideal(ps % (t, t))
    #print "SolvableIdeal: " + str(ikt);
    print
    # compute ker(\phi_t)
    x = ikt.leftGB()