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
6090 def initialize(ring,ringstr="",list=nil)
6091     @ring = ring;
6092     if list == nil
6093        #raise "parse of non-commutative polynomials not implemented"
6094        sr = StringReader.new( ringstr );
6095        tok = GenPolynomialTokenizer.new(sr);
6096        @list = tok.nextWordPolynomialList(ring.ring);
6097        @ideal = WordIdeal.new(ring.ring, @list);
6098     else
6099        if list.is_a? WordIdeal
6100           @list = list.list;
6101           @ideal = list;
6102        else 
6103           @list = rbarray2arraylist(list, rec=1);
6104           @ideal = WordIdeal.new(ring.ring, @list);
6105        end
6106     end
6107 end

Public Instance Methods

<=>(other) click to toggle source

Compare two ideals.

     # File examples/jas.rb
6190 def <=>(other)
6191     s = @ideal; 
6192     o = other.ideal; 
6193     return s.compareTo(o); 
6194 end
==(other) click to toggle source

Test if two ideals are equal.

     # File examples/jas.rb
6199 def ==(other)
6200     if not other.is_a? WordPolyIdeal
6201        return false;
6202     end
6203     s = @ideal; 
6204     t = other.ideal; 
6205     return s.equals(t); 
6206 end
GB() click to toggle source

Compute a two-sided Groebner base.

     # File examples/jas.rb
6121 def GB()
6122     return twosidedGB();
6123 end
isGB() click to toggle source

Test if this is a two-sided Groebner base.

     # File examples/jas.rb
6157 def isGB()
6158     return isTwosidedGB();
6159 end
isTwosidedGB() click to toggle source

Test if this is a two-sided Groebner base.

     # File examples/jas.rb
6164 def isTwosidedGB()
6165     cofac = @ring.ring.coFac;
6166     kind = "";
6167     t = System.currentTimeMillis();
6168     if cofac.isField() or not cofac.isCommutative()
6169        b = @ideal.isGB();
6170        kind = "field|nocom"
6171     else 
6172         if cofac.is_a? GenPolynomialRing
6173            ff = @ideal.list;
6174            b = WordGroebnerBasePseudoRecSeq.new(cofac).isGB(ff);
6175            kind = "pseudoRec"
6176         else
6177            ff = @ideal.list;
6178            b = WordGroebnerBasePseudoSeq.new(cofac).isGB(ff);
6179            kind = "pseudo"
6180         end
6181     end
6182     t = System.currentTimeMillis() - t;
6183     puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 
6184     return b;
6185 end
sum(other) click to toggle source

Compute the sum of this and the ideal.

     # File examples/jas.rb
6211 def sum(other)
6212     s = @ideal; 
6213     t = other.ideal; 
6214     nn = s.sum( t );
6215     return WordPolyIdeal.new(@ring,"",nn);
6216 end
to_s() click to toggle source

Create a string representation.

     # File examples/jas.rb
6112 def to_s()
6113     # return "( " + @list.map{ |e| e.toScript() }.join(", ") + " )";
6114     #return "( " + @list.map{ |e| e.toScript() }.join(",\n") + " )";
6115     return @ideal.toScript();
6116 end
twosidedGB() click to toggle source

Compute a two-sided Groebner base.

     # File examples/jas.rb
6128 def twosidedGB()
6129     cofac = @ring.ring.coFac;
6130     kind = "";
6131     t = System.currentTimeMillis();
6132     if cofac.isField() or not cofac.isCommutative()
6133        gg = @ideal.GB();
6134        kind = "field|nocom"
6135     else 
6136         #puts "is ring: " + str(cofac.is_a? GenPolynomialRing)
6137         if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
6138            ff = @ideal.list;
6139            fg = WordGroebnerBasePseudoRecSeq.new(cofac).GB(ff);
6140            @ideal = WordIdeal.new(ring.ring, fg);
6141            kind = "pseudoRec"
6142         else
6143            ff = @ideal.list;
6144            fg = WordGroebnerBasePseudoSeq.new(cofac).GB(ff);
6145            @ideal = WordIdeal.new(ring.ring, fg);
6146            kind = "pseudo"
6147         end
6148     end
6149     t = System.currentTimeMillis() - t;
6150     puts "executed(#{kind}) twosidedGB in #{t} ms\n"; 
6151     return self;
6152 end