Re: [Numpy-discussion] switching to float32

2009-06-27 Thread Dan Goodman
Dag Sverre Seljebotn wrote: > Well, such a mechanism would mean that your code could not be reused > reliably by other code (because, what if two different codebases sets > different defaults...). So requiring any such mechanism would make it > easier to write non-reusable code, which is general

Re: [Numpy-discussion] switching to float32

2009-06-27 Thread David Goldsmith
--- On Sat, 6/27/09, Dag Sverre Seljebotn wrote: > Note that it is relatively easy for you to do e.g. > > default_dtype = np.float32 > > def array(*args, **kw): > if 'dtype' not in kw.keys(): > return np.array(*args, **kw, dtype=default_dtype) > else: > return np.ar

Re: [Numpy-discussion] switching to float32

2009-06-27 Thread Dag Sverre Seljebotn
Dan Goodman wrote: > Robert Kern wrote: >> On Fri, Jun 26, 2009 at 03:39, Christian K. wrote: >>> John Schulman caltech.edu> writes: >>> I'm trying to reduce the memory used in a calculation, so I'd like to switch my program to float32 instead of float64. Is it possible to change th

Re: [Numpy-discussion] switching to float32

2009-06-27 Thread Dan Goodman
Robert Kern wrote: > On Fri, Jun 26, 2009 at 03:39, Christian K. wrote: >> John Schulman caltech.edu> writes: >> >>> I'm trying to reduce the memory used in a calculation, so I'd like to >>> switch my program to float32 instead of float64. Is it possible to >>> change the numpy default float size,

Re: [Numpy-discussion] switching to float32

2009-06-26 Thread Christian K.
Robert Kern schrieb: > On Fri, Jun 26, 2009 at 03:39, Christian K. wrote: >> John Schulman caltech.edu> writes: >> >>> >>> I'm trying to reduce the memory used in a calculation, so I'd like to >>> switch my program to float32 instead of float64. Is it possible to >>> change the numpy default float

Re: [Numpy-discussion] switching to float32

2009-06-26 Thread Robert Kern
On Fri, Jun 26, 2009 at 03:39, Christian K. wrote: > John Schulman caltech.edu> writes: > >> >> I'm trying to reduce the memory used in a calculation, so I'd like to >> switch my program to float32 instead of float64. Is it possible to >> change the numpy default float size, so I don't have to exp

Re: [Numpy-discussion] switching to float32

2009-06-26 Thread Christian K .
John Schulman caltech.edu> writes: > > I'm trying to reduce the memory used in a calculation, so I'd like to > switch my program to float32 instead of float64. Is it possible to > change the numpy default float size, so I don't have to explicitly > state dtype=np.float32 everywhere? Possibly no

Re: [Numpy-discussion] switching to float32

2009-06-25 Thread Geoffrey Ely
This does not exactly answer your question, but you can use the dtype string representation and positional parameter to make things nicer. For example: a = numpy.array( [1.0, 2.0, 3.0], 'f' ) instead of a = numpy.array( [1.0, 2.0, 3.0], dtype=numpy.float32 ) -Geoff On Jun 25, 2009, at 6:43

[Numpy-discussion] switching to float32

2009-06-25 Thread John Schulman
I'm trying to reduce the memory used in a calculation, so I'd like to switch my program to float32 instead of float64. Is it possible to change the numpy default float size, so I don't have to explicitly state dtype=np.float32 everywhere? Thanks, John __