[SciPy-Dev] Use *trsm for scipy.linalg.solve_triangular?

Sturla Molden sturla.molden at gmail.com
Sat Jun 28 05:10:38 EDT 2014


scipy.linalg.solve_triangular uses *trtrs from LAPACK. I must take a great
deal of the responsibility for this, since I might have suggested it... In
retrospect I think this was a mistake.

*trtrs can solve op(A) X = B where op(A) is A or A.T

*trsm from BLAS is more general. It can solve op(A) X = alpha * B or X
op(A) = alpha * B. The latter might e.g. be useful for constructing an
efficient scipy.linalg.solve for C ordered arrays. 

*trtrs is just a shallow wrapper over *trsm. It optionally checks A for
singularity and then calls *trsm. The optional singularity check just
amounts to checking that none of the diagonal elements are zero. 

I think we should make scipy.linalg.blas expose *trsm and then use that
method for solve_triangular. Later we can use *trsm to optimize
scipy.linalg.solve for C ordered arrays (i.e. avoid generating transposed
copies).

Regards,
Sturla




More information about the SciPy-Dev mailing list