Search code examples
python-3.xmatrixscipylapackblas

Functions from Scipy, Blas, or Lapack that compute only upper triangular matrix


My goal is to transform a matrix into upper triangular form in Python. I know the function scipy.linalg.lu will do LU decomposition and compute both upper and lower triangular ones. I need to repeat this procedure several times. If there are functions from Scipy, blas, or lapack that compute only upper triangular matrix, the performance of my algorithm will be improved significantly.

Could you please suggest such functions? Thank you so much!


Solution

  • If you click "source" on the scipy.linalg.lu_factor page, https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.linalg.lu_factor.html, it brings you to https://github.com/scipy/scipy/blob/v0.14.0/scipy/linalg/decomp_lu.py#L17

    which shows that the LAPACK function you're after is *getrf.