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 4267 def initialize(ring,ringstr="",list=nil) 4268 @ring = ring; 4269 if list == nil 4270 sr = StringReader.new( ringstr ); 4271 tok = GenPolynomialTokenizer.new(ring.ring,sr); 4272 @list = tok.nextSolvablePolynomialList(); 4273 else 4274 @list = rbarray2arraylist(list,rec=1); 4275 end 4276 @pset = OrderedPolynomialList.new(ring.ring,@list); 4277 #@ideal = SolvableIdeal.new(@pset); 4278 end
Public Instance Methods
Compare two ideals.
# File examples/jas.rb 4290 def <=>(other) 4291 s = SolvableIdeal.new(@pset); 4292 o = SolvableIdeal.new(other.pset); 4293 return s.compareTo(o); 4294 end
Test if two ideals are equal.
# File examples/jas.rb 4299 def ==(other) 4300 if not other.is_a? SolvIdeal 4301 return false; 4302 end 4303 s, o = self, other; 4304 return (s <=> o) == 0; 4305 end
Compute the intersection of this and the other ideal.
# File examples/jas.rb 4494 def intersect(other) 4495 s = SolvableIdeal.new(@pset); 4496 t = SolvableIdeal.new(other.pset); 4497 nn = s.intersect( t ); 4498 return SolvIdeal.new(@ring,"",nn.getList()); 4499 end
Compute the intersection of this and a polynomial ring.
# File examples/jas.rb 4485 def intersectRing(ring) 4486 s = SolvableIdeal.new(@pset); 4487 nn = s.intersect(ring.ring); 4488 return SolvIdeal.new(@ring,"",nn.getList()); 4489 end
Compute the inverse polynomial with respect to this twosided ideal.
# File examples/jas.rb 4552 def inverse(p) 4553 if p.is_a? RingElem 4554 p = p.elem; 4555 end 4556 s = SolvableIdeal.new(@pset); 4557 i = s.inverse(p); 4558 return RingElem.new(i); 4559 end
Test if this is a left Groebner base.
# File examples/jas.rb 4354 def isLeftGB() 4355 cofac = @ring.ring.coFac; 4356 ff = @pset.list; 4357 kind = ""; 4358 t = System.currentTimeMillis(); 4359 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4360 b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isLeftGB(ff); 4361 kind = "pseudoRec" 4362 else 4363 if cofac.isField() or not cofac.isCommutative() 4364 b = SolvableGroebnerBaseSeq.new().isLeftGB(ff); 4365 kind = "field|nocom" 4366 else 4367 b = SolvableGroebnerBasePseudoSeq.new(cofac).isLeftGB(ff); 4368 kind = "pseudo" 4369 end 4370 end 4371 t = System.currentTimeMillis() - t; 4372 puts "isLeftGB(#{kind}) = #{b} executed in #{t} ms\n"; 4373 return b; 4374 end
Test if this is a left syzygy of the module in m.
# File examples/jas.rb 4648 def isLeftSyzygy(m) 4649 p = @pset; 4650 g = p.list; 4651 l = m.list; 4652 #puts "l = #{l}"; 4653 #puts "g = #{g}"; 4654 t = System.currentTimeMillis(); 4655 z = SolvableSyzygySeq.new(p.ring.coFac).isLeftZeroRelation( l, g ); 4656 t = System.currentTimeMillis() - t; 4657 puts "executed isLeftSyzygy in #{t} ms\n"; 4658 return z; 4659 end
Test if ideal is one.
# File examples/jas.rb 4310 def isONE() 4311 s = SolvableIdeal.new(@pset); 4312 return s.isONE(); 4313 end
Test if this is a right Groebner base.
# File examples/jas.rb 4460 def isRightGB() 4461 cofac = @ring.ring.coFac; 4462 ff = @pset.list; 4463 kind = ""; 4464 t = System.currentTimeMillis(); 4465 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4466 b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isRightGB(ff); 4467 kind = "pseudoRec" 4468 else 4469 if cofac.isField() or not cofac.isCommutative() 4470 b = SolvableGroebnerBaseSeq.new().isRightGB(ff); 4471 kind = "field|nocom" 4472 else 4473 b = SolvableGroebnerBasePseudoSeq.new(cofac).isRightGB(ff); 4474 kind = "pseudo" 4475 end 4476 end 4477 t = System.currentTimeMillis() - t; 4478 puts "isRightGB(#{kind}) = #{b} executed in #{t} ms\n"; 4479 return b; 4480 end
Test if this is a right syzygy of the module in m.
# File examples/jas.rb 4664 def isRightSyzygy(m) 4665 p = @pset; 4666 g = p.list; 4667 l = m.list; 4668 #puts "l = #{l}"; 4669 #puts "g = #{g}"; 4670 t = System.currentTimeMillis(); 4671 z = SolvableSyzygySeq.new(p.ring.coFac).isRightZeroRelation( l, g ); 4672 t = System.currentTimeMillis() - t; 4673 puts "executed isRightSyzygy in #{t} ms\n"; 4674 return z; 4675 end
Test if this is a two-sided Groebner base.
# File examples/jas.rb 4410 def isTwosidedGB() 4411 cofac = @ring.ring.coFac; 4412 ff = @pset.list; 4413 kind = ""; 4414 t = System.currentTimeMillis(); 4415 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4416 b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isTwosidedGB(ff); 4417 kind = "pseudoRec" 4418 else 4419 if cofac.isField() or not cofac.isCommutative() 4420 b = SolvableGroebnerBaseSeq.new().isTwosidedGB(ff); 4421 kind = "field|nocom" 4422 else 4423 b = SolvableGroebnerBasePseudoSeq.new(cofac).isTwosidedGB(ff); 4424 kind = "pseudo" 4425 end 4426 end 4427 t = System.currentTimeMillis() - t; 4428 puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 4429 return b; 4430 end
Test if ideal is zero.
# File examples/jas.rb 4318 def isZERO() 4319 s = SolvableIdeal.new(@pset); 4320 return s.isZERO(); 4321 end
Compute a left Groebner base.
# File examples/jas.rb 4326 def leftGB() 4327 #if ideal != nil 4328 # return SolvIdeal.new(@ring,"",@ideal.leftGB()); 4329 #end 4330 cofac = @ring.ring.coFac; 4331 ff = @pset.list; 4332 kind = ""; 4333 t = System.currentTimeMillis(); 4334 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4335 gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).leftGB(ff); 4336 kind = "pseudoRec" 4337 else 4338 if cofac.isField() or not cofac.isCommutative() 4339 gg = SolvableGroebnerBaseSeq.new().leftGB(ff); 4340 kind = "field|nocom" 4341 else 4342 gg = SolvableGroebnerBasePseudoSeq.new(cofac).leftGB(ff); 4343 kind = "pseudo" 4344 end 4345 end 4346 t = System.currentTimeMillis() - t; 4347 puts "sequential(#{kind}) leftGB executed in #{t} ms\n"; 4348 return SolvIdeal.new(@ring,"",gg); 4349 end
Compute a left normal form of p with respect to this ideal.
# File examples/jas.rb 4564 def leftReduction(p) 4565 s = @pset; 4566 gg = s.list; 4567 if p.is_a? RingElem 4568 p = p.elem; 4569 end 4570 n = SolvableReductionSeq.new().leftNormalform(gg,p); 4571 return RingElem.new(n); 4572 end
Left Syzygy of generating polynomials.
# File examples/jas.rb 4620 def leftSyzygy() 4621 p = @pset; 4622 l = p.list; 4623 t = System.currentTimeMillis(); 4624 s = SolvableSyzygySeq.new(p.ring.coFac).leftZeroRelationsArbitrary( l ); 4625 m = SolvableModule.new("",p.ring); 4626 t = System.currentTimeMillis() - t; 4627 puts "executed leftSyzygy in #{t} ms\n"; 4628 return SolvableSubModule.new(m,"",s); 4629 end
Compute a left Groebner base in parallel.
# File examples/jas.rb 4590 def parLeftGB(th) 4591 s = @pset; 4592 ff = s.list; 4593 bbpar = SolvableGroebnerBaseParallel.new(th); 4594 t = System.currentTimeMillis(); 4595 gg = bbpar.leftGB(ff); 4596 t = System.currentTimeMillis() - t; 4597 bbpar.terminate(); 4598 puts "parallel #{th} leftGB executed in #{t} ms\n"; 4599 return SolvIdeal.new(@ring,"",gg); 4600 end
Compute a two-sided Groebner base in parallel.
# File examples/jas.rb 4605 def parTwosidedGB(th) 4606 s = @pset; 4607 ff = s.list; 4608 bbpar = SolvableGroebnerBaseParallel.new(th); 4609 t = System.currentTimeMillis(); 4610 gg = bbpar.twosidedGB(ff); 4611 t = System.currentTimeMillis() - t; 4612 bbpar.terminate(); 4613 puts "parallel #{th} twosidedGB executed in #{t} ms\n"; 4614 return SolvIdeal.new(@ring,"",gg); 4615 end
Compute a right Groebner base.
# File examples/jas.rb 4435 def rightGB() 4436 cofac = @ring.ring.coFac; 4437 ff = @pset.list; 4438 kind = ""; 4439 t = System.currentTimeMillis(); 4440 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4441 gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).rightGB(ff); 4442 kind = "pseudoRec" 4443 else 4444 if cofac.isField() or not cofac.isCommutative() 4445 gg = SolvableGroebnerBaseSeq.new().rightGB(ff); 4446 kind = "field|nocom" 4447 else 4448 gg = SolvableGroebnerBasePseudoSeq.new(cofac).rightGB(ff); 4449 kind = "pseudo" 4450 end 4451 end 4452 t = System.currentTimeMillis() - t; 4453 puts "sequential(#{kind}) rightGB executed in #{t} ms\n"; 4454 return SolvIdeal.new(@ring,"",gg); 4455 end
Compute a right normal form of p with respect to this ideal.
# File examples/jas.rb 4577 def rightReduction(p) 4578 s = @pset; 4579 gg = s.list; 4580 if p.is_a? RingElem 4581 p = p.elem; 4582 end 4583 n = SolvableReductionSeq.new().rightNormalform(gg,p); 4584 return RingElem.new(n); 4585 end
Right Syzygy of generating polynomials.
# File examples/jas.rb 4634 def rightSyzygy() 4635 p = @pset; 4636 l = p.list; 4637 t = System.currentTimeMillis(); 4638 s = SolvableSyzygySeq.new(p.ring.coFac).rightZeroRelationsArbitrary( l ); 4639 m = SolvableModule.new("",p.ring); 4640 t = System.currentTimeMillis() - t; 4641 puts "executed rightSyzygy in #{t} ms\n"; 4642 return SolvableSubModule.new(m,"",s); 4643 end
Compute the sum of this and the other ideal.
# File examples/jas.rb 4504 def sum(other) 4505 s = SolvableIdeal.new(@pset); 4506 t = SolvableIdeal.new(other.pset); 4507 nn = s.sum( t ); 4508 return SolvIdeal.new(@ring,"",nn.getList()); 4509 end
Convert to polynomials with SolvableQuotient coefficients.
# File examples/jas.rb 4524 def toQuotientCoefficients() 4525 if @pset.ring.coFac.is_a? SolvableResidueRing 4526 cf = @pset.ring.coFac.ring; 4527 elsif @pset.ring.coFac.is_a? GenSolvablePolynomialRing 4528 cf = @pset.ring.coFac; 4529 #elsif @pset.ring.coFac.is_a? GenPolynomialRing 4530 # cf = @pset.ring.coFac; 4531 # puts "cf = " + cf.toScript(); 4532 else 4533 return self; 4534 end 4535 rrel = @pset.ring.table.relationList() + @pset.ring.polCoeff.coeffTable.relationList(); 4536 #puts "rrel = " + str(rrel); 4537 qf = SolvableQuotientRing.new(cf); 4538 qr = QuotSolvablePolynomialRing.new(qf,@pset.ring); 4539 #puts "qr = " + str(qr); 4540 qrel = rrel.map { |r| RingElem.new(qr.fromPolyCoefficients(r)) }; 4541 #puts "qrel = " + str(qrel); 4542 qring = SolvPolyRing.new(qf,@ring.ring.getVars(),@ring.ring.tord,qrel); 4543 #puts "qring = " + str(qring); 4544 qlist = @list.map { |r| qr.fromPolyCoefficients(@ring.ring.toPolyCoefficients(r)) }; 4545 qlist = qlist.map { |r| RingElem.new(r) }; 4546 return SolvIdeal.new(qring,"",qlist); 4547 end
Create a string representation.
# File examples/jas.rb 4283 def to_s() 4284 return @pset.toScript(); 4285 end
Compute a two-sided Groebner base.
# File examples/jas.rb 4379 def twosidedGB() 4380 cofac = @ring.ring.coFac; 4381 ff = @pset.list; 4382 kind = ""; 4383 t = System.currentTimeMillis(); 4384 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 4385 gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).twosidedGB(ff); 4386 kind = "pseudoRec" 4387 else 4388 #puts "two-sided: " + cofac.to_s 4389 if cofac.is_a? WordResidue #Ring 4390 gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff); 4391 kind = "pseudo" 4392 else 4393 if cofac.isField() or not cofac.isCommutative() 4394 gg = SolvableGroebnerBaseSeq.new().twosidedGB(ff); 4395 kind = "field|nocom" 4396 else 4397 gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff); 4398 kind = "pseudo" 4399 end 4400 end 4401 end 4402 t = System.currentTimeMillis() - t; 4403 puts "sequential(#{kind}) twosidedGB executed in #{t} ms\n"; 4404 return SolvIdeal.new(@ring,"",gg); 4405 end
Compute the univariate polynomials in each variable of this twosided ideal.
# File examples/jas.rb 4514 def univariates() 4515 s = SolvableIdeal.new(@pset); 4516 ll = s.constructUnivariate(); 4517 nn = ll.map {|e| RingElem.new(e) }; 4518 return nn; 4519 end