class JAS::SolvIdeal

Represents a JAS solvable polynomial ideal.

Methods for left, right two-sided Groebner basees and others.

Attributes

list[R]

the Java ordered polynomial list, polynomial ring, and polynomial list

pset[R]

the Java ordered polynomial list, polynomial ring, and polynomial list

ring[R]

the Java ordered polynomial list, polynomial ring, and polynomial list

Public Class Methods

new(ring,ringstr="",list=nil) click to toggle source

Constructor for an ideal in a solvable polynomial ring.

     # File examples/jas.rb
4243 def initialize(ring,ringstr="",list=nil)
4244     @ring = ring;
4245     if list == nil
4246        sr = StringReader.new( ringstr );
4247        tok = GenPolynomialTokenizer.new(ring.ring,sr);
4248        @list = tok.nextSolvablePolynomialList();
4249     else
4250        @list = rbarray2arraylist(list,rec=1);
4251     end
4252     @pset = OrderedPolynomialList.new(ring.ring,@list);
4253     #@ideal = SolvableIdeal.new(@pset);
4254 end

Public Instance Methods

<=>(other) click to toggle source

Compare two ideals.

     # File examples/jas.rb
4266 def <=>(other)
4267     s = SolvableIdeal.new(@pset);
4268     o = SolvableIdeal.new(other.pset);
4269     return s.compareTo(o); 
4270 end
==(other) click to toggle source

Test if two ideals are equal.

     # File examples/jas.rb
4275 def ==(other)
4276     if not other.is_a? SolvIdeal
4277        return false;
4278     end
4279     s, o = self, other;
4280     return (s <=> o) == 0; 
4281 end
intersect(other) click to toggle source

Compute the intersection of this and the other ideal.

     # File examples/jas.rb
4470 def intersect(other)
4471     s = SolvableIdeal.new(@pset);
4472     t = SolvableIdeal.new(other.pset);
4473     nn = s.intersect( t );
4474     return SolvIdeal.new(@ring,"",nn.getList());
4475 end
intersectRing(ring) click to toggle source

Compute the intersection of this and a polynomial ring.

     # File examples/jas.rb
4461 def intersectRing(ring)
4462     s = SolvableIdeal.new(@pset);
4463     nn = s.intersect(ring.ring);
4464     return SolvIdeal.new(@ring,"",nn.getList());
4465 end
inverse(p) click to toggle source

Compute the inverse polynomial with respect to this twosided ideal.

     # File examples/jas.rb
4528 def inverse(p)
4529     if p.is_a? RingElem
4530         p = p.elem;
4531     end
4532     s = SolvableIdeal.new(@pset);
4533     i = s.inverse(p);
4534     return RingElem.new(i);
4535 end
isLeftGB() click to toggle source

Test if this is a left Groebner base.

     # File examples/jas.rb
4330 def isLeftGB()
4331     cofac = @ring.ring.coFac;
4332     ff = @pset.list;
4333     kind = "";
4334     t = System.currentTimeMillis();
4335     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4336        b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isLeftGB(ff);
4337        kind = "pseudoRec"
4338     else 
4339        if cofac.isField() or not cofac.isCommutative()
4340           b = SolvableGroebnerBaseSeq.new().isLeftGB(ff);
4341           kind = "field|nocom"
4342        else
4343           b = SolvableGroebnerBasePseudoSeq.new(cofac).isLeftGB(ff);
4344           kind = "pseudo"
4345        end
4346     end
4347     t = System.currentTimeMillis() - t;
4348     puts "isLeftGB(#{kind}) = #{b} executed in #{t} ms\n"; 
4349     return b;
4350 end
isLeftSyzygy(m) click to toggle source

Test if this is a left syzygy of the module in m.

     # File examples/jas.rb
