[Matrix-SIG] Numerical python on SourceForge?

skaller skaller@maxtal.com.au
Tue, 11 Jan 2000 19:33:23 +1100


Travis Oliphant wrote:

> > It is very important to get the shape calculus exactly right.
> > The Fish type/shape system was developed by one of the worlds
> > leading categories-in-computing theorists, Barry Jay.
> 
> Well, I appreciate your insight, but frankly I don't really care whether
> or not we are pedantic about the difference between a zero dimensional
> array and a scalar.  

> What I do care about is that the current difference between rank-0 arrays
> and Python basic types and the practice of always returning rank-0 arrays
> as Python basic types means that it is an unnecessary pain to write code
> that keeps all data in single precision. 

	So you DO care :-)

> Perhaps if arrays get into the core then even with the distinction between
> NumPy arrays and basic types there will not be the problems there are
> currently.

	Well, arrays will get into the Viper core.
The reason they're not available at the moment is precisely
because I care a lot for numerical programming. So whatever
Guido does, there _will_ be a pythonic numerical programming
environment available: the issue for me at the moment is
whether to just stick with NumPy as is, or go for the broke,
and provide the best high performance system available.

> I've looked at the FISh web pages and it does look impressive.  

	I worked on Fish, and I'm impressed too.
That doesn't happen very often :-)

> I'm missing how it could by applied to an interactive environment with Python
> syntax?  I know you've tried to explain FISh in the past.  But I need a
> little more help understanding how it would work with Python.

	you are asking two questions, about interactivity,
and about syntax.

	Interactivity is not a problem: for _small_ problems,
Fish will be slower than even plain Python, but as the size
of the problems grows, it will begin to shine. The existing
Fish front end is already interactive, in fact, I did some
work to make it more suitable for _batch_ processing :-)

	The syntax issue is _much_ harder: I do not know
the answer. What Fish does is as follows:

	1a) Parse the Fish language, and ML like syntax with
	    Algol like semantics

	2) Partially evaluate the resultant Abstract Syntax Tree,
	    reducing Fish language terms to a special sublanguage
   	    called Turbot: this includes type and shape inference.

	3) Translate the Turbot code into Fortran or C, compile it,
	   and execute it.

A large part of the work is done in the partial evaluator:
it does things like function inlining (beta reduction).

NumPy has various builtin operations which correspond
in a fairly obvious way to loops, folds, maps, and other
things which _could_ be written in Fish, so it seems possible
to translate it into Fish terms, and submit them to
partial evaluation: the hard bit is converting Python
functions applied to NumPy arrays, nor the actual array handling.

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
homepage: http://www.maxtal.com.au/~skaller
download: ftp://ftp.cs.usyd.edu/au/jskaller