[Numpy-discussion] Re: NumPy Behavior

Travis Oliphant oliphant at ee.byu.edu
Wed Feb 1 11:37:09 CST 2006


Jay Painter wrote:

>Travis,
>
>I updated to the latest svn code this morning and ran some mmlib tests.
>Your commit has fixed the segmentation fault/illegal instruction error,
>but the mmlib test suite fails.  I'll look into it tonight, it may just
>be intentional differences between Numeric and NumPy.  I'll let you know
>what I find.
>  
>
Be sure to look over the list of differences in the sample chapter of my 
book (available at numeric.scipy.org)

The numpy.lib.convertcode module can be used to make most of the changes 
(but there may be a few it misses). 

>As I've been working with Numeric, I have often desired some particular
>features which I'd be willing to work on with NumPy.  Maybe these have
>come up before?
>
>1) Alternative implementations of matrixmultiply() and
>eigenvalues()/eigenvalues() for symmetric matrices.  For example, there
>is a analytic expression for the eigenvalues of a 3x3 symmetric matrix.
>
>2) New C implemented vectorM and matrixMN classes which support the
>array interface.  This could allow for lower memory usage via pool
>allocations and the customized implementations in item #1.  The ones I
>wish were there are:
>
>class vector3:
>class vector4:
>class matrix33:
>class matrix44:
>class symmetric_matrix33:
>class symmetric_matrix44:
>
>Given this, here's a useful function for graphics applications:
>
>matrixmultiply431(type matrix44, type vector3)
>
>This function multiplies the 4x4 matrix by the three dimensional vector
>by implicitly adding a fourth element with a value of 1.0 to the vector.
>  
>
This is actually a benefit of the array interface.  It allows many 
different objects to *be* arrays and allow fast converions when 
possible.   Specialized small-arrays are a good idea, I think, just like 
specialized (sparse) large arrays.   Perhaps it would make sense to 
define a base-class array object that has only a very few things defined 
like the number of dimensions, a pointer to the actual memory, the 
flags, and perhaps a pointer to the typeobject.   This would leave 
things like how the dimensions are stored up for sub-classes to define.

-Travis






More information about the Numpy-discussion mailing list