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
4395 def initialize(ring,ringstr="",list=nil)
4396     @ring = ring;
4397     if list == nil
4398        sr = StringReader.new( ringstr );
4399        tok = GenPolynomialTokenizer.new(ring.ring,sr);
4400        @list = tok.nextSolvablePolynomialList();
4401     else
4402        @list = rbarray2arraylist(list,rec=1);
4403     end
4404     @pset = OrderedPolynomialList.new(ring.ring,@list);
4405     #@ideal = SolvableIdeal.new(@pset);
4406 end

Public Instance Methods

<=>(other) click to toggle source

Compare two ideals.

     # File examples/jas.rb
4418 def <=>(other)
4419     s = SolvableIdeal.new(@pset);
4420     o = SolvableIdeal.new(other.pset);
4421     return s.compareTo(o); 
4422 end
==(other) click to toggle source

Test if two ideals are equal.

     # File examples/jas.rb
4427 def ==(other)
4428     if not other.is_a? SolvIdeal
4429        return false;
4430     end
4431     s, o = self, other;
4432     return (s <=> o) == 0; 
4433 end
dimension() click to toggle source

Compute the dimension of the ideal.

     # File examples/jas.rb
4809 def dimension()
4810     ii = SolvableIdeal.new(@pset);
4811     d = ii.dimension();
4812     return d;
4813 end
intersect(other) click to toggle source

Compute the intersection of this and the other ideal.

     # File examples/jas.rb
4622 def intersect(other)
4623     s = SolvableIdeal.new(@pset);
4624     t = SolvableIdeal.new(other.pset);
4625     nn = s.intersect( t );
4626     return SolvIdeal.new(@ring,"",nn.getList());
4627 end
intersectRing(ring) click to toggle source

Compute the intersection of this and a polynomial ring.

     # File examples/jas.rb
4613 def intersectRing(ring)
4614     s = SolvableIdeal.new(@pset);
4615     nn = s.intersect(ring.ring);
4616     return SolvIdeal.new(@ring,"",nn.getList());
4617 end
inverse(p) click to toggle source

Compute the inverse polynomial with respect to this twosided ideal.

     # File examples/jas.rb
4680 def inverse(p)
4681     if p.is_a? RingElem
4682         p = p.elem;
4683     end
4684     s = SolvableIdeal.new(@pset);
4685     i = s.inverse(p);
4686     return RingElem.new(i);
4687 end
isLeftGB() click to toggle source

Test if this is a left Groebner base.

     # File examples/jas.rb
4482 def isLeftGB()
4483     cofac = @ring.ring.coFac;
4484     ff = @pset.list;
4485     kind = "";
4486     t = System.currentTimeMillis();
4487     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4488        b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isLeftGB(ff);
4489        kind = "pseudoRec"
4490     else 
4491        if cofac.isField() or not cofac.isCommutative()
4492           b = SolvableGroebnerBaseSeq.new().isLeftGB(ff);
4493           kind = "field|nocom"
4494        else
4495           b = SolvableGroebnerBasePseudoSeq.new(cofac).isLeftGB(ff);
4496           kind = "pseudo"
4497        end
4498     end
4499     t = System.currentTimeMillis() - t;
4500     puts "isLeftGB(#{kind}) = #{b} executed in #{t} ms\n"; 
4501     return b;
4502 end
isLeftSyzygy(m) click to toggle source

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

     # File examples/jas.rb
4776 def isLeftSyzygy(m)
4777     p = @pset;
4778     g = p.list;
4779     l = m.list;
4780     #puts "l = #{l}";
4781     #puts "g = #{g}";
4782     t = System.currentTimeMillis();
4783     z = SolvableSyzygySeq.new(p.ring.coFac).isLeftZeroRelation( l, g );
4784     t = System.currentTimeMillis() - t;
4785     puts "executed isLeftSyzygy in #{t} ms\n"; 
4786     return z;
4787 end
isONE() click to toggle source

Test if ideal is one.

     # File examples/jas.rb
4438 def isONE()
4439     s = SolvableIdeal.new(@pset);
4440     return s.isONE(); 
4441 end
isRightGB() click to toggle source

Test if this is a right Groebner base.

     # File examples/jas.rb
4588 def isRightGB()
4589     cofac = @ring.ring.coFac;
4590     ff = @pset.list;
4591     kind = "";
4592     t = System.currentTimeMillis();
4593     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4594        b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isRightGB(ff);
4595        kind = "pseudoRec"
4596     else
4597        if cofac.isField() or not cofac.isCommutative()
4598           b = SolvableGroebnerBaseSeq.new().isRightGB(ff);
4599           kind = "field|nocom"
4600        else 
4601           b = SolvableGroebnerBasePseudoSeq.new(cofac).isRightGB(ff);
4602           kind = "pseudo"
4603        end
4604     end
4605     t = System.currentTimeMillis() - t;
4606     puts "isRightGB(#{kind}) = #{b} executed in #{t} ms\n"; 
4607     return b;
4608 end
isRightSyzygy(m) click to toggle source

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

     # File examples/jas.rb