4624 def isLeftSyzygy(m)
4625     p = @pset;
4626     g = p.list;
4627     l = m.list;
4628     #puts "l = #{l}";
4629     #puts "g = #{g}";
4630     t = System.currentTimeMillis();
4631     z = SolvableSyzygySeq.new(p.ring.coFac).isLeftZeroRelation( l, g );
4632     t = System.currentTimeMillis() - t;
4633     puts "executed isLeftSyzygy in #{t} ms\n"; 
4634     return z;
4635 end
isONE() click to toggle source

Test if ideal is one.

     # File examples/jas.rb
4286 def isONE()
4287     s = SolvableIdeal.new(@pset);
4288     return s.isONE(); 
4289 end
isRightGB() click to toggle source

Test if this is a right Groebner base.

     # File examples/jas.rb
4436 def isRightGB()
4437     cofac = @ring.ring.coFac;
4438     ff = @pset.list;
4439     kind = "";
4440     t = System.currentTimeMillis();
4441     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4442        b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isRightGB(ff);
4443        kind = "pseudoRec"
4444     else
4445        if cofac.isField() or not cofac.isCommutative()
4446           b = SolvableGroebnerBaseSeq.new().isRightGB(ff);
4447           kind = "field|nocom"
4448        else 
4449           b = SolvableGroebnerBasePseudoSeq.new(cofac).isRightGB(ff);
4450           kind = "pseudo"
4451        end
4452     end
4453     t = System.currentTimeMillis() - t;
4454     puts "isRightGB(#{kind}) = #{b} executed in #{t} ms\n"; 
4455     return b;
4456 end
isRightSyzygy(m) click to toggle source

Test if this is a right syzygy of the module in m.

     # File examples/jas.rb
4640 def isRightSyzygy(m)
4641     p = @pset;
4642     g = p.list;
4643     l = m.list;
4644     #puts "l = #{l}";
4645     #puts "g = #{g}";
4646     t = System.currentTimeMillis();
4647     z = SolvableSyzygySeq.new(p.ring.coFac).isRightZeroRelation( l, g );
4648     t = System.currentTimeMillis() - t;
4649     puts "executed isRightSyzygy in #{t} ms\n"; 
4650     return z;
4651 end
isTwosidedGB() click to toggle source

Test if this is a two-sided Groebner base.

     # File examples/jas.rb
4386 def isTwosidedGB()
4387     cofac = @ring.ring.coFac;
4388     ff = @pset.list;
4389     kind = "";
4390     t = System.currentTimeMillis();
4391     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4392        b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isTwosidedGB(ff);
4393        kind = "pseudoRec"
4394     else
4395        if cofac.isField() or not cofac.isCommutative()
4396           b = SolvableGroebnerBaseSeq.new().isTwosidedGB(ff);
4397           kind = "field|nocom"
4398        else 
4399           b = SolvableGroebnerBasePseudoSeq.new(cofac).isTwosidedGB(ff);
4400           kind = "pseudo"
4401        end
4402     end
4403     t = System.currentTimeMillis() - t;
4404     puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 
4405     return b;
4406 end
isZERO() click to toggle source

Test if ideal is zero.

     # File examples/jas.rb
4294 def isZERO()
4295     s = SolvableIdeal.new(@pset);
4296     return s.isZERO(); 
4297 end
leftGB() click to toggle source

Compute a left Groebner base.

     # File examples/jas.rb
4302 def leftGB()
4303     #if ideal != nil
4304     #   return SolvIdeal.new(@ring,"",@ideal.leftGB());
4305     #end
4306     cofac = @ring.ring.coFac;
4307     ff = @pset.list;
4308     kind = "";
4309     t = System.currentTimeMillis();
4310     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4311        gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).leftGB(ff);
4312        kind = "pseudoRec"
4313     else 
4314        if cofac.isField() or not cofac.isCommutative()
4315           gg = SolvableGroebnerBaseSeq.new().leftGB(ff);
4316           kind = "field|nocom"
4317        else
4318           gg = SolvableGroebnerBasePseudoSeq.new(cofac).leftGB(ff);
4319           kind = "pseudo"
4320        end
4321     end
4322     t = System.currentTimeMillis() - t;
4323     puts "sequential(#{kind}) leftGB executed in #{t} ms\n"; 
4324     return SolvIdeal.new(@ring,"",gg);
4325 end
leftReduction(p) click to toggle source

