I'm trying to write a small library of differential geometry, and I
have some trouble subclassing ndarray.
I'd like an HomogeneousMatrix class that subclasse ndarray and
overloads some methods, such as inv().
Here is my first try, the inv() function and the inv_v1() method work
as expected, but the inv_v2() and inv_v3() methods do not change the
object at all. Can somebody explain me what is happening here ?
import numpy as np
inverse of an homogeneous matrix
R = H[0:3,0:3]
p = H[0:3,3:4]
return np.vstack( (np.hstack((R.T,-np.dot(R.T,p))), [0,0,0,1]))
def __new__(subtype, data=np.eye(4)):
subarr = np.array(data)
self[0:4,0:4] = htr.inv(self)
data = htr.inv(self)
self = HomogeneousMatrix(data)
self = htr.inv(self)
Thank you !