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