From help-octave-request at bevo dot che dot wisc dot edu Mon Dec 6 05:40:04 1999 Subject: RE: LU decomposition/backsubstitution From: Michael Hanke To: Ted dot Harding at nessie dot mcc dot ac dot uk Cc: help-octave at bevo dot che dot wisc dot edu Date: Mon, 6 Dec 1999 12:33:50 +0100 On Mon, 06 Dec 1999, Ted Harding wrote: Surely setting > > B = A\U > >where U is an identity matrix of appropriate dimensions, would give >you what you are looking for (to within rounding errors, anyway): > > B*b = A\U*b = A\b > >Ted. Hi, I have the same problem sometimes. Your proposed solution does not seem to be optimal. B is simply the inverse matrix, and the complexity is O(n^3). The problem appears if one has to solve a number m << n (=size(A)) systems wher m is not known in advance. One could use the LU decomposition [L,U]=lu(A), and then x=U\(L\b). This works efficiently if octave sees that L and U are triangular (at least after permutation). Does octave see this? According to the documentation, matlab does. Regards, Michael -- +---------------------------------------------------------------+ | Michael Hanke Royal Institute of Technology | | NADA | | S-10044 Stockholm | | Sweden | +---------------------------------------------------------------+ | Visiting address: Lindstedtsvaegen 3 | | Phone: + (46) (8) 790 6278 | | Fax: + (46) (8) 790 0930 | | Email: hanke at nada dot kth dot se| | | na dot mhanke at na-net dot ornl dot gov| | +---------------------------------------------------------------+ ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------