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 6066 def initialize(ring,ringstr="",list=nil) 6067 @ring = ring; 6068 if list == nil 6069 #raise "parse of non-commutative polynomials not implemented" 6070 sr = StringReader.new( ringstr ); 6071 tok = GenPolynomialTokenizer.new(sr); 6072 @list = tok.nextWordPolynomialList(ring.ring); 6073 @ideal = WordIdeal.new(ring.ring, @list); 6074 else 6075 if list.is_a? WordIdeal 6076 @list = list.list; 6077 @ideal = list; 6078 else 6079 @list = rbarray2arraylist(list, rec=1); 6080 @ideal = WordIdeal.new(ring.ring, @list); 6081 end 6082 end 6083 end
Public Instance Methods
<=>(other)
click to toggle source
Compare two ideals.
# File examples/jas.rb 6166 def <=>(other) 6167 s = @ideal; 6168 o = other.ideal; 6169 return s.compareTo(o); 6170 end
==(other)
click to toggle source
Test if two ideals are equal.
# File examples/jas.rb 6175 def ==(other) 6176 if not other.is_a? WordPolyIdeal 6177 return false; 6178 end 6179 s = @ideal; 6180 t = other.ideal; 6181 return s.equals(t); 6182 end
GB()
click to toggle source
Compute a two-sided Groebner base.
# File examples/jas.rb 6097 def GB() 6098 return twosidedGB(); 6099 end
isGB()
click to toggle source
Test if this is a two-sided Groebner base.
# File examples/jas.rb 6133 def isGB() 6134 return isTwosidedGB(); 6135 end
isTwosidedGB()
click to toggle source
Test if this is a two-sided Groebner base.
# File examples/jas.rb 6140 def isTwosidedGB() 6141 cofac = @ring.ring.coFac; 6142 kind = ""; 6143 t = System.currentTimeMillis(); 6144 if cofac.isField() or not cofac.isCommutative() 6145 b = @ideal.isGB(); 6146 kind = "field|nocom" 6147 else 6148 if cofac.is_a? GenPolynomialRing 6149 ff = @ideal.list; 6150 b = WordGroebnerBasePseudoRecSeq.new(cofac).isGB(ff); 6151 kind = "pseudoRec" 6152 else 6153 ff = @ideal.list; 6154 b = WordGroebnerBasePseudoSeq.new(cofac).isGB(ff); 6155 kind = "pseudo" 6156 end 6157 end 6158 t = System.currentTimeMillis() - t; 6159 puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 6160 return b; 6161 end
sum(other)
click to toggle source
Compute the sum of this and the ideal.
# File examples/jas.rb 6187 def sum(other) 6188 s = @ideal; 6189 t = other.ideal; 6190 nn = s.sum( t ); 6191 return WordPolyIdeal.new(@ring,"",nn); 6192 end
to_s()
click to toggle source
Create a string representation.
# File examples/jas.rb 6088 def to_s() 6089 # return "( " + @list.map{ |e| e.toScript() }.join(", ") + " )"; 6090 #return "( " + @list.map{ |e| e.toScript() }.join(",\n") + " )"; 6091 return @ideal.toScript(); 6092 end
twosidedGB()
click to toggle source
Compute a two-sided Groebner base.
# File examples/jas.rb 6104 def twosidedGB() 6105 cofac = @ring.ring.coFac; 6106 kind = ""; 6107 t = System.currentTimeMillis(); 6108 if cofac.isField() or not cofac.isCommutative() 6109 gg = @ideal.GB(); 6110 kind = "field|nocom" 6111 else 6112 #puts "is ring: " + str(cofac.is_a? GenPolynomialRing) 6113 if cofac.is_a? GenPolynomialRing #and cofac.isCommutative() 6114 ff = @ideal.list; 6115 fg = WordGroebnerBasePseudoRecSeq.new(cofac).GB(ff); 6116 @ideal = WordIdeal.new(ring.ring, fg); 6117 kind = "pseudoRec" 6118 else 6119 ff = @ideal.list; 6120 fg = WordGroebnerBasePseudoSeq.new(cofac).GB(ff); 6121 @ideal = WordIdeal.new(ring.ring, fg); 6122 kind = "pseudo" 6123 end 6124 end 6125 t = System.currentTimeMillis() - t; 6126 puts "executed(#{kind}) twosidedGB in #{t} ms\n"; 6127 return self; 6128 end