[Matrix-SIG] Conversion of scalars.

Konrad Hinsen hinsen@cnrs-orleans.fr
Wed, 23 Jun 1999 19:28:03 +0200


> Setting up some way to alter these return types would also have the effect
> of changing the way sequences of these types were returned so
> array([1.,3.,4.]) would become an array of type 'f'.

If I understood your idea correctly, you would *never* get double
precision arrays from any operation. If that's what you want, just
compile your private version of NumPy in such a way that PyArray_DOUBLE
corresponds to a C float!

> I like the idea of having this return type be user settable.  It would be
> easy to do by just having this code return what the user settable type is
> for the integer, float, and complex objects of Python.

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.

> Asside from introducing a global variable floating around I don't see how
> to do this without an extra argument to PyArrayObject_Type, which isn't
> too bad except it requires all Numeric extensions which use this function
> to be changed (I'd be willing to change all of mine, though.)

I wouldn't. Not because of the effort in changing the code, but
because most of my NumPy is published and has a non-neglectable user
base. I already spend too much time answering questions about
installation problems, so I don't need the additional trouble of
explaining which version of my code works with which version of NumPy.
Backwards compatibility has always been a strong point of Python!

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
-------------------------------------------------------------------------------