class JAS::WordPolyIdeal
Represents a JAS non-commutative polynomial ideal.
Methods for two-sided Groebner bases and others. Note: watch your step: check that jruby does not reorder multiplication.
Attributes
ideal[R]
the Java word polynomial ring, word polynomial list, word ideal
list[R]
the Java word polynomial ring, word polynomial list, word ideal
ring[R]
the Java word polynomial ring, word polynomial list, word ideal
Public Class Methods
new(ring,ringstr="",list=nil)
click to toggle source
Constructor for an ideal in a non-commutative polynomial ring.
# File examples/jas.rb 5833 def initialize(ring,ringstr="",list=nil) 5834 @ring = ring; 5835 if list == nil 5836 #raise "parse of non-commutative polynomials not implemented" 5837 sr = StringReader.new( ringstr ); 5838 tok = GenPolynomialTokenizer.new(sr); 5839 @list = tok.nextWordPolynomialList(ring.ring); 5840 @ideal = WordIdeal.new(ring.ring, @list); 5841 else 5842 if list.is_a? WordIdeal 5843 @list = list.list; 5844 @ideal = list; 5845 else 5846 @list = rbarray2arraylist(list, rec=1); 5847 @ideal = WordIdeal.new(ring.ring, @list); 5848 end 5849 end 5850 end
Public Instance Methods
<=>(other)
click to toggle source
Compare two ideals.
# File examples/jas.rb 5933 def <=>(other) 5934 s = @ideal; 5935 o = other.ideal; 5936 return s.compareTo(o); 5937 end
==(other)
click to toggle source
Test if two ideals are equal.
# File examples/jas.rb 5942 def ==(other) 5943 if not other.is_a? WordPolyIdeal 5944 return false; 5945 end 5946 s = @ideal; 5947 t = other.ideal; 5948 return s.equals(t); 5949 end
GB()
click to toggle source
Compute a two-sided Groebner base.
# File examples/jas.rb 5864 def GB() 5865 return twosidedGB(); 5866 end
isGB()
click to toggle source
Test if this is a two-sided Groebner base.
# File examples/jas.rb 5900 def isGB() 5901 return isTwosidedGB(); 5902 end
isTwosidedGB()
click to toggle source
Test if this is a two-sided Groebner base.
# File examples/jas.rb 5907 def isTwosidedGB() 5908 cofac = @ring.ring.coFac; 5909 kind = ""; 5910 t = System.currentTimeMillis(); 5911 if cofac.isField() or not cofac.isCommutative() 5912 b = @ideal.isGB(); 5913 kind = "field|nocom" 5914 else 5915 if cofac.is_a? GenPolynomialRing 5916 ff = @ideal.list; 5917 b = WordGroebnerBasePseudoRecSeq.new(cofac).isGB(ff); 5918 kind = "pseudoRec" 5919 else 5920 ff = @ideal.list; 5921 b = WordGroebnerBasePseudoSeq.new(cofac).isGB(ff); 5922 kind = "pseudo" 5923 end 5924 end 5925 t = System.currentTimeMillis() - t; 5926 puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 5927 return b; 5928 end
sum(other)
click to toggle source
Compute the sum of this and the ideal.
# File examples/jas.rb 5954 def sum(other) 5955 s = @ideal; 5956 t = other.ideal; 5957 nn = s.sum( t ); 5958 return WordPolyIdeal.new(@ring,"",nn); 5959 end
to_s()
click to toggle source
Create a string representation.
# File examples/jas.rb 5855 def to_s() 5856 # return "( " + @list.map{ |e| e.toScript() }.join(", ") + " )"; 5857 #return "( " + @list.map{ |e| e.toScript() }.join(",\n") + " )"; 5858 return @ideal.toScript(); 5859 end
twosidedGB()
click to toggle source
Compute a two-sided Groebner base.
# File examples/jas.rb 5871 def twosidedGB() 5872 cofac = @ring.ring.coFac; 5873 kind = ""; 5874 t = System.currentTimeMillis(); 5875 if cofac.isField() or not cofac.isCommutative() 5876 gg = @ideal.GB(); 5877 kind = "field|nocom" 5878 else 5879 #puts "is ring: " + str(cofac.is_a? GenPolynomialRing) 5880 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 5881 ff = @ideal.list; 5882 fg = WordGroebnerBasePseudoRecSeq.new(cofac).GB(ff); 5883 @ideal = WordIdeal.new(ring.ring, fg); 5884 kind = "pseudoRec" 5885 else 5886 ff = @ideal.list; 5887 fg = WordGroebnerBasePseudoSeq.new(cofac).GB(ff); 5888 @ideal = WordIdeal.new(ring.ring, fg); 5889 kind = "pseudo" 5890 end 5891 end 5892 t = System.currentTimeMillis() - t; 5893 puts "executed(#{kind}) twosidedGB in #{t} ms\n"; 5894 return self; 5895 end