Linalg for tridiagonal/Banded matrix

Hi guys

I was wondering if there is a way to efficiently to do matrix factorizations/solve linear systems of equations on sparse matrices that have a special banded structure, such as tridiagonality.

In scipy there are a bunch of functions like solve_triangular, solve_banded, eig_banded and cholesky_banded but I couldn’t find anything for pytorch and am unforntunately not expert enough to implement that myself.

Any pointer would be highly appreciated

Cheers
Jonas

3 Likes

I think it can be realized by using torch.triu()

Supposed that we want a tridiagonal matrix:

A= torch.ones([5,5]),
A=torch.triu(A,-1)
Target=A*A.t()