[Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Joon
Hi,I was wondering when it is better to store cholesky factor and use it to solve Ax = b, instead of storing the inverse of A. (A is a symmetric, positive-definite matrix.)Even in the repeated case, if I have the inverse of A (invA) stored, then I can solve Ax = b_i, i = 1, ... , n, by x =

[Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Joon
Hi,I was wondering when it is better to store cholesky factor and use it to solve Ax = b, instead of storing the inverse of A. (A is a symmetric, positive-definite matrix.)Even in the repeated case, if I have the inverse of A (invA) stored, then I can solve Ax = b_i, i = 1, ... , n, by x =

Re: [Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Pauli Virtanen
Mon, 08 Nov 2010 13:17:11 -0600, Joon wrote: I was wondering when it is better to store cholesky factor and use it to solve Ax = b, instead of storing the inverse of A. (A is a symmetric, positive-definite matrix.) Even in the repeated case, if I have the inverse of A (invA) stored, then I

Re: [Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Joon
On Mon, 08 Nov 2010 13:23:46 -0600, Pauli Virtanen p...@iki.fi wrote: Mon, 08 Nov 2010 13:17:11 -0600, Joon wrote: I was wondering when it is better to store cholesky factor and use it to solve Ax = b, instead of storing the inverse of A. (A is a symmetric, positive-definite matrix.) Even in

Re: [Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Joon
On Mon, 08 Nov 2010 13:23:46 -0600, Pauli Virtanen p...@iki.fi wrote: Mon, 08 Nov 2010 13:17:11 -0600, Joon wrote: I was wondering when it is better to store cholesky factor and use it to solve Ax = b, instead of storing the inverse of A. (A is a symmetric, positive-definite matrix.) Even

Re: [Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Bruce Southey
On 11/08/2010 01:38 PM, Joon wrote: On Mon, 08 Nov 2010 13:23:46 -0600, Pauli Virtanen p...@iki.fi wrote: Mon, 08 Nov 2010 13:17:11 -0600, Joon wrote: I was wondering when it is better to store cholesky factor and use it to solve Ax = b, instead of storing the inverse of A. (A is a

Re: [Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Pauli Virtanen
On Mon, 08 Nov 2010 14:06:03 -0600, Bruce Southey wrote: [clip] Numpy uses SVD to get the (pseudo) inverse, which is usually very accurate at getting (pseudo) inverse. numpy.linalg.inv does solve(a, identity(a.shape[0], dtype=a.dtype)) It doesn't use xGETRI since that's not included

Re: [Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Nathaniel Smith
On Mon, Nov 8, 2010 at 12:00 PM, Joon groups.and.li...@gmail.com wrote: Another question is, is it better to do cho_solve(cho_factor(A), b) than solve(A, b)? If A is symmetric positive definite, then using the cholesky decomposition should be somewhat faster than using a more general solver.

Re: [Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Anne Archibald
On 8 November 2010 14:38, Joon groups.and.li...@gmail.com wrote: Oh I see. So I guess in invA = solve(Ax, I) and then x = dot(invA, b) case, there are more places where numerical errors occur, than just x = solve(Ax, b) case. That's the heart of the matter, but one can be more specific. You

Re: [Numpy-discussion] Solving Ax = b: inverse vs cholesky factorization

2010-11-08 Thread Joon
Thanks, Nathaniel. Your reply was very helpful. -Joon On Mon, 08 Nov 2010 15:47:22 -0600, Nathaniel Smith n...@pobox.com wrote: On Mon, Nov 8, 2010 at 12:00 PM, Joon groups.and.li...@gmail.com wrote: Another question is, is it better to do cho_solve(cho_factor(A), b) than solve(A, b)? If A