class JAS::SolvPolyRing
Represents a JAS solvable polynomial ring: GenSolvablePolynomialRing.
Provides more convenient constructor. Then returns a Ring.
Attributes
auto_inject[RW]
inject variables into environment
auto_lowervar[RW]
avoid capital letter variables
Public Class Methods
new(coeff,vars,order,rel=[])
click to toggle source
Ring constructor.
coeff = factory for coefficients, vars = string with variable names, order = term order, rel = triple list of relations. (e,f,p,…) with e * f = p as relation.
Calls superclass method
JAS::SolvableRing.new
# File examples/jas.rb, line 3784 def initialize(coeff,vars,order,rel=[]) if coeff == nil raise ArgumentError, "No coefficient given." end cf = coeff; if coeff.is_a? RingElem cf = coeff.elem.factory(); end if coeff.is_a? Ring cf = coeff.ring; end if vars == nil raise ArgumentError, "No variable names given." end names = vars; if vars.is_a? String names = GenPolynomialTokenizer.variableList(vars); end nv = names.size; #to = PolyRing.lex; to = PolyRing.grad; if order.is_a? TermOrder to = order; end if order.is_a? Array # ruby has no keyword params rel = order; end ll = []; for x in rel if x.is_a? RingElem x = x.elem; end ll << x; end constSolv = false; (0..ll.size-1).step(3) { |i| #puts "ll[i+1] = #{ll[i+1]}" if ll[i+1].isConstant() constSolv = true; end } #puts "constSolv = #{constSolv}" cfs = cf.toScript(); if cfs[0] == "0" cfs = cf.toScriptFactory(); end #puts "cf = #{cfs}" recSolv = cf.is_a? GenPolynomialRing recSolvWord = cf.is_a? GenWordPolynomialRing resWord = cf.is_a? WordResidueRing quotSolv = cf.is_a? SolvableQuotientRing resSolv = cf.is_a? SolvableResidueRing locSolv = cf.is_a? SolvableLocalRing locresSolv = cf.is_a? SolvableLocalResidueRing if recSolv and not constSolv recSolv = false; end #puts "cf = " + cf.getClass().to_s + ", quotSolv = " + quotSolv.to_s + ", recSolv = " + recSolv.to_s; if recSolv puts "RecSolvablePolynomialRing: " + cfs; ring = RecSolvablePolynomialRing.new(cf,nv,to,names); table = ring.table; coeffTable = ring.coeffTable; elsif recSolvWord puts "RecSolvableWordPolynomialRing: " + cfs; ring = RecSolvableWordPolynomialRing.new(cf,nv,to,names); table = ring.table; coeffTable = ring.coeffTable; elsif resWord puts "ResWordSolvablePolynomialRing: " + cfs; #ring = GenSolvablePolynomialRing.new(cf,nv,to,names); #ring = RecSolvableWordPolynomialRing.new(cf,nv,to,names); #ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); ring = ResidueSolvableWordPolynomialRing.new(cf,nv,to,names); puts "ring = #{ring.toScript()}"; table = ring.table; coeffTable = ring.polCoeff.coeffTable; elsif resSolv puts "ResidueSolvablePolynomialRing: " + cfs; #ring = ResidueSolvablePolynomialRing.new(cf,nv,to,names); ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); table = ring.table; coeffTable = ring.polCoeff.coeffTable; elsif quotSolv puts "QuotSolvablePolynomialRing: " + cfs; #ring = QuotSolvablePolynomialRing.new(cf,nv,to,names); ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); table = ring.table; coeffTable = ring.polCoeff.coeffTable; elsif locSolv puts "LocalSolvablePolynomialRing: " + cfs; #ring = LocalSolvablePolynomialRing.new(cf,nv,to,names); ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); table = ring.table; coeffTable = ring.polCoeff.coeffTable; elsif locresSolv puts "QLRSolvablePolynomialRing: " + cfs; ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); table = ring.table; coeffTable = ring.polCoeff.coeffTable; else puts "GenSolvablePolynomialRing: " + cfs; ring = GenSolvablePolynomialRing.new(cf,nv,to,names); table = ring.table; coeffTable = table; end #puts "ll = " + str(ll); (0..ll.size-1).step(3) { |i| puts "adding relation: " + str(ll[i]) + " * " + str(ll[i+1]) + " = " + str(ll[i+2]); if ll[i+1].isConstant() if recSolv #puts "r coeff type " + str(ll[i].class); #coeffTable.update( ll[i], ll[i+1].leadingBaseCoefficient(), ll[i+2] ); coeffTable.update( ll[i], ll[i+1], ll[i+2] ); elsif recSolvWord #puts "rw coeff type " + str(ll[i].class); coeffTable.update( ll[i], ll[i+1], ll[i+2] ); elsif resWord #puts "rw coeff type " + str(ll[i].class); coeffTable.update( ring.toPolyCoefficients(ll[i]), ring.toPolyCoefficients(ll[i+1]), ring.toPolyCoefficients(ll[i+2]) ); elsif resSolv #puts "ri coeff type " + str(ll[i].class); coeffTable.update( ring.toPolyCoefficients(ll[i]), ring.toPolyCoefficients(ll[i+1]), ring.toPolyCoefficients(ll[i+2]) ); elsif quotSolv #puts "q coeff type " + str(ll[i].class); coeffTable.update( ring.toPolyCoefficients(ll[i]), ring.toPolyCoefficients(ll[i+1]), ring.toPolyCoefficients(ll[i+2]) ); elsif locSolv #puts "l coeff type " + str(ll[i].class); coeffTable.update( ring.toPolyCoefficients(ll[i]), ring.toPolyCoefficients(ll[i+1]), ring.toPolyCoefficients(ll[i+2]) ); elsif locresSolv #puts "lr coeff type " + str(ll[i].class); coeffTable.update( ring.toPolyCoefficients(ll[i]), ring.toPolyCoefficients(ll[i+1]), ring.toPolyCoefficients(ll[i+2]) ); end else # no coeff relation #puts "ll[i], ll[i+1], ll[i+2]: " + str(ll[i]) + ", " + str(ll[i+1]) + ", " + str(ll[i+2]); #puts "poly type " + str(ll[i].class); table.update( ll[i], ll[i+1], ll[i+2] ); if locresSolv or locSolv or quotSolv or resSolv or resWord #puts "ring.polCoeff.table " + str(ring.polCoeff.table.toScript()); ring.polCoeff.table.update( ring.toPolyCoefficients(ll[i]), ring.toPolyCoefficients(ll[i+1]), ring.toPolyCoefficients(ll[i+2]) ); end end } #puts "ring " + ring.toScript(); #puts "isAssoc " + str(ring.isAssociative()); @ring = ring; #puts "SolvPolyRing to super()"; super("",@ring) # puts "ai = " + self.class.auto_inject.to_s # done in super(): #if self.class.auto_inject or self.class.superclass.auto_inject # inject_variables(); #end end
Public Instance Methods
to_s()
click to toggle source
Create a string representation.
# File examples/jas.rb, line 3954 def to_s() return @ring.toScript(); end