Decomposition tensor to lower triangular part and strictly upper triangular part

Now, I have a matrix A, whose size is N * N. Now, I want to decomposition A to A = L+T, where L is the lower triangular part of A and T is the strictly upper triangular part of A. How can I do this?

So you are looking to do LU decomposition, right? You can do that with two cholesky factorizations (see


Cholesky pytorch function:

potrf docs: