[Matrix-SIG] Numerical python on SourceForge?

Travis Oliphant Oliphant.Travis@mayo.edu
Sun, 9 Jan 2000 23:03:18 -0600 (CST)

> PLEASE NOTE: a scalar is NOT a rank zero array.
> Fish provides a 'get' function to get the single value
> of a zero dimensional array.
> The point is: there is no need to identify python
> floats with a rank 0 array of float, in fact such identification
> is WRONG. There is a distinct difference between
> these two types, even though they are isomorphic
> (and also isomorphic to a rank 1 array of dimension 1)
> 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.  It may be an important disctinction for certain
algorithms; for me I do not see why it would make an algorithmic
difference for the current syntax.

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.  I have a colleague I'm trying to
convince to join us in the Python world who is very put off by this little
inconvenience.  I wonder how many others there are like him.

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
> The right way to do this is as follows: in Python,
> every 'scalar' type has a type object. We need a corresponding
> 'shape' object -- we can probably use the type object for this.
> For arrays, the shape must consist of a list of lists of integers
> and a scalar shape:
> 	mk_shape([[7,6],[3,4]],FloatType)
> or, 
> 	mk_shape(([7,6],[3,4]], "F") # "F" for float
> or, alternatively, a list of integers and
> any shape:
> 	mk_shape([7,6], mk_shape([3,4], FloatShape))

I've looked at the FISh web pages and it does look impressive.  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. 

Thanks for your help,