class JAS::ExtRing

Represents a JAS exterior vector / polynomial ring: GenExteriorPolynomialRing.

Public Class Methods

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

Exterior form / vector / polynomial ring constructor.

Calls superclass method JAS::Ring::new
     # File examples/jas.rb
6084 def initialize(ringstr="",ring=nil)
6085   #puts "ExtRing.new"
6086   if ring == nil
6087        #raise "parse of ext polynomial rings not implemented"
6088        sr = StringReader.new( ringstr );
6089        tok = RingFactoryTokenizer.new(sr);
6090        pfac = tok.nextPolynomialRing();
6091        efac = GenExtPolynomialRing.new(pfac);
6092        @list = tok.nextExteriorPolynomialList(wfac);
6093        @ring = efac;
6094     else
6095        if ring.is_a? Ring
6096           @ring = ring.ring
6097        else
6098           @ring = ring;
6099        end
6100     end
6101     super("",@ring)
6102     #puts "ExtRing.new: self.class.auto_inject = " + self.class.auto_inject.to_s
6103     #inject_variables();
6104     #puts "ExtRing.new: self.class.superclass.auto_inject = " + self.class.superclass.auto_inject.to_s
6105 end

Public Instance Methods

element(poly) click to toggle source

Create an element from a string or object.

     # File examples/jas.rb
6160 def element(poly)
6161     if not poly.is_a? String
6162        begin
6163           if @ring == poly.ring
6164              return RingElem.new(poly);
6165           end
6166        rescue => e
6167           # pass
6168        end
6169        poly = str(poly);
6170     end
6171     sr = StringReader.new(poly);
6172     tok = GenPolynomialTokenizer.new(sr);
6173     ep = tok.nextExteriorPolynomial(@ring);
6174     if ep != nil
6175         return RingElem.new( ep );
6176     end
6177 end
one() click to toggle source

Get the one of the exterior vector / polynomial ring.

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

Get a random exterior vector / polynomial.

     # File examples/jas.rb
6138 def random(n=5)
6139     r = @ring.random(n);
6140     if @ring.coFac.isField()
6141         r = r.monic();
6142     end
6143     return RingElem.new( r );
6144 end
to_s() click to toggle source

Create a string representation.

     # File examples/jas.rb
6110 def to_s()
6111     return @ring.toScript(); #.to_s;
6112 end
zero() click to toggle source

Get the zero of the exterior vector / polynomial ring.

     # File examples/jas.rb
6131 def zero()
6132     return RingElem.new( @ring.getZERO() );
6133 end