Code covered by the BSD License  

Highlights from
Fast Tridiagonal System Solver

4.27273

4.3 | 11 ratings Rate this file 75 Downloads (last 30 days) File Size: 2.04 KB File ID: #1359

Fast Tridiagonal System Solver

by Frederico D'Almeida

 

18 Feb 2002

A fast tridiagonal system solver.

| Watch this File

File Information
Description

Solves a tridiagonal system quickly.

Acknowledgements
This submission has inspired the following:
Fast Pentadiagonal System Solver, Block tridiagonal solver
MATLAB release MATLAB 5.2 (R10)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (13)
04 Jun 2003 abhijith bharadwaj

this programme was very good,super,extraordinary

19 Feb 2004 Venkata Pradeep Indrakanti

This code works faster than others using the sparse matrix functions of MATLAB.Although the gain in speed might not be evident for small computations, for the bigger ones, it might save (valuable) time.

28 Apr 2006 Garner Izru

Excellent! I was looking for a routine like this, thanks Frederico!

18 Nov 2006 Bill Armstrong

The hidden photos were very tastefully done...

30 Nov 2006 sarava shanmuga  
28 Apr 2007 sebastian swose

The solving of a linear system with calculating the inverse matrix is faster!!??
I dodnt know why

03 May 2007 Edgar Guevara Codina

Very fast, it helped me improve the algorithm of a FD-BPM simulation

04 May 2007 Jorge Puebla

I received a recommendation about this file, is an excelent tool

17 Nov 2007 Alex Prideaux

Using Matlab 7.4 and sparse matrices, this code is unfortunately at least 10 times slower than the standard Matlab backslash.

08 Dec 2007 Tim Davis

This function is superseded by the tridiagonal solver that is now built into MATLAB (x=A\b). For x=thomas(A,b) where A is sparse and tridiagonal, x=A\b is up to 25,000 times (!) faster than this code. For x=thomas(amain,aup,alo,b), this function is about 30 times slower than x=A\b.

So the only reason for this code is to illustrate the algorithm - for which its still useful. But don't expect to get great performance from it compared to x=A\b in MATLAB 7.5

04 Mar 2009 Hongjun Zhang

Excellent algorithm. I tested it on 2000x2000 matrix, it's 10 times faster than back slash and 5 times faster than inv(), on 2.0G Intel Duo Core, 1G ram, on Matlab 8a. (1.2 seconds for thomas, 6.5 s for inv(), and 13.5 for /).

For small matrix, say 100x100, these three are comparable.

I though Tim was right and trusted back slash. But it's not the case for me.

I don't know what kind of sparse matrices Tim and Alex talking about that back slash runs faster for. I would say the 3-diagonal is already sparse and is encounter often in solving pdes.

23 Mar 2009 Vinesh Rajpaul

Great script. Easy to use and works very well.

08 Dec 2009 Xiang

My test result is the same as Tim's and Alex's. My A matrix is only 20*20 and is strictly diagonally dominant tridiagonal.
It took "thomas(A,B)" 62.7 seconds to complete 4000 time-steps, while "A\B" used only 4.5 seconds.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
approximation Frederico D'Almeida 22 Oct 2008 06:42:17
interpolation Frederico D'Almeida 22 Oct 2008 06:42:17
tridiagonal Frederico D'Almeida 22 Oct 2008 06:42:17
linear Frederico D'Almeida 22 Oct 2008 06:42:17
system Frederico D'Almeida 22 Oct 2008 06:42:17
differential equation Frederico D'Almeida 22 Oct 2008 06:42:17
solver Frederico D'Almeida 22 Oct 2008 06:42:17
thomas Emil N 09 Dec 2009 16:13:28
thomas Taylor 03 Mar 2010 15:17:11
solver Curly naila 28 Dec 2010 13:37:34

Contact us at files@mathworks.com