list math for version 1.5.2 without Numeric

J.Jacob joost_jacob at hotmail.com
Fri Nov 30 03:51:39 EST 2001


> By the way, your original code:
> 
> for j in range(self.nh):
>     sum = 0.0
>     for i in range(self.ni):
>         sum = sum + self.ai[i] * self.wi[i][j]
> 
> Are you sure you want to re-set sum inside the j loop? you are
> re-defining it, so unless you store it, you are only going to get the
> sum of the last row, which makes it pretty silly to loop through the
> whole mess.

Of course....i did only show the part of the loop where most time is
spend, the sum value is used every iteration.

> 
> Anyway, here is the code for Numeric. You must be using some pretty slow
> hardware, or massive arrays to get times as long as you get!

um, both hehe.  A lot of neural networks are created and all tested. 
That is why even a 50% speedup could be interesting.  If it all takes
too long i just change the experiment setup.

[snip nice Numeric example]

Thank you for the Numeric example.  The problem here (univ) is we are
not allowed to install anything (except in our personal folder).  And
not all computers are on the same network so pointing to a Numeric
package in my personal folder is no use.  Also not all computers have
the same OS so you do not even have one single personal folder.  We
walk around with floppies sometimes :)  I really need something
totally portable and sticking to whatever is in Python 1.5.2 is the
most portable thing i have seen so far.  In this respect Python is
MUCH better than Java.  When they install Python 2.1 on all computers
I will be very happy but i believe 2.1 also has no Numeric.
I wish Numeric came with Python itself !
I'm thinking of a way to put Numeric on a floppy so i can use it with
my program (also on the floppy) on any OS.



More information about the Python-list mailing list