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
5734 def initialize(ringstr="",ring=nil)
5735     if ring == nil
5736        #raise "parse of word polynomial rings not implemented"
5737        sr = StringReader.new( ringstr );
5738        tok = RingFactoryTokenizer.new(sr);
5739        pfac = tok.nextPolynomialRing();
5740        wfac = GenWordPolynomialRing.new(pfac);
5741        #@list = tok.nextWordPolynomialList(wfac);
5742        @ring = wfac;
5743     else
5744        if ring.is_a? Ring
5745           @ring = ring.ring
5746        else 
5747           @ring = ring;
5748        end
5749     end
5750 end

Public Instance Methods

element(poly) click to toggle source

Create an element from a string or object.

     # File examples/jas.rb
5805 def element(poly)
5806     if not poly.is_a? String 
5807        begin
5808           if @ring == poly.ring 
5809              return RingElem.new(poly);
5810           end
5811        rescue => e
5812           # pass
5813        end
5814        poly = str(poly);
5815     end
5816     ii = WordPolyIdeal.new(self, "( " + poly + " )"); # should work
5817     list = ii.list;
5818     if list.size > 0
5819         return RingElem.new( list[0] );
5820     end
5821 end
ideal(ringstr="",list=nil) click to toggle source

Create a word ideal.

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

Get the one of the word polynomial ring.

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

Get a random word polynomial.

     # File examples/jas.rb
5783 def random(n=5)
5784     r = @ring.random(n);
5785     if @ring.coFac.isField()
5786         r = r.monic();
5787     end
5788     return RingElem.new( r );
5789 end
to_s() click to toggle source

Create a string representation.

     # File examples/jas.rb
5755 def to_s()
5756     return @ring.toScript(); #.to_s;
5757 end
zero() click to toggle source

Get the zero of the word polynomial ring.

     # File examples/jas.rb
5776 def zero()
5777     return RingElem.new( @ring.getZERO() );
5778 end