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 get both upper and lower triangular ones. I need to repeat this procedure several times. If there is 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!

• Do I understand you correctly: you want to get only $U$ from $A=LU$ factorization, while $L$ is discarded? – Anton Menshov Jun 7 at 1:09
• Hi @AntonMenshov, for a matrix A, I can get both U, L by U, L = scipy.linalg.lu(A)[1: 3]. I can get U by U = scipy.linalg.lu(A)[2]. Even I use the latter, i.e. U = scipy.linalg.lu(A)[2], the function scipy.linalg.lu still computes L, which is unnecessary for me and takes more time. I meant to looking for a function that only computes U. – LAD Jun 7 at 6:55

For instance, if you think about textbook Gaussian elimination, the entry $$L_{ij}$$ is the multiplier $$L_{ij} = A_{ij}/A_{jj}$$ that you use to eliminate the zero entry in position $$i,j$$ at step $$j$$.