Re: [Numpy-discussion] np.linalg.lstsq with several columns all 0 = huge x ?

2012-10-25 Thread denis
On 24/10/2012 19:59, josef.p...@gmail.com wrote:
 On Wed, Oct 24, 2012 at 1:33 PM, denisdenis-bz...@t-online.de  wrote:
 Folks,
 np.linalg.lstsq of a random-uniform A 50 x 32 with 3 columns all 0
 returns x[:3] 0 as expected,
 but 4 columns all 0 =  huge x:


 lstsq has rcond argument to do (I think) essentially the same.
 might need to be increased in your example.

 Josef

rcond 1e-3 works, 1e-6 does not, for these sizes;
the returned singular values don't change much from 3 to 4
columns of 0s, so why the big jump ?
cheers
   -- denis

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


[Numpy-discussion] np.linalg.lstsq with several columns all 0 = huge x ?

2012-10-24 Thread denis
Folks,
   np.linalg.lstsq of a random-uniform A 50 x 32 with 3 columns all 0
returns x[:3] 0 as expected,
but 4 columns all 0 = huge x:
lstsq (50, 32) with 4 columns all 0:
 [ -3.7e+09  -3.6e+13  -1.9e+13  -2.9e+12  7.3e-01 ...

This may be a roundoff problem, or even a Mac Altivec lapack bug,
not worth looking into. linalg.svd is ok though, odd.

Summary: if you run linalg.lstsq on big arrays,
either check max |x|
or regularize, do lstsq( vstack( A, weight * eye(dim) ),
  hstack( b, zeros(dim) ))

cheers
   -- denis

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


Re: [Numpy-discussion] np.linalg.lstsq with several columns all 0 = huge x ?

2012-10-24 Thread josef . pktd
On Wed, Oct 24, 2012 at 1:33 PM, denis denis-bz...@t-online.de wrote:
 Folks,
np.linalg.lstsq of a random-uniform A 50 x 32 with 3 columns all 0
 returns x[:3] 0 as expected,
 but 4 columns all 0 = huge x:
 lstsq (50, 32) with 4 columns all 0:
  [ -3.7e+09  -3.6e+13  -1.9e+13  -2.9e+12  7.3e-01 ...

 This may be a roundoff problem, or even a Mac Altivec lapack bug,
 not worth looking into. linalg.svd is ok though, odd.

 Summary: if you run linalg.lstsq on big arrays,
 either check max |x|
 or regularize, do lstsq( vstack( A, weight * eye(dim) ),
   hstack( b, zeros(dim) ))

lstsq has rcond argument to do (I think) essentially the same.
might need to be increased in your example.

Josef


 cheers
-- denis

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