Compute a left normal form of p with respect to this ideal.

     # File examples/jas.rb
4540 def leftReduction(p)
4541     s = @pset;
4542     gg = s.list;
4543     if p.is_a? RingElem
4544         p = p.elem;
4545     end
4546     n = SolvableReductionSeq.new().leftNormalform(gg,p);
4547     return RingElem.new(n);
4548 end
leftSyzygy() click to toggle source

Left Syzygy of generating polynomials.

     # File examples/jas.rb
4596 def leftSyzygy()
4597     p = @pset;
4598     l = p.list;
4599     t = System.currentTimeMillis();
4600     s = SolvableSyzygySeq.new(p.ring.coFac).leftZeroRelationsArbitrary( l );
4601     m = SolvableModule.new("",p.ring);
4602     t = System.currentTimeMillis() - t;
4603     puts "executed leftSyzygy in #{t} ms\n"; 
4604     return SolvableSubModule.new(m,"",s);
4605 end
parLeftGB(th) click to toggle source

Compute a left Groebner base in parallel.

     # File examples/jas.rb
4566 def parLeftGB(th)
4567     s = @pset;
4568     ff = s.list;
4569     bbpar = SolvableGroebnerBaseParallel.new(th);
4570     t = System.currentTimeMillis();
4571     gg = bbpar.leftGB(ff);
4572     t = System.currentTimeMillis() - t;
4573     bbpar.terminate();
4574     puts "parallel #{th} leftGB executed in #{t} ms\n"; 
4575     return SolvIdeal.new(@ring,"",gg);
4576 end
parTwosidedGB(th) click to toggle source

Compute a two-sided Groebner base in parallel.

     # File examples/jas.rb
4581 def parTwosidedGB(th)
4582     s = @pset;
4583     ff = s.list;
4584     bbpar = SolvableGroebnerBaseParallel.new(th);
4585     t = System.currentTimeMillis();
4586     gg = bbpar.twosidedGB(ff);
4587     t = System.currentTimeMillis() - t;
4588     bbpar.terminate();
4589     puts "parallel #{th} twosidedGB executed in #{t} ms\n"; 
4590     return SolvIdeal.new(@ring,"",gg);
4591 end
rightGB() click to toggle source

Compute a right Groebner base.

     # File examples/jas.rb
4411 def rightGB()
4412     cofac = @ring.ring.coFac;
4413     ff = @pset.list;
4414     kind = "";
4415     t = System.currentTimeMillis();
4416     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4417        gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).rightGB(ff);
4418        kind = "pseudoRec"
4419     else
4420        if cofac.isField() or not cofac.isCommutative()
4421           gg = SolvableGroebnerBaseSeq.new().rightGB(ff);
4422           kind = "field|nocom"
4423        else 
4424           gg = SolvableGroebnerBasePseudoSeq.new(cofac).rightGB(ff);
4425           kind = "pseudo"
4426        end
4427     end
4428     t = System.currentTimeMillis() - t;
4429     puts "sequential(#{kind}) rightGB executed in #{t} ms\n"; 
4430     return SolvIdeal.new(@ring,"",gg);
4431 end
rightReduction(p) click to toggle source

Compute a right normal form of p with respect to this ideal.

     # File examples/jas.rb
4553 def rightReduction(p)
4554     s = @pset;
4555     gg = s.list;
4556     if p.is_a? RingElem
4557         p = p.elem;
4558     end
4559     n = SolvableReductionSeq.new().rightNormalform(gg,p);
4560     return RingElem.new(n);
4561 end
rightSyzygy() click to toggle source

Right Syzygy of generating polynomials.

     # File examples/jas.rb
