Hi,
I found that ndarray is the wrong class to use for this purpose. The
vector I created in the example below was just en uninitialised 3D
vector. Arrays cannot be subclassed:
class Vector(np.array):
pass
returns an error. But using a matrix as base class works:
class Vector(np.matrix):
def __abs__(self):
l = np.sqrt(self*self.transpose())
return(l[0,0])
P.S. I know this is not strictly matplotlib related, but since MP uses
numpy so heavily, I felt free to ask.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net matplotlib-users List Signup and Options