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 4079 def initialize(ring,ringstr="",list=nil) 4080 @ring = ring; 4081 if list == nil 4082 sr = StringReader.new( ringstr ); 4083 tok = GenPolynomialTokenizer.new(ring.ring,sr); 4084 @list = tok.nextSolvablePolynomialList(); 4085 else 4086 @list = rbarray2arraylist(list,rec=1); 4087 end 4088 @pset = OrderedPolynomialList.new(ring.ring,@list); 4089 #@ideal = SolvableIdeal.new(@pset); 4090 end
Public Instance Methods
Compare two ideals.
# File examples/jas.rb 4102 def <=>(other) 4103 s = SolvableIdeal.new(@pset); 4104 o = SolvableIdeal.new(other.pset); 4105 return s.compareTo(o); 4106 end
Test if two ideals are equal.
# File examples/jas.rb 4111 def ==(other) 4112 if not other.is_a? SolvIdeal 4113 return false; 4114 end 4115 s, o = self, other; 4116 return (s <=> o) == 0; 4117 end
Compute the intersection of this and the other ideal.
# File examples/jas.rb 4306 def intersect(other) 4307 s = SolvableIdeal.new(@pset); 4308 t = SolvableIdeal.new(other.pset); 4309 nn = s.intersect( t ); 4310 return SolvIdeal.new(@ring,"",nn.getList()); 4311 end
Compute the intersection of this and a polynomial ring.
# File examples/jas.rb 4297 def intersectRing(ring) 4298 s = SolvableIdeal.new(@pset); 4299 nn = s.intersect(ring.ring); 4300 return SolvIdeal.new(@ring,"",nn.getList()); 4301 end
Compute the inverse polynomial with respect to this twosided ideal.
# File examples/jas.rb 4364 def inverse(p) 4365 if p.is_a? RingElem 4366 p = p.elem; 4367 end 4368 s = SolvableIdeal.new(@pset); 4369 i = s.inverse(p); 4370 return RingElem.new(i); 4371 end
Test if this is a left Groebner base.
# File examples/jas.rb 4166 def isLeftGB() 4167 cofac = @ring.ring.coFac; 4168 ff = @pset.list; 4169 kind = ""; 4170 t = System.currentTimeMillis(); 4171 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4172 b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isLeftGB(ff); 4173 kind = "pseudoRec" 4174 else 4175 if cofac.isField() or not cofac.isCommutative() 4176 b = SolvableGroebnerBaseSeq.new().isLeftGB(ff); 4177 kind = "field|nocom" 4178 else 4179 b = SolvableGroebnerBasePseudoSeq.new(cofac).isLeftGB(ff); 4180 kind = "pseudo" 4181 end 4182 end 4183 t = System.currentTimeMillis() - t; 4184 puts "isLeftGB(#{kind}) = #{b} executed in #{t} ms\n"; 4185 return b; 4186 end
Test if this is a left syzygy of the module in m.
# File examples/jas.rb 4460 def isLeftSyzygy(m) 4461 p = @pset; 4462 g = p.list; 4463 l = m.list; 4464 #puts "l = #{l}"; 4465 #puts "g = #{g}"; 4466 t = System.currentTimeMillis(); 4467 z = SolvableSyzygySeq.new(p.ring.coFac).isLeftZeroRelation( l, g ); 4468 t = System.currentTimeMillis() - t; 4469 puts "executed isLeftSyzygy in #{t} ms\n"; 4470 return z; 4471 end
Test if ideal is one.
# File examples/jas.rb 4122 def isONE() 4123 s = SolvableIdeal.new(@pset); 4124 return s.isONE(); 4125 end
Test if this is a right Groebner base.
# File examples/jas.rb 4272 def isRightGB() 4273 cofac = @ring.ring.coFac; 4274 ff = @pset.list; 4275 kind = ""; 4276 t = System.currentTimeMillis(); 4277 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4278 b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isRightGB(ff); 4279 kind = "pseudoRec" 4280 else 4281 if cofac.isField() or not cofac.isCommutative() 4282 b = SolvableGroebnerBaseSeq.new().isRightGB(ff); 4283 kind = "field|nocom" 4284 else 4285 b = SolvableGroebnerBasePseudoSeq.new(cofac).isRightGB(ff); 4286 kind = "pseudo" 4287 end 4288 end 4289 t = System.currentTimeMillis() - t; 4290 puts "isRightGB(#{kind}) = #{b} executed in #{t} ms\n"; 4291 return b; 4292 end
Test if this is a right syzygy of the module in m.
# File examples/jas.rb 4476 def isRightSyzygy(m) 4477 p = @pset; 4478 g = p.list; 4479 l = m.list; 4480 #puts "l = #{l}"; 4481 #puts "g = #{g}"; 4482 t = System.currentTimeMillis(); 4483 z = SolvableSyzygySeq.new(p.ring.coFac).isRightZeroRelation( l, g ); 4484 t = System.currentTimeMillis() - t; 4485 puts "executed isRightSyzygy in #{t} ms\n"; 4486 return z; 4487 end
Test if this is a two-sided Groebner base.
# File examples/jas.rb 4222 def isTwosidedGB() 4223 cofac = @ring.ring.coFac; 4224 ff = @pset.list; 4225 kind = ""; 4226 t = System.currentTimeMillis(); 4227 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4228 b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isTwosidedGB(ff); 4229 kind = "pseudoRec" 4230 else 4231 if cofac.isField() or not cofac.isCommutative() 4232 b = SolvableGroebnerBaseSeq.new().isTwosidedGB(ff); 4233 kind = "field|nocom" 4234 else 4235 b = SolvableGroebnerBasePseudoSeq.new(cofac).isTwosidedGB(ff); 4236 kind = "pseudo" 4237 end 4238 end 4239 t = System.currentTimeMillis() - t; 4240 puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 4241 return b; 4242 end
Test if ideal is zero.
# File examples/jas.rb 4130 def isZERO() 4131 s = SolvableIdeal.new(@pset); 4132 return s.isZERO(); 4133 end
Compute a left Groebner base.
# File examples/jas.rb 4138 def leftGB() 4139 #if ideal != nil 4140 # return SolvIdeal.new(@ring,"",@ideal.leftGB()); 4141 #end 4142 cofac = @ring.ring.coFac; 4143 ff = @pset.list; 4144 kind = ""; 4145 t = System.currentTimeMillis(); 4146 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4147 gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).leftGB(ff); 4148 kind = "pseudoRec" 4149 else 4150 if cofac.isField() or not cofac.isCommutative() 4151 gg = SolvableGroebnerBaseSeq.new().leftGB(ff); 4152 kind = "field|nocom" 4153 else 4154 gg = SolvableGroebnerBasePseudoSeq.new(cofac).leftGB(ff); 4155 kind = "pseudo" 4156 end 4157 end 4158 t = System.currentTimeMillis() - t; 4159 puts "sequential(#{kind}) leftGB executed in #{t} ms\n"; 4160 return SolvIdeal.new(@ring,"",gg); 4161 end
Compute a left normal form of p with respect to this ideal.
# File examples/jas.rb 4376 def leftReduction(p) 4377 s = @pset; 4378 gg = s.list; 4379 if p.is_a? RingElem 4380 p = p.elem; 4381 end 4382 n = SolvableReductionSeq.new().leftNormalform(gg,p); 4383 return RingElem.new(n); 4384 end
Left Syzygy of generating polynomials.
# File examples/jas.rb 4432 def leftSyzygy() 4433 p = @pset; 4434 l = p.list; 4435 t = System.currentTimeMillis(); 4436 s = SolvableSyzygySeq.new(p.ring.coFac).leftZeroRelationsArbitrary( l ); 4437 m = SolvableModule.new("",p.ring); 4438 t = System.currentTimeMillis() - t; 4439 puts "executed leftSyzygy in #{t} ms\n"; 4440 return SolvableSubModule.new(m,"",s); 4441 end
Compute a left Groebner base in parallel.
# File examples/jas.rb 4402 def parLeftGB(th) 4403 s = @pset; 4404 ff = s.list; 4405 bbpar = SolvableGroebnerBaseParallel.new(th); 4406 t = System.currentTimeMillis(); 4407 gg = bbpar.leftGB(ff); 4408 t = System.currentTimeMillis() - t; 4409 bbpar.terminate(); 4410 puts "parallel #{th} leftGB executed in #{t} ms\n"; 4411 return SolvIdeal.new(@ring,"",gg); 4412 end
Compute a two-sided Groebner base in parallel.
# File examples/jas.rb 4417 def parTwosidedGB(th) 4418 s = @pset; 4419 ff = s.list; 4420 bbpar = SolvableGroebnerBaseParallel.new(th); 4421 t = System.currentTimeMillis(); 4422 gg = bbpar.twosidedGB(ff); 4423 t = System.currentTimeMillis() - t; 4424 bbpar.terminate(); 4425 puts "parallel #{th} twosidedGB executed in #{t} ms\n"; 4426 return SolvIdeal.new(@ring,"",gg); 4427 end
Compute a right Groebner base.
# File examples/jas.rb 4247 def rightGB() 4248 cofac = @ring.ring.coFac; 4249 ff = @pset.list; 4250 kind = ""; 4251 t = System.currentTimeMillis(); 4252 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4253 gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).rightGB(ff); 4254 kind = "pseudoRec" 4255 else 4256 if cofac.isField() or not cofac.isCommutative() 4257 gg = SolvableGroebnerBaseSeq.new().rightGB(ff); 4258 kind = "field|nocom" 4259 else 4260 gg = SolvableGroebnerBasePseudoSeq.new(cofac).rightGB(ff); 4261 kind = "pseudo" 4262 end 4263 end 4264 t = System.currentTimeMillis() - t; 4265 puts "sequential(#{kind}) rightGB executed in #{t} ms\n"; 4266 return SolvIdeal.new(@ring,"",gg); 4267 end
Compute a right normal form of p with respect to this ideal.
# File examples/jas.rb 4389 def rightReduction(p) 4390 s = @pset; 4391 gg = s.list; 4392 if p.is_a? RingElem 4393 p = p.elem; 4394 end 4395 n = SolvableReductionSeq.new().rightNormalform(gg,p); 4396 return RingElem.new(n); 4397 end
Right Syzygy of generating polynomials.
# File examples/jas.rb 4446 def rightSyzygy() 4447 p = @pset; 4448 l = p.list; 4449 t = System.currentTimeMillis(); 4450 s = SolvableSyzygySeq.new(p.ring.coFac).rightZeroRelationsArbitrary( l ); 4451 m = SolvableModule.new("",p.ring); 4452 t = System.currentTimeMillis() - t; 4453 puts "executed rightSyzygy in #{t} ms\n"; 4454 return SolvableSubModule.new(m,"",s); 4455 end
Compute the sum of this and the other ideal.
# File examples/jas.rb 4316 def sum(other) 4317 s = SolvableIdeal.new(@pset); 4318 t = SolvableIdeal.new(other.pset); 4319 nn = s.sum( t ); 4320 return SolvIdeal.new(@ring,"",nn.getList()); 4321 end
Convert to polynomials with SolvableQuotient coefficients.
# File examples/jas.rb 4336 def toQuotientCoefficients() 4337 if @pset.ring.coFac.is_a? SolvableResidueRing 4338 cf = @pset.ring.coFac.ring; 4339 elsif @pset.ring.coFac.is_a? GenSolvablePolynomialRing 4340 cf = @pset.ring.coFac; 4341 #elsif @pset.ring.coFac.is_a? GenPolynomialRing 4342 # cf = @pset.ring.coFac; 4343 # puts "cf = " + cf.toScript(); 4344 else 4345 return self; 4346 end 4347 rrel = @pset.ring.table.relationList() + @pset.ring.polCoeff.coeffTable.relationList(); 4348 #puts "rrel = " + str(rrel); 4349 qf = SolvableQuotientRing.new(cf); 4350 qr = QuotSolvablePolynomialRing.new(qf,@pset.ring); 4351 #puts "qr = " + str(qr); 4352 qrel = rrel.map { |r| RingElem.new(qr.fromPolyCoefficients(r)) }; 4353 #puts "qrel = " + str(qrel); 4354 qring = SolvPolyRing.new(qf,@ring.ring.getVars(),@ring.ring.tord,qrel); 4355 #puts "qring = " + str(qring); 4356 qlist = @list.map { |r| qr.fromPolyCoefficients(@ring.ring.toPolyCoefficients(r)) }; 4357 qlist = qlist.map { |r| RingElem.new(r) }; 4358 return SolvIdeal.new(qring,"",qlist); 4359 end
Create a string representation.
# File examples/jas.rb 4095 def to_s() 4096 return @pset.toScript(); 4097 end
Compute a two-sided Groebner base.
# File examples/jas.rb 4191 def twosidedGB() 4192 cofac = @ring.ring.coFac; 4193 ff = @pset.list; 4194 kind = ""; 4195 t = System.currentTimeMillis(); 4196 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4197 gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).twosidedGB(ff); 4198 kind = "pseudoRec" 4199 else 4200 #puts "two-sided: " + cofac.to_s 4201 if cofac.is_a? WordResidue #Ring 4202 gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff); 4203 kind = "pseudo" 4204 else 4205 if cofac.isField() or not cofac.isCommutative() 4206 gg = SolvableGroebnerBaseSeq.new().twosidedGB(ff); 4207 kind = "field|nocom" 4208 else 4209 gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff); 4210 kind = "pseudo" 4211 end 4212 end 4213 end 4214 t = System.currentTimeMillis() - t; 4215 puts "sequential(#{kind}) twosidedGB executed in #{t} ms\n"; 4216 return SolvIdeal.new(@ring,"",gg); 4217 end
Compute the univariate polynomials in each variable of this twosided ideal.
# File examples/jas.rb 4326 def univariates() 4327 s = SolvableIdeal.new(@pset); 4328 ll = s.constructUnivariate(); 4329 nn = ll.map {|e| RingElem.new(e) }; 4330 return nn; 4331 end