[Matrix-SIG] Conversion of scalars.

Konrad Hinsen hinsen@cnrs-orleans.fr
Wed, 23 Jun 1999 20:29:14 +0200


> No that's not correct.  You would get doubles whenever you have doubles as
> arguments to the operation.  All it changes is how Python scalars and
> sequences are handled by default.  Even if the proposed attribute is set

But in many real-life cases, Python arrays are created from other
sequences. In fact, most NumPy functions accept other sequences as
well and convert them silently to arrays. All these conversions would
yield single-precision arrays, and the only way to get double
precision is to request it explicitly. I'd expect much existing code
to break with this behaviour.

> > As a library developer, I don't like at all that the accuracy of my
> > calculations depends on some user settings! I have plenty of routines
> > that would not work correctly in single precision.
> 
> Help me understand a bit better, I don't see what libraries this would
> break.  If a double array is ever introduced into the operation then
> everything immediately becomes double precision.  The suggestion does not

In many cases the input is a Python scalar or a list of Python
scalars, which is at some point converted to an array.

> break that behavior it just changes the default handling of Python scalars
> (for which there are no single precision versions).  If the user does not
> want single precision he/she wouldn't have to use it.  The default would
> be as it is now.

Fine, but if much existing code doesn't work with the single-precision
setting, it won't be useful. And using code that needs double
precision together with code that needs single precision in one
application seems like a much bigger mess than all the other proposals
I have seen recently.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------