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
5886 def initialize(ring,ringstr="",list=nil)
5887     @ring = ring;
5888     if list == nil
5889        #raise "parse of non-commutative polynomials not implemented"
5890        sr = StringReader.new( ringstr );
5891        tok = GenPolynomialTokenizer.new(sr);
5892        @list = tok.nextWordPolynomialList(ring.ring);
5893        @ideal = WordIdeal.new(ring.ring, @list);
5894     else
5895        if list.is_a? WordIdeal
5896           @list = list.list;
5897           @ideal = list;
5898        else 
5899           @list = rbarray2arraylist(list, rec=1);
5900           @ideal = WordIdeal.new(ring.ring, @list);
5901        end
5902     end
5903 end

Public Instance Methods

<=>(other) click to toggle source

Compare two ideals.

     # File examples/jas.rb
5986 def <=>(other)
5987     s = @ideal; 
5988     o = other.ideal; 
5989     return s.compareTo(o); 
5990 end
==(other) click to toggle source

Test if two ideals are equal.

     # File examples/jas.rb
5995 def ==(other)
5996     if not other.is_a? WordPolyIdeal
5997        return false;
5998     end
5999     s = @ideal; 
6000     t = other.ideal; 
6001     return s.equals(t); 
6002 end
GB() click to toggle source

Compute a two-sided Groebner base.

     # File examples/jas.rb
5917 def GB()
5918     return twosidedGB();
5919 end
isGB() click to toggle source

Test if this is a two-sided Groebner base.

     # File examples/jas.rb
5953 def isGB()
5954     return isTwosidedGB();
5955 end
isTwosidedGB() click to toggle source

Test if this is a two-sided Groebner base.

     # File examples/jas.rb
5960 def isTwosidedGB()
5961     cofac = @ring.ring.coFac;
5962     kind = "";
5963     t = System.currentTimeMillis();
5964     if cofac.isField() or not cofac.isCommutative()
5965        b = @ideal.isGB();
5966        kind = "field|nocom"
5967     else 
5968         if cofac.is_a? GenPolynomialRing
5969            ff = @ideal.list;
5970            b = WordGroebnerBasePseudoRecSeq.new(cofac).isGB(ff);
5971            kind = "pseudoRec"
5972         else
5973            ff = @ideal.list;
5974            b = WordGroebnerBasePseudoSeq.new(cofac).isGB(ff);
5975            kind = "pseudo"
5976         end
5977     end
5978     t = System.currentTimeMillis() - t;
5979     puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 
5980     return b;
5981 end
sum(other) click to toggle source

Compute the sum of this and the ideal.

     # File examples/jas.rb
6007 def sum(other)
6008     s = @ideal; 
6009     t = other.ideal; 
6010     nn = s.sum( t );
6011     return WordPolyIdeal.new(@ring,"",nn);
6012 end
to_s() click to toggle source

Create a string representation.

     # File examples/jas.rb
5908 def to_s()
5909     # return "( " + @list.map{ |e| e.toScript() }.join(", ") + " )";
5910     #return "( " + @list.map{ |e| e.toScript() }.join(",\n") + " )";
5911     return @ideal.toScript();
5912 end
twosidedGB() click to toggle source

Compute a two-sided Groebner base.

     # File examples/jas.rb
5924 def twosidedGB()
5925     cofac = @ring.ring.coFac;
5926     kind = "";
5927     t = System.currentTimeMillis();
5928     if cofac.isField() or not cofac.isCommutative()
5929        gg = @ideal.GB();
5930        kind = "field|nocom"
5931     else 
5932         #puts "is ring: " + str(cofac.is_a? GenPolynomialRing)
5933         if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
5934            ff = @ideal.list;
5935            fg = WordGroebnerBasePseudoRecSeq.new(cofac).GB(ff);
5936            @ideal = WordIdeal.new(ring.ring, fg);
5937            kind = "pseudoRec"
5938         else
5939            ff = @ideal.list;
5940            fg = WordGroebnerBasePseudoSeq.new(cofac).GB(ff);
5941            @ideal = WordIdeal.new(ring.ring, fg);
5942            kind = "pseudo"
5943         end
5944     end
5945     t = System.currentTimeMillis() - t;
5946     puts "executed(#{kind}) twosidedGB in #{t} ms\n"; 
5947     return self;
5948 end