class JAS::SolvIdeal
Represents a JAS solvable polynomial ideal.
Methods for left, right two-sided Groebner basees and others.
Attributes
the Java ordered polynomial list, polynomial ring, and polynomial list
the Java ordered polynomial list, polynomial ring, and polynomial list
the Java ordered polynomial list, polynomial ring, and polynomial list
Public Class Methods
Constructor for an ideal in a solvable polynomial ring.
# File examples/jas.rb 4026 def initialize(ring,ringstr="",list=nil) 4027 @ring = ring; 4028 if list == nil 4029 sr = StringReader.new( ringstr ); 4030 tok = GenPolynomialTokenizer.new(ring.ring,sr); 4031 @list = tok.nextSolvablePolynomialList(); 4032 else 4033 @list = rbarray2arraylist(list,rec=1); 4034 end 4035 @pset = OrderedPolynomialList.new(ring.ring,@list); 4036 #@ideal = SolvableIdeal.new(@pset); 4037 end
Public Instance Methods
Compare two ideals.
# File examples/jas.rb 4049 def <=>(other) 4050 s = SolvableIdeal.new(@pset); 4051 o = SolvableIdeal.new(other.pset); 4052 return s.compareTo(o); 4053 end
Test if two ideals are equal.
# File examples/jas.rb 4058 def ==(other) 4059 if not other.is_a? SolvIdeal 4060 return false; 4061 end 4062 s, o = self, other; 4063 return (s <=> o) == 0; 4064 end
Compute the intersection of this and the other ideal.
# File examples/jas.rb 4253 def intersect(other) 4254 s = SolvableIdeal.new(@pset); 4255 t = SolvableIdeal.new(other.pset); 4256 nn = s.intersect( t ); 4257 return SolvIdeal.new(@ring,"",nn.getList()); 4258 end
Compute the intersection of this and a polynomial ring.
# File examples/jas.rb 4244 def intersectRing(ring) 4245 s = SolvableIdeal.new(@pset); 4246 nn = s.intersect(ring.ring); 4247 return SolvIdeal.new(@ring,"",nn.getList()); 4248 end
Compute the inverse polynomial with respect to this twosided ideal.
# File examples/jas.rb 4311 def inverse(p) 4312 if p.is_a? RingElem 4313 p = p.elem; 4314 end 4315 s = SolvableIdeal.new(@pset); 4316 i = s.inverse(p); 4317 return RingElem.new(i); 4318 end
Test if this is a left Groebner base.
# File examples/jas.rb 4113 def isLeftGB() 4114 cofac = @ring.ring.coFac; 4115 ff = @pset.list; 4116 kind = ""; 4117 t = System.currentTimeMillis(); 4118 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4119 b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isLeftGB(ff); 4120 kind = "pseudoRec" 4121 else 4122 if cofac.isField() or not cofac.isCommutative() 4123 b = SolvableGroebnerBaseSeq.new().isLeftGB(ff); 4124 kind = "field|nocom" 4125 else 4126 b = SolvableGroebnerBasePseudoSeq.new(cofac).isLeftGB(ff); 4127 kind = "pseudo" 4128 end 4129 end 4130 t = System.currentTimeMillis() - t; 4131 puts "isLeftGB(#{kind}) = #{b} executed in #{t} ms\n"; 4132 return b; 4133 end
Test if this is a left syzygy of the module in m.
# File examples/jas.rb 4407 def isLeftSyzygy(m) 4408 p = @pset; 4409 g = p.list; 4410 l = m.list; 4411 #puts "l = #{l}"; 4412 #puts "g = #{g}"; 4413 t = System.currentTimeMillis(); 4414 z = SolvableSyzygySeq.new(p.ring.coFac).isLeftZeroRelation( l, g ); 4415 t = System.currentTimeMillis() - t; 4416 puts "executed isLeftSyzygy in #{t} ms\n"; 4417 return z; 4418 end
Test if ideal is one.
# File examples/jas.rb 4069 def isONE() 4070 s = SolvableIdeal.new(@pset); 4071 return s.isONE(); 4072 end
Test if this is a right Groebner base.
# File examples/jas.rb 4219 def isRightGB() 4220 cofac = @ring.ring.coFac; 4221 ff = @pset.list; 4222 kind = ""; 4223 t = System.currentTimeMillis(); 4224 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4225 b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isRightGB(ff); 4226 kind = "pseudoRec" 4227 else 4228 if cofac.isField() or not cofac.isCommutative() 4229 b = SolvableGroebnerBaseSeq.new().isRightGB(ff); 4230 kind = "field|nocom" 4231 else 4232 b = SolvableGroebnerBasePseudoSeq.new(cofac).isRightGB(ff); 4233 kind = "pseudo" 4234 end 4235 end 4236 t = System.currentTimeMillis() - t; 4237 puts "isRightGB(#{kind}) = #{b} executed in #{t} ms\n"; 4238 return b; 4239 end
Test if this is a right syzygy of the module in m.
# File examples/jas.rb 4423 def isRightSyzygy(m) 4424 p = @pset; 4425 g = p.list; 4426 l = m.list; 4427 #puts "l = #{l}"; 4428 #puts "g = #{g}"; 4429 t = System.currentTimeMillis(); 4430 z = SolvableSyzygySeq.new(p.ring.coFac).isRightZeroRelation( l, g ); 4431 t = System.currentTimeMillis() - t; 4432 puts "executed isRightSyzygy in #{t} ms\n"; 4433 return z; 4434 end
Test if this is a two-sided Groebner base.
# File examples/jas.rb 4169 def isTwosidedGB() 4170 cofac = @ring.ring.coFac; 4171 ff = @pset.list; 4172 kind = ""; 4173 t = System.currentTimeMillis(); 4174 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4175 b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isTwosidedGB(ff); 4176 kind = "pseudoRec" 4177 else 4178 if cofac.isField() or not cofac.isCommutative() 4179 b = SolvableGroebnerBaseSeq.new().isTwosidedGB(ff); 4180 kind = "field|nocom" 4181 else 4182 b = SolvableGroebnerBasePseudoSeq.new(cofac).isTwosidedGB(ff); 4183 kind = "pseudo" 4184 end 4185 end 4186 t = System.currentTimeMillis() - t; 4187 puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 4188 return b; 4189 end
Test if ideal is zero.
# File examples/jas.rb 4077 def isZERO() 4078 s = SolvableIdeal.new(@pset); 4079 return s.isZERO(); 4080 end
Compute a left Groebner base.
# File examples/jas.rb 4085 def leftGB() 4086 #if ideal != nil 4087 # return SolvIdeal.new(@ring,"",@ideal.leftGB()); 4088 #end 4089 cofac = @ring.ring.coFac; 4090 ff = @pset.list; 4091 kind = ""; 4092 t = System.currentTimeMillis(); 4093 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4094 gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).leftGB(ff); 4095 kind = "pseudoRec" 4096 else 4097 if cofac.isField() or not cofac.isCommutative() 4098 gg = SolvableGroebnerBaseSeq.new().leftGB(ff); 4099 kind = "field|nocom" 4100 else 4101 gg = SolvableGroebnerBasePseudoSeq.new(cofac).leftGB(ff); 4102 kind = "pseudo" 4103 end 4104 end 4105 t = System.currentTimeMillis() - t; 4106 puts "sequential(#{kind}) leftGB executed in #{t} ms\n"; 4107 return SolvIdeal.new(@ring,"",gg); 4108 end
Compute a left normal form of p with respect to this ideal.
# File examples/jas.rb 4323 def leftReduction(p) 4324 s = @pset; 4325 gg = s.list; 4326 if p.is_a? RingElem 4327 p = p.elem; 4328 end 4329 n = SolvableReductionSeq.new().leftNormalform(gg,p); 4330 return RingElem.new(n); 4331 end
Left Syzygy of generating polynomials.
# File examples/jas.rb 4379 def leftSyzygy() 4380 p = @pset; 4381 l = p.list; 4382 t = System.currentTimeMillis(); 4383 s = SolvableSyzygySeq.new(p.ring.coFac).leftZeroRelationsArbitrary( l ); 4384 m = SolvableModule.new("",p.ring); 4385 t = System.currentTimeMillis() - t; 4386 puts "executed leftSyzygy in #{t} ms\n"; 4387 return SolvableSubModule.new(m,"",s); 4388 end
Compute a left Groebner base in parallel.
# File examples/jas.rb 4349 def parLeftGB(th) 4350 s = @pset; 4351 ff = s.list; 4352 bbpar = SolvableGroebnerBaseParallel.new(th); 4353 t = System.currentTimeMillis(); 4354 gg = bbpar.leftGB(ff); 4355 t = System.currentTimeMillis() - t; 4356 bbpar.terminate(); 4357 puts "parallel #{th} leftGB executed in #{t} ms\n"; 4358 return SolvIdeal.new(@ring,"",gg); 4359 end
Compute a two-sided Groebner base in parallel.
# File examples/jas.rb 4364 def parTwosidedGB(th) 4365 s = @pset; 4366 ff = s.list; 4367 bbpar = SolvableGroebnerBaseParallel.new(th); 4368 t = System.currentTimeMillis(); 4369 gg = bbpar.twosidedGB(ff); 4370 t = System.currentTimeMillis() - t; 4371 bbpar.terminate(); 4372 puts "parallel #{th} twosidedGB executed in #{t} ms\n"; 4373 return SolvIdeal.new(@ring,"",gg); 4374 end
Compute a right Groebner base.
# File examples/jas.rb 4194 def rightGB() 4195 cofac = @ring.ring.coFac; 4196 ff = @pset.list; 4197 kind = ""; 4198 t = System.currentTimeMillis(); 4199 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4200 gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).rightGB(ff); 4201 kind = "pseudoRec" 4202 else 4203 if cofac.isField() or not cofac.isCommutative() 4204 gg = SolvableGroebnerBaseSeq.new().rightGB(ff); 4205 kind = "field|nocom" 4206 else 4207 gg = SolvableGroebnerBasePseudoSeq.new(cofac).rightGB(ff); 4208 kind = "pseudo" 4209 end 4210 end 4211 t = System.currentTimeMillis() - t; 4212 puts "sequential(#{kind}) rightGB executed in #{t} ms\n"; 4213 return SolvIdeal.new(@ring,"",gg); 4214 end
Compute a right normal form of p with respect to this ideal.
# File examples/jas.rb 4336 def rightReduction(p) 4337 s = @pset; 4338 gg = s.list; 4339 if p.is_a? RingElem 4340 p = p.elem; 4341 end 4342 n = SolvableReductionSeq.new().rightNormalform(gg,p); 4343 return RingElem.new(n); 4344 end
Right Syzygy of generating polynomials.
# File examples/jas.rb 4393 def rightSyzygy() 4394 p = @pset; 4395 l = p.list; 4396 t = System.currentTimeMillis(); 4397 s = SolvableSyzygySeq.new(p.ring.coFac).rightZeroRelationsArbitrary( l ); 4398 m = SolvableModule.new("",p.ring); 4399 t = System.currentTimeMillis() - t; 4400 puts "executed rightSyzygy in #{t} ms\n"; 4401 return SolvableSubModule.new(m,"",s); 4402 end
Compute the sum of this and the other ideal.
# File examples/jas.rb 4263 def sum(other) 4264 s = SolvableIdeal.new(@pset); 4265 t = SolvableIdeal.new(other.pset); 4266 nn = s.sum( t ); 4267 return SolvIdeal.new(@ring,"",nn.getList()); 4268 end
Convert to polynomials with SolvableQuotient coefficients.
# File examples/jas.rb 4283 def toQuotientCoefficients() 4284 if @pset.ring.coFac.is_a? SolvableResidueRing 4285 cf = @pset.ring.coFac.ring; 4286 elsif @pset.ring.coFac.is_a? GenSolvablePolynomialRing 4287 cf = @pset.ring.coFac; 4288 #elsif @pset.ring.coFac.is_a? GenPolynomialRing 4289 # cf = @pset.ring.coFac; 4290 # puts "cf = " + cf.toScript(); 4291 else 4292 return self; 4293 end 4294 rrel = @pset.ring.table.relationList() + @pset.ring.polCoeff.coeffTable.relationList(); 4295 #puts "rrel = " + str(rrel); 4296 qf = SolvableQuotientRing.new(cf); 4297 qr = QuotSolvablePolynomialRing.new(qf,@pset.ring); 4298 #puts "qr = " + str(qr); 4299 qrel = rrel.map { |r| RingElem.new(qr.fromPolyCoefficients(r)) }; 4300 #puts "qrel = " + str(qrel); 4301 qring = SolvPolyRing.new(qf,@ring.ring.getVars(),@ring.ring.tord,qrel); 4302 #puts "qring = " + str(qring); 4303 qlist = @list.map { |r| qr.fromPolyCoefficients(@ring.ring.toPolyCoefficients(r)) }; 4304 qlist = qlist.map { |r| RingElem.new(r) }; 4305 return SolvIdeal.new(qring,"",qlist); 4306 end
Create a string representation.
# File examples/jas.rb 4042 def to_s() 4043 return @pset.toScript(); 4044 end
Compute a two-sided Groebner base.
# File examples/jas.rb 4138 def twosidedGB() 4139 cofac = @ring.ring.coFac; 4140 ff = @pset.list; 4141 kind = ""; 4142 t = System.currentTimeMillis(); 4143 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4144 gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).twosidedGB(ff); 4145 kind = "pseudoRec" 4146 else 4147 #puts "two-sided: " + cofac.to_s 4148 if cofac.is_a? WordResidue #Ring 4149 gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff); 4150 kind = "pseudo" 4151 else 4152 if cofac.isField() or not cofac.isCommutative() 4153 gg = SolvableGroebnerBaseSeq.new().twosidedGB(ff); 4154 kind = "field|nocom" 4155 else 4156 gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff); 4157 kind = "pseudo" 4158 end 4159 end 4160 end 4161 t = System.currentTimeMillis() - t; 4162 puts "sequential(#{kind}) twosidedGB executed in #{t} ms\n"; 4163 return SolvIdeal.new(@ring,"",gg); 4164 end
Compute the univariate polynomials in each variable of this twosided ideal.
# File examples/jas.rb 4273 def univariates() 4274 s = SolvableIdeal.new(@pset); 4275 ll = s.constructUnivariate(); 4276 nn = ll.map {|e| RingElem.new(e) }; 4277 return nn; 4278 end