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 3890 def initialize(coeff,vars,order,rel=[]) 3891 if coeff == nil 3892 raise ArgumentError, "No coefficient given." 3893 end 3894 cf = coeff; 3895 if coeff.is_a? RingElem 3896 cf = coeff.elem.factory(); 3897 end 3898 if coeff.is_a? Ring 3899 cf = coeff.ring; 3900 end 3901 if vars == nil 3902 raise ArgumentError, "No variable names given." 3903 end 3904 names = vars; 3905 if vars.is_a? String 3906 names = GenPolynomialTokenizer.variableList(vars); 3907 end 3908 nv = names.size; 3909 #to = PolyRing.lex; 3910 to = PolyRing.grad; 3911 if order.is_a? TermOrder 3912 to = order; 3913 end 3914 if order.is_a? Array # ruby has no keyword params 3915 rel = order; 3916 end 3917 ll = []; 3918 for x in rel 3919 if x.is_a? RingElem 3920 x = x.elem; 3921 end 3922 ll << x; 3923 end 3924 constSolv = false; 3925 (0..ll.size-1).step(3) { |i| 3926 #puts "ll[i+1] = #{ll[i+1]}" 3927 if ll[i+1].isConstant() 3928 constSolv = true; 3929 end 3930 } 3931 #puts "constSolv = #{constSolv}" 3932 cfs = cf.toScript(); 3933 if cfs[0] == "0" 3934 cfs = cf.toScriptFactory(); 3935 end 3936 #puts "cf = #{cfs}" 3937 recSolv = cf.is_a? GenPolynomialRing 3938 recSolvWord = cf.is_a? GenWordPolynomialRing 3939 resWord = cf.is_a? WordResidueRing 3940 quotSolv = cf.is_a? SolvableQuotientRing 3941 resSolv = cf.is_a? SolvableResidueRing 3942 locSolv = cf.is_a? SolvableLocalRing 3943 locresSolv = cf.is_a? SolvableLocalResidueRing 3944 if recSolv and not constSolv 3945 recSolv = false; 3946 end 3947 #puts "cf = " + cf.getClass().to_s + ", quotSolv = " + quotSolv.to_s + ", recSolv = " + recSolv.to_s; 3948 if recSolv 3949 puts "RecSolvablePolynomialRing: " + cfs; 3950 ring = RecSolvablePolynomialRing.new(cf,nv,to,names); 3951 table = ring.table; 3952 coeffTable = ring.coeffTable; 3953 elsif recSolvWord 3954 puts "RecSolvableWordPolynomialRing: " + cfs; 3955 ring = RecSolvableWordPolynomialRing.new(cf,nv,to,names); 3956 table = ring.table; 3957 coeffTable = ring.coeffTable; 3958 elsif resWord 3959 puts "ResWordSolvablePolynomialRing: " + cfs; 3960 #ring = GenSolvablePolynomialRing.new(cf,nv,to,names); 3961 #ring = RecSolvableWordPolynomialRing.new(cf,nv,to,names); 3962 #ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); 3963 ring = ResidueSolvableWordPolynomialRing.new(cf,nv,to,names); 3964 puts "ring = #{ring.toScript()}"; 3965 table = ring.table; 3966 coeffTable = ring.polCoeff.coeffTable; 3967 elsif resSolv 3968 puts "ResidueSolvablePolynomialRing: " + cfs; 3969 #ring = ResidueSolvablePolynomialRing.new(cf,nv,to,names); 3970 ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); 3971 table = ring.table; 3972 coeffTable = ring.polCoeff.coeffTable; 3973 elsif quotSolv 3974 puts "QuotSolvablePolynomialRing: " + cfs; 3975 #ring = QuotSolvablePolynomialRing.new(cf,nv,to,names); 3976 ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); 3977 table = ring.table; 3978 coeffTable = ring.polCoeff.coeffTable; 3979 elsif locSolv 3980 puts "LocalSolvablePolynomialRing: " + cfs; 3981 #ring = LocalSolvablePolynomialRing.new(cf,nv,to,names); 3982 ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); 3983 table = ring.table; 3984 coeffTable = ring.polCoeff.coeffTable; 3985 elsif locresSolv 3986 puts "QLRSolvablePolynomialRing: " + cfs; 3987 ring = QLRSolvablePolynomialRing.new(cf,nv,to,names); 3988 table = ring.table; 3989 coeffTable = ring.polCoeff.coeffTable; 3990 else 3991 puts "GenSolvablePolynomialRing: " + cfs; 3992 ring = GenSolvablePolynomialRing.new(cf,nv,to,names); 3993 table = ring.table; 3994 coeffTable = table; 3995 end 3996 #puts "ll = " + str(ll); 3997 (0..ll.size-1).step(3) { |i| 3998 puts "adding relation: " + str(ll[i]) + " * " + str(ll[i+1]) + " = " + str(ll[i+2]); 3999 if ll[i+1].isConstant() 4000 if recSolv 4001 #puts "r coeff type " + str(ll[i].class); 4002 #coeffTable.update( ll[i], ll[i+1].leadingBaseCoefficient(), ll[i+2] ); 4003 coeffTable.update( ll[i], ll[i+1], ll[i+2] ); 4004 elsif recSolvWord 4005 #puts "rw coeff type " + str(ll[i].class); 4006 coeffTable.update( ll[i], ll[i+1], ll[i+2] ); 4007 elsif resWord 4008 #puts "rw coeff type " + str(ll[i].class); 4009 coeffTable.update( ring.toPolyCoefficients(ll[i]), 4010 ring.toPolyCoefficients(ll[i+1]), 4011 ring.toPolyCoefficients(ll[i+2]) ); 4012 elsif resSolv 4013 #puts "ri coeff type " + str(ll[i].class); 4014 coeffTable.update( ring.toPolyCoefficients(ll[i]), 4015 ring.toPolyCoefficients(ll[i+1]), 4016 ring.toPolyCoefficients(ll[i+2]) ); 4017 elsif quotSolv 4018 #puts "q coeff type " + str(ll[i].class); 4019 coeffTable.update( ring.toPolyCoefficients(ll[i]), 4020 ring.toPolyCoefficients(ll[i+1]), 4021 ring.toPolyCoefficients(ll[i+2]) ); 4022 elsif locSolv 4023 #puts "l coeff type " + str(ll[i].class); 4024 coeffTable.update( ring.toPolyCoefficients(ll[i]), 4025 ring.toPolyCoefficients(ll[i+1]), 4026 ring.toPolyCoefficients(ll[i+2]) ); 4027 elsif locresSolv 4028 #puts "lr coeff type " + str(ll[i].class); 4029 coeffTable.update( ring.toPolyCoefficients(ll[i]), 4030 ring.toPolyCoefficients(ll[i+1]), 4031 ring.toPolyCoefficients(ll[i+2]) ); 4032 end 4033 else # no coeff relation 4034 #puts "ll[i], ll[i+1], ll[i+2]: " + str(ll[i]) + ", " + str(ll[i+1]) + ", " + str(ll[i+2]); 4035 #puts "poly type " + str(ll[i].class); 4036 table.update( ll[i], ll[i+1], ll[i+2] ); 4037 if locresSolv or locSolv or quotSolv or resSolv or resWord 4038 #puts "ring.polCoeff.table " + str(ring.polCoeff.table.toScript()); 4039 ring.polCoeff.table.update( ring.toPolyCoefficients(ll[i]), 4040 ring.toPolyCoefficients(ll[i+1]), 4041 ring.toPolyCoefficients(ll[i+2]) ); 4042 end 4043 end 4044 } 4045 #puts "ring " + ring.toScript(); 4046 #puts "isAssoc " + str(ring.isAssociative()); 4047 @ring = ring; 4048 #puts "SolvPolyRing to super()"; 4049 super("",@ring) 4050 # puts "ai = " + self.class.auto_inject.to_s 4051 # done in super(): 4052 #if self.class.auto_inject or self.class.superclass.auto_inject 4053 # inject_variables(); 4054 #end 4055 end
Public Instance Methods
to_s()
click to toggle source
Create a string representation.
# File examples/jas.rb 4060 def to_s() 4061 return @ring.toScript(); 4062 end