Tridiagonal Matrix Algoritm impelementation.