[Matrix-SIG] Space-saving arrays and authoring tools.

Rick White rlw@stsci.edu
Thu, 20 Jan 2000 10:26:34 -0500 (EST)


Travis Oliphant writes:

>Currently, the behavior if two spacesaving arrays are found in an
>operation is to cast to the largest precision spacesaving array.  However,
>when a similar proposal was made several months ago by Michael Hudson,
>several people said that it would be better to throw an exception under
>such circumstances.  I would like more opinions on this.  I haven't had
>enough experience to decide which is better, but I'm leaning towards the
>throwing-the-exception option.

My 2-cents worth: *please* don't make raising an exception the only
behavior.  The standard promotion rules (within the savespace
hierarchy) will be useful for most applications for the same reason
they are useful for normal scalar expressions.  And for dynamically
typed languages like Python, it just does not make sense to me to start
throwing exceptions when the types disagree.

In our applications (image processing) we use a variety of types (1, 2,
& 4-byte integers, single & double precision floats).  A typical
operation is to start with raw data from a detector in an integer
format and to divide it by the detector's 'flat-field' response to
correct for sensitivity variations.  The image gets converted to
floating-point in the process.  If the Numeric code is raising
exceptions for mixed type expressions, I'm going to be forced to write
very ugly-looking code to test myself for the types of the input
quantities and explicitly promote them to the right output types.  Then
I'll lose many of the advantages of having dynamically typed
variables.

Personally I'd be happy if the only behavior was Travis's original
version that promotes within the savespace hierarchy.  But if some
people really want the exception-throwing behavior then I think Rob
Hooft's proposal of allowing savespace=-1 sounds like a possible
solution.  That sufficiently complicates the behavior that I'd do
without it if it were up to me.
					Rick
---
Richard L. White    rlw@stsci.edu    http://sundog.stsci.edu/rick/
Space Telescope Science Institute
Baltimore, MD