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
6407 def initialize(ring,ringstr="",list=nil)
6408     @ring = ring;
6409     if list == nil
6410        #raise "parse of non-commutative polynomials not implemented"
6411        sr = StringReader.new( ringstr );
6412        tok = GenPolynomialTokenizer.new(sr);
6413        @list = tok.nextWordPolynomialList(ring.ring);
6414        @ideal = WordIdeal.new(ring.ring, @list);
6415     else
6416        if list.is_a? WordIdeal
6417           @list = list.list;
6418           @ideal = list;
6419        else 
6420           @list = rbarray2arraylist(list, rec=1);
6421           @ideal = WordIdeal.new(ring.ring, @list);
6422        end
6423     end
6424 end

Public Instance Methods

<=>(other) click to toggle source

Compare two ideals.

     # File examples/jas.rb
6507 def <=>(other)
6508     s = @ideal; 
6509     o = other.ideal; 
6510     return s.compareTo(o); 
6511 end
==(other) click to toggle source

Test if two ideals are equal.

     # File examples/jas.rb
6516 def ==(other)
6517     if not other.is_a? WordPolyIdeal
6518        return false;
6519     end
6520     s = @ideal; 
6521     t = other.ideal; 
6522     return s.equals(t); 
6523 end
GB() click to toggle source

Compute a two-sided Groebner base.

     # File examples/jas.rb
6438 def GB()
6439     return twosidedGB();
6440 end
isGB() click to toggle source

Test if this is a two-sided Groebner base.

     # File examples/jas.rb
6474 def isGB()
6475     return isTwosidedGB();
6476 end
isTwosidedGB() click to toggle source

Test if this is a two-sided Groebner base.

     # File examples/jas.rb
6481 def isTwosidedGB()
6482     cofac = @ring.ring.coFac;
6483     kind = "";
6484     t = System.currentTimeMillis();
6485     if cofac.isField() or not cofac.isCommutative()
6486        b = @ideal.isGB();
6487        kind = "field|nocom"
6488     else 
6489         if cofac.is_a? GenPolynomialRing
6490            ff = @ideal.list;
6491            b = WordGroebnerBasePseudoRecSeq.new(cofac).isGB(ff);
6492            kind = "pseudoRec"
6493         else
6494            ff = @ideal.list;
6495            b = WordGroebnerBasePseudoSeq.new(cofac).isGB(ff);
6496            kind = "pseudo"
6497         end
6498     end
6499     t = System.currentTimeMillis() - t;
6500     puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 
6501     return b;
6502 end
sum(other) click to toggle source

Compute the sum of this and the ideal.

     # File examples/jas.rb
6528 def sum(other)
6529     s = @ideal; 
6530     t = other.ideal; 
6531     nn = s.sum( t );
6532     return WordPolyIdeal.new(@ring,"",nn);
6533 end
to_s() click to toggle source

Create a string representation.

     # File examples/jas.rb
6429 def to_s()
6430     # return "( " + @list.map{ |e| e.toScript() }.join(", ") + " )";
6431     #return "( " + @list.map{ |e| e.toScript() }.join(",\n") + " )";
6432     return @ideal.toScript();
6433 end
twosidedGB() click to toggle source

Compute a two-sided Groebner base.

     # File examples/jas.rb
6445 def twosidedGB()
6446     cofac = @ring.ring.coFac;
6447     kind = "";
6448     t = System.currentTimeMillis();
6449     if cofac.isField() or not cofac.isCommutative()
6450        gg = @ideal.GB();
6451        kind = "field|nocom"
6452     else 
6453         #puts "is ring: " + str(cofac.is_a? GenPolynomialRing)
6454         if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
6455            ff = @ideal.list;
6456            fg = WordGroebnerBasePseudoRecSeq.new(cofac).GB(ff);
6457            @ideal = WordIdeal.new(ring.ring, fg);
6458            kind = "pseudoRec"
6459         else
6460            ff = @ideal.list;
6461            fg = WordGroebnerBasePseudoSeq.new(cofac).GB(ff);
6462            @ideal = WordIdeal.new(ring.ring, fg);
6463            kind = "pseudo"
6464         end
6465     end
6466     t = System.currentTimeMillis() - t;
6467     puts "executed(#{kind}) twosidedGB in #{t} ms\n"; 
6468     return self;
6469 end