In Files

Parent

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, line 5519
def initialize(ring,ringstr="",list=nil)
    @ring = ring;
    if list == nil
       raise "parse of non-commutative polynomials not implemented"
       sr = StringReader.new( ringstr );
       tok = GenPolynomialTokenizer.new(ring.ring, sr);
       @list = tok.nextWordPolynomialList();
       @ideal = WordIdeal.new(ring.ring, @list);
    else
       if list.is_a? WordIdeal
          @list = list.list;
          @ideal = list;
       else 
          @list = rbarray2arraylist(list, rec=1);
          @ideal = WordIdeal.new(ring.ring, @list);
       end
    end
end

Public Instance Methods

<=>(other) click to toggle source

Compare two ideals.

# File examples/jas.rb, line 5619
def <=>(other)
    s = @ideal; 
    o = other.ideal; 
    return s.compareTo(o); 
end
===(other) click to toggle source

Test if two ideals are equal.

# File examples/jas.rb, line 5628
def ===(other)
    if not other.is_a? WordPolyIdeal
       return false;
    end
    s = @ideal; 
    t = other.ideal; 
    return s.equals(t); 
end
GB() click to toggle source

Compute a two-sided Groebner base.

# File examples/jas.rb, line 5550
def GB()
    return twosidedGB();
end
isGB() click to toggle source

Test if this is a two-sided Groebner base.

# File examples/jas.rb, line 5586
def isGB()
    return isTwosidedGB();
end
isTwosidedGB() click to toggle source

Test if this is a two-sided Groebner base.

# File examples/jas.rb, line 5593
def isTwosidedGB()
    cofac = @ring.ring.coFac;
    kind = "";
    t = System.currentTimeMillis();
    if cofac.isField() or not cofac.isCommutative()
       b = @ideal.isGB();
       kind = "field|nocom"
    else 
        if cofac.is_a? GenPolynomialRing
           ff = @ideal.list;
           b = WordGroebnerBasePseudoRecSeq.new(cofac).isGB(ff);
           kind = "pseudoRec"
        else
           ff = @ideal.list;
           b = WordGroebnerBasePseudoSeq.new(cofac).isGB(ff);
           kind = "pseudo"
        end
    end
    t = System.currentTimeMillis() - t;
    puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 
    return b;
end
sum(other) click to toggle source

Compute the sum of this and the ideal.

# File examples/jas.rb, line 5640
def sum(other)
    s = @ideal; 
    t = other.ideal; 
    nn = s.sum( t );
    return WordPolyIdeal.new(@ring,"",nn);
end
to_s() click to toggle source

Create a string representation.

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

Compute a two-sided Groebner base.

# File examples/jas.rb, line 5557
def twosidedGB()
    cofac = @ring.ring.coFac;
    kind = "";
    t = System.currentTimeMillis();
    if cofac.isField() or not cofac.isCommutative()
       gg = @ideal.GB();
       kind = "field|nocom"
    else 
        #puts "is ring: " + str(cofac.is_a? GenPolynomialRing)
        if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
           ff = @ideal.list;
           fg = WordGroebnerBasePseudoRecSeq.new(cofac).GB(ff);
           @ideal = WordIdeal.new(ring.ring, fg);
           kind = "pseudoRec"
        else
           ff = @ideal.list;
           fg = WordGroebnerBasePseudoSeq.new(cofac).GB(ff);
           @ideal = WordIdeal.new(ring.ring, fg);
           kind = "pseudo"
        end
    end
    t = System.currentTimeMillis() - t;
    puts "executed(#{kind}) twosidedGB in #{t} ms\n"; 
    return self;
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.