[PYTHON MATRIX-SIG] Final conventions for alpha2
Jim Hugunin
hugunin@mit.edu
Fri, 16 Aug 1996 12:03:06 -0400
I've made my decisions on the final conventions for alpha2, but I
thought I'd give people a chance to comment on them before the end of
the day today when the release goes out. Yep, you heard right, alpha2
will be available before I go home tonight.
These are also very likely to be the conventions for the final release,
but I'm not making any promises until 1.0beta1.
1) Explicitly declaring an array's type
Note: most people will never need to use any of these names as the
typical array functions will produce the right type by default.
For types constants will be defined within Numeric.py. They will have
the following names (on a typical system, on a supercomputer their might
be different values available):
Float - the size of a python float, generally the largest float
available on your system
Float0 - the smallest float on your system (usually Float32)
Float32 - usually how you get a C float
Float64 - usually how you get a C double
For integers:
Integer and Integer0 as before
UnsignedInteger8
Integer8
Integer16
Integer32
Integer64 (if you're lucky)
For complex numbers:
Complex, Complex0
Complex32 and Complex64
This solution is clearly a compromise, but the best compromise I could
come up with.
2) Default axes
After reading all of the discussion over what are the appropriate axes
for the various operations, I've become convinced that there is no
obvious choice. Therefore I think it is really important to have a
single default axis so that at least people will only have one rule to
remember.
Because I can't possibly conceive of doing "fft" and its ilk with a
default axis other than -1, every function in NumPy will have a default
axis of -1 (or -2 for matrix operations). This currently includes all
of the following functions.
sort, argsort, argmax, argmin, fft,
take, repeat, compress, concatenate,
ufunc.reduce, ufunc.accumulate
I wish I could come up with a better compromise, but I myself was
finding it hard to remember what the default axes were for different
operations, and that's just intolerable.
I will add keyword arguments to all of the functions that accept an axis
so that you can at least write concatenate([a,b], axis=0) which I think
is much more readable than the non-keyword alternative.
-Jim
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================