Re: [Numpy-discussion] linalg.norm probems

2015-03-04 Thread Charles R Harris
On Tue, Mar 3, 2015 at 7:12 PM, Ralf Gommers ralf.gomm...@gmail.com wrote:



 On Wed, Mar 4, 2015 at 1:34 AM, Charles R Harris 
 charlesr.har...@gmail.com wrote:



 On Tue, Mar 3, 2015 at 5:31 PM, Charles R Harris 
 charlesr.har...@gmail.com wrote:



 On Tue, Mar 3, 2015 at 5:21 PM, Jaime Fernández del Río 
 jaime.f...@gmail.com wrote:

 On Tue, Mar 3, 2015 at 4:11 PM, Charles R Harris 
 charlesr.har...@gmail.com wrote:

 Hi All,

 This is with reference to issue  #5626
 https://github.com/numpy/numpy/issues/5626. Currently linalg.norm
 converts the input like so `x = asarray(x)`. This can produce integer
 arrays, which in turn may create problems of overflow, or the failure of
 the abs functions for minimum values of signed integer types. I propose to
 convert the input to a minimum precision of float32. However, this will be
 a change in behavior. I'd guess that that might not be much of a problem,
 as otherwise it is likely that this problem would have been reported
 earlier.

 Thoughts?


 Not sure if it makes sense here, but elsewhere (I think it was polyval)
 we let object arrays through unchanged.


 That would still work. I'm thinking something like

 x = asarray(x)
 dt = result_type(x, np.float32)
 if x.dtype.type is not dt.type:
 x = x.astype(dt)


 I'd actually like to add a `min_dtype` keyword to asarray, We need it in
 several places.


 That sounds like a good idea.


Not sure what idea you are referring to,  but Ive added a `precision`
keyword in gh- 5634. https://github.com/numpy/numpy/pull/5634

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] linalg.norm probems

2015-03-03 Thread Jaime Fernández del Río
On Tue, Mar 3, 2015 at 4:11 PM, Charles R Harris charlesr.har...@gmail.com
wrote:

 Hi All,

 This is with reference to issue  #5626
 https://github.com/numpy/numpy/issues/5626. Currently linalg.norm
 converts the input like so `x = asarray(x)`. This can produce integer
 arrays, which in turn may create problems of overflow, or the failure of
 the abs functions for minimum values of signed integer types. I propose to
 convert the input to a minimum precision of float32. However, this will be
 a change in behavior. I'd guess that that might not be much of a problem,
 as otherwise it is likely that this problem would have been reported
 earlier.

 Thoughts?


Not sure if it makes sense here, but elsewhere (I think it was polyval) we
let object arrays through unchanged.

Jaime

-- 
(\__/)
( O.o)
(  ) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes
de dominación mundial.
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] linalg.norm probems

2015-03-03 Thread Charles R Harris
On Tue, Mar 3, 2015 at 5:21 PM, Jaime Fernández del Río 
jaime.f...@gmail.com wrote:

 On Tue, Mar 3, 2015 at 4:11 PM, Charles R Harris 
 charlesr.har...@gmail.com wrote:

 Hi All,

 This is with reference to issue  #5626
 https://github.com/numpy/numpy/issues/5626. Currently linalg.norm
 converts the input like so `x = asarray(x)`. This can produce integer
 arrays, which in turn may create problems of overflow, or the failure of
 the abs functions for minimum values of signed integer types. I propose to
 convert the input to a minimum precision of float32. However, this will be
 a change in behavior. I'd guess that that might not be much of a problem,
 as otherwise it is likely that this problem would have been reported
 earlier.

 Thoughts?


 Not sure if it makes sense here, but elsewhere (I think it was polyval) we
 let object arrays through unchanged.


That would still work. I'm thinking something like

x = asarray(x)
dt = result_type(x, np.float32)
if x.dtype.type is not dt.type:
x = x.astype(dt)

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] linalg.norm probems

2015-03-03 Thread Charles R Harris
On Tue, Mar 3, 2015 at 5:31 PM, Charles R Harris charlesr.har...@gmail.com
wrote:



 On Tue, Mar 3, 2015 at 5:21 PM, Jaime Fernández del Río 
 jaime.f...@gmail.com wrote:

 On Tue, Mar 3, 2015 at 4:11 PM, Charles R Harris 
 charlesr.har...@gmail.com wrote:

 Hi All,

 This is with reference to issue  #5626
 https://github.com/numpy/numpy/issues/5626. Currently linalg.norm
 converts the input like so `x = asarray(x)`. This can produce integer
 arrays, which in turn may create problems of overflow, or the failure of
 the abs functions for minimum values of signed integer types. I propose to
 convert the input to a minimum precision of float32. However, this will be
 a change in behavior. I'd guess that that might not be much of a problem,
 as otherwise it is likely that this problem would have been reported
 earlier.

 Thoughts?


 Not sure if it makes sense here, but elsewhere (I think it was polyval)
 we let object arrays through unchanged.


 That would still work. I'm thinking something like

 x = asarray(x)
 dt = result_type(x, np.float32)
 if x.dtype.type is not dt.type:
 x = x.astype(dt)


I'd actually like to add a `min_dtype` keyword to asarray, We need it in
several places.

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] linalg.norm probems

2015-03-03 Thread Charles R Harris
Hi All,

This is with reference to issue  #5626
https://github.com/numpy/numpy/issues/5626. Currently linalg.norm
converts the input like so `x = asarray(x)`. This can produce integer
arrays, which in turn may create problems of overflow, or the failure of
the abs functions for minimum values of signed integer types. I propose to
convert the input to a minimum precision of float32. However, this will be
a change in behavior. I'd guess that that might not be much of a problem,
as otherwise it is likely that this problem would have been reported
earlier.

Thoughts?

Chuck
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] linalg.norm probems

2015-03-03 Thread Ralf Gommers
On Wed, Mar 4, 2015 at 1:34 AM, Charles R Harris charlesr.har...@gmail.com
wrote:



 On Tue, Mar 3, 2015 at 5:31 PM, Charles R Harris 
 charlesr.har...@gmail.com wrote:



 On Tue, Mar 3, 2015 at 5:21 PM, Jaime Fernández del Río 
 jaime.f...@gmail.com wrote:

 On Tue, Mar 3, 2015 at 4:11 PM, Charles R Harris 
 charlesr.har...@gmail.com wrote:

 Hi All,

 This is with reference to issue  #5626
 https://github.com/numpy/numpy/issues/5626. Currently linalg.norm
 converts the input like so `x = asarray(x)`. This can produce integer
 arrays, which in turn may create problems of overflow, or the failure of
 the abs functions for minimum values of signed integer types. I propose to
 convert the input to a minimum precision of float32. However, this will be
 a change in behavior. I'd guess that that might not be much of a problem,
 as otherwise it is likely that this problem would have been reported
 earlier.

 Thoughts?


 Not sure if it makes sense here, but elsewhere (I think it was polyval)
 we let object arrays through unchanged.


 That would still work. I'm thinking something like

 x = asarray(x)
 dt = result_type(x, np.float32)
 if x.dtype.type is not dt.type:
 x = x.astype(dt)


 I'd actually like to add a `min_dtype` keyword to asarray, We need it in
 several places.


That sounds like a good idea.

Ralf
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion