help-octave
[Top][All Lists]

## Re: LU decomposition: backsubstitution available?

 From: Mario Storti Subject: Re: LU decomposition: backsubstitution available? Date: Wed, 25 Mar 1998 09:26:45 -0300

```>>>>> On Wed, 25 Mar 1998 10:27:40 +0100 (MET),

> It is a known procedure for the solution of a sequence of
> systems of linear equations Ax=b with only varying rhs to
> make once a LU decompostion of A (function lu() of octave)
> and then backsubstitute for the several b's, e.g.
>   x=backsubs(l,u,b)
> As e.g. RLaB has such an mechanism, I thought of similar
> functionality in Octave, but did not find any.

> Can anybody shed some light on this?

> Thomas.

I faced this same problem  before. It would be   nice to have  someone
writing a 'backsubs' routine. It seems to me that it should be written
in fortran in order to be efficient (do to the triangular structure of
l and u).

Meanwhile, I think  that you make a  significant save in computational
effort if compute the inverse of A, say

> invA=inv(A);
> x1=invA*b1;
> x2=invA*b2;
> x3=invA*b3;
> .
> .

since  computing the  inverse requires  O(N^3) ops. and  matrix-vector
multiplication requires only O(N^2). Of course, if you know all the
rhs's at once, then you can put them incolumns in a matrix B and then
make a:

X= A \ B;

and solve all the systems at once.

Mario

%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%
Mario Alberto Storti                           | Fax: (54)(42) 55.09.44 |
Centro Internacional de Metodos Computacionales| Tel: (54)(42) 55.91.75 |
en Ingenieria - CIMEC                     |........................|
INTEC, Guemes 3450 - 3000 Santa Fe, Argentina                           |