[SciPy-user] fastest 'solve' for triangular matrix?

Emanuele Olivetti emanuele@relativita....
Mon Jul 21 05:12:47 CDT 2008

Oops, the previous code was incorrect (it referred to the upper-triangular
case, not the lower-triangular). Here is the correct version:

# L = lower-triangular matrix
piv = N.arange(L.shape[0])
x = scipy.linalg.lu_solve((L.T,piv),b,trans=1)

And so in case of upper-triangular matrix, Ux=b, it is:

# U = upper-triangular matrix
piv = N.arange(L.shape[0])
x = scipy.linalg.lu_solve((U,piv),b,trans=0)


P.S.: for some reasons the 'upper' case is consistently faster
than the 'lower' one...

Emanuele Olivetti wrote:
> Dear All,
> Is there a better/faster way (provided by scipy) to solve a linear system
> Lx=b (when L is lower-triangular) then the following?
> piv = N.arange(L.shape[0])
> x = scipy.linalg.lu_solve((L,piv),b)
> The linear system is trivial to solve but using 'solve' is much much slower
> and I was no t able to find something ad-hoc for triangular matrices.
> Best,
> Emanuele
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-user mailing list