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, line 5628 def initialize(ringstr="",ring=nil) if ring == nil raise "parse of word polynomial rings not implemented" sr = StringReader.new( ringstr ); tok = RingFactoryTokenizer.new(sr); pfac = tok.nextPolynomialRing(); #tok = GenPolynomialTokenizer.new(sr); #@pset = tok.nextWordPolynomialSet(); @ring = pfac; else if ring.is_a? Ring @ring = ring.ring else @ring = ring; end end end
Public Instance Methods
element(poly)
click to toggle source
Create an element from a string or object.
# File examples/jas.rb, line 5699 def element(poly) if not poly.is_a? String begin if @ring == poly.ring return RingElem.new(poly); end rescue => e # pass end poly = str(poly); end ii = WordPolyIdeal.new(self, "( " + poly + " )"); # not working list = ii.list; if list.size > 0 return RingElem.new( list[0] ); end end
ideal(ringstr="",list=nil)
click to toggle source
Create a word ideal.
# File examples/jas.rb, line 5656 def ideal(ringstr="",list=nil) return WordPolyIdeal.new(self, ringstr, list); end
one()
click to toggle source
Get the one of the word polynomial ring.
# File examples/jas.rb, line 5663 def one() return RingElem.new( @ring.getONE() ); end
random(n=5)
click to toggle source
Get a random word polynomial.
# File examples/jas.rb, line 5677 def random(n=5) r = @ring.random(n); if @ring.coFac.isField() r = r.monic(); end return RingElem.new( r ); end
to_s()
click to toggle source
Create a string representation.
# File examples/jas.rb, line 5649 def to_s() return @ring.toScript(); #.to_s; end
zero()
click to toggle source
Get the zero of the word polynomial ring.
# File examples/jas.rb, line 5670 def zero() return RingElem.new( @ring.getZERO() ); end