Exemple #1
0
 def __sub__(self, y):
     if y is zero:
         return self
     if isinstance(y, SHPR):
         return subHPR(self, y)
     if isinstance(y, Factory.SFact):
         return Factory.Lift0F(self, hprType) - y
     Errors.errorOnStaticTypes("Sub", "SHPR", y)
Exemple #2
0
 def __sub__(self, y):
     if y is zero:
         return self
     if isinstance(y, SP2):
         return subP2(self, y)
     if isinstance( y, Factory.SFact):
         return Factory.Lift0F(self, p2Type) - y
     Errors.errorOnStaticTypes("Sub", "SP2", y)
Exemple #3
0
 def __add__(self, y):
     if y is zero:
         return self
     if isinstance(y, SHPR):
         return addHPR(self, y)
     if isinstance(y, Factory.SFact):
         return y + self
     Errors.errorOnStaticTypes("Add", "SHPR", y)
Exemple #4
0
 def __sub__(self, y):
     if y is zero:
         return self
     if isinstance(y, SP3):
         return subP3(self, y)
     if isinstance(y, Factory.SFact):
         return Factory.Lift0F(self, p3Type) - y
     Errors.errorOnStaticTypes("Sub", "SP3", y)
Exemple #5
0
 def __rmul__(self, y):
     if y is zero:
         return zero
     if isinstance(y, type(1)) or isinstance(y, type(1.0)):
         return scaleP2(y, self)
     if getPtype(y).includes(numType):
         return scaleP2(y, self)
     Errors.errorOnStaticTypes("Mul", "SP2", y)
Exemple #6
0
 def __radd__(self, y):
     if y is zero:
         return self
     if isinstance(y, SP3):
         return addP3(self, y)
     if isinstance(y, Factory.SFact):
         return y + self
     Errors.errorOnStaticTypes("Add", "SP3", y)
Exemple #7
0
 def __radd__(self, y):
     if y is zero:
         return self
     if isinstance(y, SP3):
         return addP3(self, y)
     if isinstance(y, Factory.SFact):
         return y + self
     Errors.errorOnStaticTypes("Add", "SP3", y)
Exemple #8
0
 def __rmul__(self, y):
     if y is zero:
         return zero
     if isinstance(y, type(1)) or isinstance(y,type(1.0)):
         return scaleP2(y, self)
     if getPtype(y).includes(numType):
         return scaleP2(y, self)
     Errors.errorOnStaticTypes("Mul", "SP2", y)
Exemple #9
0
 def __div__(self, y):
     if y is zero:
         print("Universal Explosion")
         return zero
     if isinstance(y, type(1)) or isinstance(y, type(1.0)):
         return scaleP3((1.0 / y), self)
     if getPtype(y).includes(numType):
         return scaleP3((1.0 / y), self)
     Errors.errorOnStaticTypes("Div", "SP2", y)
Exemple #10
0
 def __rmul__(self, y):
     if y is zero:
         return zero.rmul(self, y)
     if isinstance(y, type(1)) or isinstance(y, type(1.5)):
         return scaleP3(y, self)
     #print(getPtype(y))
     if getPtype(y).includes(numType):
         return scaleP3(y, self)
     Errors.errorOnStaticTypes("Mul", "SP3", y)
Exemple #11
0
 def __add__(self, y):
     if y is zero:
         return self
     if isinstance(y, SP2):
         return addP2(self, y)
     if isinstance(y, Factory.SFact):
         return y + self
     Errors.errorOnStaticTypes("Add", "SP2", y)
     sys.exit()
Exemple #12
0
 def __div__(self, y):
     if y is zero:
         print("Universal Explosion")
         return zero
     if isinstance(y, type(1)) or isinstance(y,type(1.0)):
         return scaleP3((1.0/y), self)
     if getPtype(y).includes(numType):
         return scaleP3((1.0/y), self)
     Errors.errorOnStaticTypes("Div", "SP2", y)
Exemple #13
0
 def __rmul__(self, y):
     if y is zero:
         return zero.rmul(self, y)
     if isinstance(y, type(1)) or isinstance(y, type(1.5)):
         return scaleP3(y, self)
     #print(getPtype(y))
     if getPtype(y).includes(numType):
         return scaleP3(y, self)
     Errors.errorOnStaticTypes("Mul", "SP3", y)
Exemple #14
0
 def __add__(self, y):
     if y is zero:
         return self
     if isinstance(y, SP2):
         return addP2(self, y)
     if isinstance(y, Factory.SFact):
         return y + self
     Errors.errorOnStaticTypes("Add", "SP2", y)
     sys.exit()
Exemple #15
0
 def __rsub__(self, y):
     if y is zero:
         return zero.sub(self, zero)
     if isinstance(y, SP3):
         return subP3(y, self)
     Errors.errorOnStaticTypes("Sub", "SP3", y)
Exemple #16
0
 def __radd__(self, y):
     if y is zero:
         return self
     if isinstance(y, SHPR):
         return addHPR(self, y)
     Errors.errorOnStaticTypes("Add", "SHPR", y)
Exemple #17
0
 def __radd__(self, y):
     if y is zero:
         return self
     if isinstance(y, SP2):
         return addP2(self, y)
     Errors.errorOnStaticTypes("Add", "SP2", y)
Exemple #18
0
 def __rsub__(self, y):
     if y is zero:
         return zero.sub(self, zero)
     if isinstance(y, SP2):
         return subP2(y, self)
     Errors.errorOnStaticTypes("Sub", "SP2", y)
Exemple #19
0
 def __radd__(self, y):
     if y is zero:
         return self
     if isinstance(y, SP2):
         return addP2(self, y)
     Errors.errorOnStaticTypes("Add", "SP2", y)
Exemple #20
0
 def __rsub__(self, y):
     if y is zero:
         return self
     if isinstance(y, SHPR):
         return subHPR(self, y)
     Errors.errorOnStaticTypes("Sub", "SHPR", y)