class JAS::WordRing

Represents a JAS non-commutative polynomial ring: GenWordPolynomialRing.

Has a method to create non-commutative ideals. Note: watch your step: check that jruby does not reorder multiplication.

Public Class Methods

new(ringstr="",ring=nil) click to toggle source

Word polynomial ring constructor.

     # File examples/jas.rb
5681 def initialize(ringstr="",ring=nil)
5682     if ring == nil
5683        #raise "parse of word polynomial rings not implemented"
5684        sr = StringReader.new( ringstr );
5685        tok = RingFactoryTokenizer.new(sr);
5686        pfac = tok.nextPolynomialRing();
5687        wfac = GenWordPolynomialRing.new(pfac);
5688        #@list = tok.nextWordPolynomialList(wfac);
5689        @ring = wfac;
5690     else
5691        if ring.is_a? Ring
5692           @ring = ring.ring
5693        else 
5694           @ring = ring;
5695        end
5696     end
5697 end

Public Instance Methods

element(poly) click to toggle source

Create an element from a string or object.

     # File examples/jas.rb
5752 def element(poly)
5753     if not poly.is_a? String 
5754        begin
5755           if @ring == poly.ring 
5756              return RingElem.new(poly);
5757           end
5758        rescue => e
5759           # pass
5760        end
5761        poly = str(poly);
5762     end
5763     ii = WordPolyIdeal.new(self, "( " + poly + " )"); # should work
5764     list = ii.list;
5765     if list.size > 0
5766         return RingElem.new( list[0] );
5767     end
5768 end
ideal(ringstr="",list=nil) click to toggle source

Create a word ideal.

     # File examples/jas.rb
5709 def ideal(ringstr="",list=nil)
5710     return WordPolyIdeal.new(self, ringstr, list);
5711 end
one() click to toggle source

Get the one of the word polynomial ring.

     # File examples/jas.rb
5716 def one()
5717     return RingElem.new( @ring.getONE() );
5718 end
random(n=5) click to toggle source

Get a random word polynomial.

     # File examples/jas.rb
5730 def random(n=5)
5731     r = @ring.random(n);
5732     if @ring.coFac.isField()
5733         r = r.monic();
5734     end
5735     return RingElem.new( r );
5736 end
to_s() click to toggle source

Create a string representation.

     # File examples/jas.rb
5702 def to_s()
5703     return @ring.toScript(); #.to_s;
5704 end
zero() click to toggle source

Get the zero of the word polynomial ring.

     # File examples/jas.rb
5723 def zero()
5724     return RingElem.new( @ring.getZERO() );
5725 end