Re: [Numpy-discussion] linear algebra help

2009-05-18 Thread Charles R Harris
On Mon, May 18, 2009 at 9:35 AM, wrote: > On Mon, May 18, 2009 at 10:55 AM, Charles R Harris > wrote: > > > > > > 2009/5/18 Stéfan van der Walt > >> > >> 2009/5/18 Sebastian Walter : > >> > B = numpy.dot(A.T, A) > >> > >> This multiplication should be avoided whenever possible -- you are > >> e

Re: [Numpy-discussion] linear algebra help

2009-05-18 Thread josef . pktd
On Mon, May 18, 2009 at 10:55 AM, Charles R Harris wrote: > > > 2009/5/18 Stéfan van der Walt >> >> 2009/5/18 Sebastian Walter : >> > B = numpy.dot(A.T, A) >> >> This multiplication should be avoided whenever possible -- you are >> effectively squaring your condition number. > > Although the cond

Re: [Numpy-discussion] linear algebra help

2009-05-18 Thread Charles R Harris
2009/5/18 Stéfan van der Walt > 2009/5/18 Sebastian Walter : > > B = numpy.dot(A.T, A) > > This multiplication should be avoided whenever possible -- you are > effectively squaring your condition number. > Although the condition number doesn't mean much unless the columns are normalized. Having

Re: [Numpy-discussion] linear algebra help

2009-05-18 Thread Sebastian Walter
2009/5/18 Stéfan van der Walt : > 2009/5/18 Sebastian Walter : >> B = numpy.dot(A.T, A) > > This multiplication should be avoided whenever possible -- you are > effectively squaring your condition number. Indeed. > > In the case where you have more rows than columns, use least squares. > For squar

Re: [Numpy-discussion] linear algebra help

2009-05-18 Thread Stéfan van der Walt
2009/5/18 Sebastian Walter : > B = numpy.dot(A.T, A) This multiplication should be avoided whenever possible -- you are effectively squaring your condition number. In the case where you have more rows than columns, use least squares. For square matrices use solve. For large sparse matrices, use

Re: [Numpy-discussion] linear algebra help

2009-05-18 Thread Sebastian Walter
Alternatively, to solve A x = b you could do import numpy import numpy.linalg B = numpy.dot(A.T, A) c = numpy.dot(A.T, b) x = numpy.linalg(B,c) This is not the most efficient way to do it but at least you know exactly what's going on in your code. On Sun, May 17, 2009 at 7:21 PM, wrote: > O

Re: [Numpy-discussion] linear algebra help

2009-05-17 Thread josef . pktd
On Sun, May 17, 2009 at 12:14 PM, Quilby wrote: > Right the dimensions I gave were wrong. > What do I need to do for m>=n (more rows than columns)?  Can I use the > same function? > > When I run the script written by Nils (thanks!) I get: >    from numpy.random import rand, seed > ImportError: No

Re: [Numpy-discussion] linear algebra help

2009-05-17 Thread Quilby
Right the dimensions I gave were wrong. What do I need to do for m>=n (more rows than columns)? Can I use the same function? When I run the script written by Nils (thanks!) I get: from numpy.random import rand, seed ImportError: No module named random But importing numpy works ok. What do I

Re: [Numpy-discussion] linear algebra help

2009-05-16 Thread Alan G Isaac
On 5/16/2009 9:01 AM Quilby apparently wrote: > Ax = y > Where A is a rational m*n matrix (m<=n), and x and y are vectors of > the right size. I know A and y, I don't know what x is equal to. I > also know that there is no x where Ax equals exactly y. If m<=n, that can only be true if there are no

Re: [Numpy-discussion] linear algebra help

2009-05-16 Thread josef . pktd
On Sat, May 16, 2009 at 9:01 AM, Quilby wrote: > Hi- > This is what I need to do- > > I have this equation- > > Ax = y > > Where A is a rational m*n matrix (m<=n), and x and y are vectors of > the right size. I know A and y, I don't know what x is equal to. I > also know that there is no x where A

Re: [Numpy-discussion] linear algebra help

2009-05-16 Thread Nils Wagner
On Sat, 16 May 2009 16:01:00 +0300 Quilby wrote: > Hi- > This is what I need to do- > > I have this equation- > > Ax = y > > Where A is a rational m*n matrix (m<=n), and x and y are >vectors of > the right size. I know A and y, I don't know what x is >equal to. I > also know that there is n

[Numpy-discussion] linear algebra help

2009-05-16 Thread Quilby
Hi- This is what I need to do- I have this equation- Ax = y Where A is a rational m*n matrix (m<=n), and x and y are vectors of the right size. I know A and y, I don't know what x is equal to. I also know that there is no x where Ax equals exactly y. I want to find the vector x' such that Ax' is