4792 def isRightSyzygy(m)
4793     p = @pset;
4794     g = p.list;
4795     l = m.list;
4796     #puts "l = #{l}";
4797     #puts "g = #{g}";
4798     t = System.currentTimeMillis();
4799     z = SolvableSyzygySeq.new(p.ring.coFac).isRightZeroRelation( l, g );
4800     t = System.currentTimeMillis() - t;
4801     puts "executed isRightSyzygy in #{t} ms\n"; 
4802     return z;
4803 end
isTwosidedGB() click to toggle source

Test if this is a two-sided Groebner base.

     # File examples/jas.rb
4538 def isTwosidedGB()
4539     cofac = @ring.ring.coFac;
4540     ff = @pset.list;
4541     kind = "";
4542     t = System.currentTimeMillis();
4543     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4544        b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isTwosidedGB(ff);
4545        kind = "pseudoRec"
4546     else
4547        if cofac.isField() or not cofac.isCommutative()
4548           b = SolvableGroebnerBaseSeq.new().isTwosidedGB(ff);
4549           kind = "field|nocom"
4550        else 
4551           b = SolvableGroebnerBasePseudoSeq.new(cofac).isTwosidedGB(ff);
4552           kind = "pseudo"
4553        end
4554     end
4555     t = System.currentTimeMillis() - t;
4556     puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 
4557     return b;
4558 end
isZERO() click to toggle source

Test if ideal is zero.

     # File examples/jas.rb
4446 def isZERO()
4447     s = SolvableIdeal.new(@pset);
4448     return s.isZERO(); 
4449 end
leftGB() click to toggle source

Compute a left Groebner base.

     # File examples/jas.rb
4454 def leftGB()
4455     #if ideal != nil
4456     #   return SolvIdeal.new(@ring,"",@ideal.leftGB());
4457     #end
4458     cofac = @ring.ring.coFac;
4459     ff = @pset.list;
4460     kind = "";
4461     t = System.currentTimeMillis();
4462     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4463        gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).leftGB(ff);
4464        kind = "pseudoRec"
4465     else 
4466        if cofac.isField() or not cofac.isCommutative()
4467           gg = SolvableGroebnerBaseSeq.new().leftGB(ff);
4468           kind = "field|nocom"
4469        else
4470           gg = SolvableGroebnerBasePseudoSeq.new(cofac).leftGB(ff);
4471           kind = "pseudo"
4472        end
4473     end
4474     t = System.currentTimeMillis() - t;
4475     puts "sequential(#{kind}) leftGB executed in #{t} ms\n"; 
4476     return SolvIdeal.new(@ring,"",gg);
4477 end
leftReduction(p) click to toggle source

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

     # File examples/jas.rb
4692 def leftReduction(p)
4693     s = @pset;
4694     gg = s.list;
4695     if p.is_a? RingElem
4696         p = p.elem;
4697     end
4698     n = SolvableReductionSeq.new().leftNormalform(gg,p);
4699     return RingElem.new(n);
4700 end
leftSyzygy() click to toggle source

Left Syzygy of generating polynomials.

     # File examples/jas.rb
4748 def leftSyzygy()
4749     p = @pset;
4750     l = p.list;
4751     t = System.currentTimeMillis();
4752     s = SolvableSyzygySeq.new(p.ring.coFac).leftZeroRelationsArbitrary( l );
4753     m = SolvableModule.new("",p.ring);
4754     t = System.currentTimeMillis() - t;
4755     puts "executed leftSyzygy in #{t} ms\n"; 
4756     return SolvableSubModule.new(m,"",s);
4757 end
parLeftGB(th) click to toggle source

Compute a left Groebner base in parallel.

     # File examples/jas.rb
4718 def parLeftGB(th)
4719     s = @pset;
4720     ff = s.list;
4721     bbpar = SolvableGroebnerBaseParallel.new(th);
4722     t = System.currentTimeMillis();
4723     gg = bbpar.leftGB(ff);
4724     t = System.currentTimeMillis() - t;
4725     bbpar.terminate();
4726     puts "parallel #{th} leftGB executed in #{t} ms\n"; 
4727     return SolvIdeal.new(@ring,"",gg);
4728 end
parTwosidedGB(th) click to toggle source

Compute a two-sided Groebner base in parallel.

     # File examples/jas.rb
4733 def parTwosidedGB(th)
4734     s = @pset;
4735     ff = s.list;
4736     bbpar = SolvableGroebnerBaseParallel.new(th);
4737     t = System.currentTimeMillis();
4738     gg = bbpar.twosidedGB(ff);
4739     t = System.currentTimeMillis() - t;
4740     bbpar.terminate();
4741     puts "parallel #{th} twosidedGB executed in #{t} ms\n"; 
4742     return SolvIdeal.new(@ring,"",gg);
4743 end
rightGB() click to toggle source

Compute a right Groebner base.

     # File examples/jas.rb
