Christopher Barker wrote:
> Wayne Watson wrote:
>   
>> Yes, flat sounds useful here. However, numpy isn't bending over 
>> backwards to tie in conventional mathematical language into it.
>>     
>
> exactly -- it isn't bending over at all! (well a little -- see below). 
> numpy was designed for general purpose computational needs, not any one 
> branch of math. nd-arrays are very useful for lots of things. In 
> contrast, Matlab, for instance, was originally designed to be an easy 
> front-end to linear algebra package. Personally, when I used Matlab, I 
> found that very awkward -- I was usually writing 100s of lines of code 
> that had nothing to do with linear algebra, for every few lines that 
> actually did matrix math. So I much prefer numpy's way -- the linear 
> algebra lines of code are longer an more awkward, but the rest is much 
> better.
>
> The Matrix class is the exception to this: is was written to provide a 
> natural way to express linear algebra. However, things get a bit tricky 
> when you mix matrices and arrays, and even when sticking with matrices 
> there are confusions and limitations -- how do you express a row vs a 
> column vector? what do you get when you iterate over a matrix? etc.
>
> There has been a bunch of discussion about these issues, a lot of good 
> ideas, a little bit of consensus about how to improve it, but no one 
> with the skill to do it has enough motivation to do it.
>   
I recently got motivated to get better linear algebra for Python; and 
startet submitting and writing on patches for Sage instead (which of 
course uses NumPy underneath). Sage has a strong concept of matrices and 
vectors, but not much numerical support, mainly exact or multi-precision 
arithmetic. So perhaps there will be more progress there; I'm not sure 
yet how far it will get or if anybody will join me in doing it...

To me that seems like the ideal way to split up code -- let NumPy/SciPy 
deal with the array-oriented world and Sage the closer-to-mathematics 
notation.

I never liked the NumPy matrix class. I think this is mainly because my 
matrices are often, but not always, diagonal, which doesn't fit at all 
into NumPy's way of thinking about these things. (Also a 2D or 3D array 
could easily be a "vector", like if you want to linearily transform the 
values of the pixels in an image. So I think any Python linear algebra 
package has to attack things in a totally different way from numpy.matrix).

Dag Sverre
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to