linear algebra in pure Python?

Tim Hochberg tim.hochberg at ieee.org
Thu Jul 27 11:07:27 EDT 2000


Douglas du Boulay <ddb at crystal.uwa.edu.au> writes:

> Tim Hochberg wrote:

> > package. Another option would be to use JNumeric which is a (more or
> > less) drop in replacement for Numeric for use with JPython. The
> > LinearAlgebra package has not, unfortunately, been ported(1), but if
> 
> Thanks, Yes I have already looked at JNumeric. I actually spent a week
> or so
> modifying the PyMultiarray to accept Measurement (value,variance) pairs 
> and propogate them through multiplication addition etc, only to find out
> that the matrix vector arithmetic I was doing (predominantly 3x3 or 4x4)
> took from 10 to 30 times longer than the original pure-python based 
> matrix class (exploiting lists of lists) which I was using. 
> Needless to say I was disapointed. I am sure it would be terrific 
> as the matrices get larger, but I don't need that at the moment. 
> 
> I suspect the big killer was the very repetitious type coercions
> involved,
> which require construction of many temporary matrices 
> (and which I don't have any control over).

I'd be interested in seeing an example of the code that was running
slow for you. It may provide ideas / motivation for speeding up some
aspect of JNumeric. 

> On the topic of JNumeric, are you interested in a wedge/cross
> product and Levi-Cevita antisymmetric tensor function add on for
> PyMultiarray, or would that blow the equivalence with Numeric?

I'd also be interested in seeing this code. I'm not sure if I'd role
it in right now since if NumPy2 becomes a reality, I may be changing
JNumeric dramatically so that I can take advantage of the Python code
that will be written for that.

-tim



More information about the Python-list mailing list