4563 def rightGB()
4564     cofac = @ring.ring.coFac;
4565     ff = @pset.list;
4566     kind = "";
4567     t = System.currentTimeMillis();
4568     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4569        gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).rightGB(ff);
4570        kind = "pseudoRec"
4571     else
4572        if cofac.isField() or not cofac.isCommutative()
4573           gg = SolvableGroebnerBaseSeq.new().rightGB(ff);
4574           kind = "field|nocom"
4575        else 
4576           gg = SolvableGroebnerBasePseudoSeq.new(cofac).rightGB(ff);
4577           kind = "pseudo"
4578        end
4579     end
4580     t = System.currentTimeMillis() - t;
4581     puts "sequential(#{kind}) rightGB executed in #{t} ms\n"; 
4582     return SolvIdeal.new(@ring,"",gg);
4583 end
rightReduction(p) click to toggle source

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

     # File examples/jas.rb
4705 def rightReduction(p)
4706     s = @pset;
4707     gg = s.list;
4708     if p.is_a? RingElem
4709         p = p.elem;
4710     end
4711     n = SolvableReductionSeq.new().rightNormalform(gg,p);
4712     return RingElem.new(n);
4713 end
rightSyzygy() click to toggle source

Right Syzygy of generating polynomials.

     # File examples/jas.rb
4762 def rightSyzygy()
4763     p = @pset;
4764     l = p.list;
4765     t = System.currentTimeMillis();
4766     s = SolvableSyzygySeq.new(p.ring.coFac).rightZeroRelationsArbitrary( l );
4767     m = SolvableModule.new("",p.ring);
4768     t = System.currentTimeMillis() - t;
4769     puts "executed rightSyzygy in #{t} ms\n"; 
4770     return SolvableSubModule.new(m,"",s);
4771 end
sum(other) click to toggle source

Compute the sum of this and the other ideal.

     # File examples/jas.rb
4632 def sum(other)
4633     s = SolvableIdeal.new(@pset);
4634     t = SolvableIdeal.new(other.pset);
4635     nn = s.sum( t );
4636     return SolvIdeal.new(@ring,"",nn.getList());
4637 end
toQuotientCoefficients() click to toggle source

Convert to polynomials with SolvableQuotient coefficients.

     # File examples/jas.rb
4652 def toQuotientCoefficients()
4653     if @pset.ring.coFac.is_a? SolvableResidueRing
4654        cf = @pset.ring.coFac.ring;
4655     elsif @pset.ring.coFac.is_a? GenSolvablePolynomialRing
4656        cf = @pset.ring.coFac;
4657     #elsif @pset.ring.coFac.is_a? GenPolynomialRing
4658     #   cf = @pset.ring.coFac;
4659     #   puts "cf = " + cf.toScript();
4660     else
4661        return self;
4662     end
4663     rrel = @pset.ring.table.relationList() + @pset.ring.polCoeff.coeffTable.relationList();
4664     #puts "rrel = " + str(rrel);
4665     qf = SolvableQuotientRing.new(cf);
4666     qr = QuotSolvablePolynomialRing.new(qf,@pset.ring);
4667     #puts "qr = " + str(qr);
4668     qrel = rrel.map { |r| RingElem.new(qr.fromPolyCoefficients(r)) };
4669     #puts "qrel = " + str(qrel);
4670     qring = SolvPolyRing.new(qf,@ring.ring.getVars(),@ring.ring.tord,qrel);
4671     #puts "qring = " + str(qring);
4672     qlist = @list.map { |r| qr.fromPolyCoefficients(@ring.ring.toPolyCoefficients(r)) };
4673     qlist = qlist.map { |r| RingElem.new(r) };
4674     return SolvIdeal.new(qring,"",qlist);
4675 end
to_s() click to toggle source

Create a string representation.

     # File examples/jas.rb
4411 def to_s()
4412     return @pset.toScript();
4413 end
twosidedGB() click to toggle source

Compute a two-sided Groebner base.

     # File examples/jas.rb
4507 def twosidedGB()
4508     cofac = @ring.ring.coFac;
4509     ff = @pset.list;
4510     kind = "";
4511     t = System.currentTimeMillis();
4512     if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
4513        gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).twosidedGB(ff);
4514        kind = "pseudoRec"
4515     else 
4516        #puts "two-sided: " + cofac.to_s
4517        if cofac.is_a? WordResidue  #Ring
4518           gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff);
4519           kind = "pseudo"
4520        else 
4521           if cofac.isField() or not cofac.isCommutative()
4522              gg = SolvableGroebnerBaseSeq.new().twosidedGB(ff);
4523              kind = "field|nocom"
4524           else
4525              gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff);
4526              kind = "pseudo"
4527           end
4528        end
4529     end
4530     t = System.currentTimeMillis() - t;
4531     puts "sequential(#{kind}) twosidedGB executed in #{t} ms\n"; 
4532     return SolvIdeal.new(@ring,"",gg);
4533 end
univariates() click to toggle source

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

     # File examples/jas.rb
4642 def univariates()
4643     s = SolvableIdeal.new(@pset);
4644     ll = s.constructUnivariate();
4645     nn = ll.map {|e| RingElem.new(e) };
4646     return nn;
4647 end