4610 def rightSyzygy()
4611     p = @pset;
4612     l = p.list;
4613     t = System.currentTimeMillis();
4614     s = SolvableSyzygySeq.new(p.ring.coFac).rightZeroRelationsArbitrary( l );
4615     m = SolvableModule.new("",p.ring);
4616     t = System.currentTimeMillis() - t;
4617     puts "executed rightSyzygy in #{t} ms\n"; 
4618     return SolvableSubModule.new(m,"",s);
4619 end
sum(other) click to toggle source

Compute the sum of this and the other ideal.

     # File examples/jas.rb
4480 def sum(other)
4481     s = SolvableIdeal.new(@pset);
4482     t = SolvableIdeal.new(other.pset);
4483     nn = s.sum( t );
4484     return SolvIdeal.new(@ring,"",nn.getList());
4485 end
toQuotientCoefficients() click to toggle source

Convert to polynomials with SolvableQuotient coefficients.

     # File examples/jas.rb
4500 def toQuotientCoefficients()
4501     if @pset.ring.coFac.is_a? SolvableResidueRing
4502        cf = @pset.ring.coFac.ring;
4503     elsif @pset.ring.coFac.is_a? GenSolvablePolynomialRing
4504        cf = @pset.ring.coFac;
4505     #elsif @pset.ring.coFac.is_a? GenPolynomialRing
4506     #   cf = @pset.ring.coFac;
4507     #   puts "cf = " + cf.toScript();
4508     else
4509        return self;
4510     end
4511     rrel = @pset.ring.table.relationList() + @pset.ring.polCoeff.coeffTable.relationList();
4512     #puts "rrel = " + str(rrel);
4513     qf = SolvableQuotientRing.new(cf);
4514     qr = QuotSolvablePolynomialRing.new(qf,@pset.ring);
4515     #puts "qr = " + str(qr);
4516     qrel = rrel.map { |r| RingElem.new(qr.fromPolyCoefficients(r)) };
4517     #puts "qrel = " + str(qrel);
4518     qring = SolvPolyRing.new(qf,@ring.ring.getVars(),@ring.ring.tord,qrel);
4519     #puts "qring = " + str(qring);
4520     qlist = @list.map { |r| qr.fromPolyCoefficients(@ring.ring.toPolyCoefficients(r)) };
4521     qlist = qlist.map { |r| RingElem.new(r) };
4522     return SolvIdeal.new(qring,"",qlist);
4523 end
to_s() click to toggle source

Create a string representation.

     # File examples/jas.rb
4259 def to_s()
4260     return @pset.toScript();
4261 end
twosidedGB() click to toggle source

Compute a two-sided Groebner base.

     # File examples/jas.rb
4355 def twosidedGB()
4356     cofac = @ring.ring.coFac;
4357     ff = @pset.list;
4358     kind = "";
4359     t = System.currentTimeMillis();
4360     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4361        gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).twosidedGB(ff);
4362        kind = "pseudoRec"
4363     else 
4364        #puts "two-sided: " + cofac.to_s
4365        if cofac.is_a? WordResidue  #Ring
4366           gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff);
4367           kind = "pseudo"
4368        else 
4369           if cofac.isField() or not cofac.isCommutative()
4370              gg = SolvableGroebnerBaseSeq.new().twosidedGB(ff);
4371              kind = "field|nocom"
4372           else
4373              gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff);
4374              kind = "pseudo"
4375           end
4376        end
4377     end
4378     t = System.currentTimeMillis() - t;
4379     puts "sequential(#{kind}) twosidedGB executed in #{t} ms\n"; 
4380     return SolvIdeal.new(@ring,"",gg);
4381 end
univariates() click to toggle source

Compute the univariate polynomials in each variable of this twosided ideal.

     # File examples/jas.rb
4490 def univariates()
4491     s = SolvableIdeal.new(@pset);
4492     ll = s.constructUnivariate();
4493     nn = ll.map {|e| RingElem.new(e) };
4494     return nn;
4495 end