예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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()
예제 #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)
예제 #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)
예제 #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()
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)