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 6255 def initialize(ringstr="",ring=nil) 6256 if ring == nil 6257 #raise "parse of word polynomial rings not implemented" 6258 sr = StringReader.new( ringstr ); 6259 tok = RingFactoryTokenizer.new(sr); 6260 pfac = tok.nextPolynomialRing(); 6261 wfac = GenWordPolynomialRing.new(pfac); 6262 #@list = tok.nextWordPolynomialList(wfac); 6263 @ring = wfac; 6264 else 6265 if ring.is_a? Ring 6266 @ring = ring.ring 6267 else 6268 @ring = ring; 6269 end 6270 end 6271 end
Public Instance Methods
element(poly)
click to toggle source
Create an element from a string or object.
# File examples/jas.rb 6326 def element(poly) 6327 if not poly.is_a? String 6328 begin 6329 if @ring == poly.ring 6330 return RingElem.new(poly); 6331 end 6332 rescue => e 6333 # pass 6334 end 6335 poly = str(poly); 6336 end 6337 ii = WordPolyIdeal.new(self, "( " + poly + " )"); # should work 6338 list = ii.list; 6339 if list.size > 0 6340 return RingElem.new( list[0] ); 6341 end 6342 end
ideal(ringstr="",list=nil)
click to toggle source
Create a word ideal.
# File examples/jas.rb 6283 def ideal(ringstr="",list=nil) 6284 return WordPolyIdeal.new(self, ringstr, list); 6285 end
one()
click to toggle source
Get the one of the word polynomial ring.
# File examples/jas.rb 6290 def one() 6291 return RingElem.new( @ring.getONE() ); 6292 end
random(n=5)
click to toggle source
Get a random word polynomial.
# File examples/jas.rb 6304 def random(n=5) 6305 r = @ring.random(n); 6306 if @ring.coFac.isField() 6307 r = r.monic(); 6308 end 6309 return RingElem.new( r ); 6310 end
to_s()
click to toggle source
Create a string representation.
# File examples/jas.rb 6276 def to_s() 6277 return @ring.toScript(); #.to_s; 6278 end
zero()
click to toggle source
Get the zero of the word polynomial ring.
# File examples/jas.rb 6297 def zero() 6298 return RingElem.new( @ring.getZERO() ); 6299 end