[Matrix-SIG] Numeric Nits
Scott M. Ransom
ransom@cfa.harvard.edu
Tue, 22 Jun 1999 21:32:18 +0000
Tim Hochberg wrote:
> Second, two static functions could be added to Numeric to set the precision
> of Scalar values. By default, floats would be converted to type 'd' when
> they are converted to zero-d arrays, as they are now, but a call to:
>
> >>> Numeric.setFloatPrecision('f')
>
> ......
Is there a way to make this a more general solution when working with
Numeric? To change the casting rules as a whole -- instead of just for
zero-d arrays? Or would this not be possible (i.e. since it goes
against the core Python rules).
As another astronomer trying to wean myself from IDL, I have to agree
with Rick and Perry that the memory use/efficiency issues with Numeric
are quite important. I frequently deal with _huge_ (~10**8 point) 1-D
time series (I am using a parallelized version of Python on an IBM SP2
among others), all of which are single precision float or single
precision complex.
I am currently working around the upcasts by using a few 'C' routines to
perform some simple vector math and/or casting. So my code would
certainly be amongst the rare bits that would be broken by changes to
the casting or precision rules. But I would actually really like to see
such changes.
I completely agree that an ugly solution will turn away substantial
numbers of scientific users -- something that I don't believe is good
for any of us. With Tim's proposal, should it be possible to extend it
to all numeric arrays, we could keep the majority of legacy code
un-broken and still allow those of us working with un-gainly sized
arrays the opportunity to prod and poke at our data sets interactively
instead of making us run back to good-ole-'C'.
Scott
--
Scott M. Ransom
Phone: (781) 320-9867 Address: 75 Sanderson Ave.
email: ransom@cfa.harvard.edu Dedham, MA 02026
PGP Fingerprint: D2 0E D0 10 CD 95 06 DA EF 78 FE 2B CB 3A D3 53