small changes suggested by Franz

This commit is contained in:
Martin Diehl 2019-05-05 22:35:12 +02:00
parent 39cc9e35ae
commit 9b0d3def1d
2 changed files with 4 additions and 7 deletions

View File

@ -83,7 +83,7 @@ class Rotation:
]) ])
elif other.shape == (3,3,): # rotate a single (3x3)-matrix elif other.shape == (3,3,): # rotate a single (3x3)-matrix
return np.dot(self.asMatrix(),np.dot(other,self.asMatrix().T)) return np.dot(self.asMatrix(),np.dot(other,self.asMatrix().T))
elif other.shape == (3,3,3,3): elif other.shape == (3,3,3,3,):
raise NotImplementedError raise NotImplementedError
else: else:
return NotImplemented return NotImplemented

View File

@ -78,10 +78,8 @@ class Quaternion:
return NotImplemented return NotImplemented
def __neg__(self): def __neg__(self):
"""Unary positive operator""" """Unary negative operator"""
self.q *= -1.0 return self * -1.0
self.p *= -1.0
return self
def __mul__(self, other): def __mul__(self, other):
@ -208,8 +206,7 @@ class Quaternion:
def homomorph(self): def homomorph(self):
"""Homomorphs in-place""" """Homomorphs in-place"""
self.q = -self.q self *= -1.0
self.p = -self.p
return self return self
def homomorphed(self): def homomorphed(self):