4.33333

4.3 | 4 ratings Rate this file 24 Downloads (last 30 days) File Size: 1.65 KB File ID: #4695

Block tridiagonal solver

by Greg von Winckel

 

29 Mar 2004 (Updated 01 Apr 2004)

Solves block tridiagonal systems of equations.

| Watch this File

File Information
Description

This is an implementantion of the Gauss algorithm for block tridiagonal systems. The blocks must all be the same size. This approach requires for loops so is of value when the matrix is large. Ideal for solving 1D BVPs using finite element or spectral methods.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Fast Tridiagonal System Solver

MATLAB release MATLAB 6.0 (R12)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
15 Apr 2004 Walter Tates

Nice implementation and use of built in MATLAB functions. Worked perfect for my uses in solving 2D Laplace Equation with Finite Difference Method.

15 Nov 2005 Alfonso Bueno

In the problems I am solving, it performs 5 times slower than the standard MATLAB solver based on Gaussian elimination. Memory optimization is neither accomplished so the code crashes for systems of big dimension.

01 Dec 2005 Alfonso Bueno

I have to present my apologies for the previous post. Obviously the solver is not faster than Gaussian elimination if the 2D Laplace Equation is properly handled using sparse matrices, but if the diagonal and off diagonal blocks of the matrix are full, this solver is clearly much faster than the standard MATLAB one.

08 Dec 2007 Tim Davis

This function is now superseded by the banded solver in MATLAB. In MATLAB 7.5, x=A\b where A is block tridiagonal with k blocks of size 100-by-100 each, is about twice as fast as this function. That is:

B = ones (100,100) ;
A = sprand (kron (spdiags (ones(k,3),-1:1,k,k,), B)) ;
n=k*N ;
b=rand(n,1) ;

then compare

x = triblocksolve (A,b,N) ;

with x=A\b.

So the need for this function is no longer speed; backslash is faster and of course simpler. This function is still useful if you want to read the code to understand the algorithm, but there's no longer any need to use it in production code.

28 May 2008 Rob Moucha

I would not be so quick to dismiss this code. As Alfonso Bueno pointed out - this code is slower than mldivide for sparse matricies, but if you are storing your matrix as full rather then sparse, then the speed up over mldivide is huge.

31 Oct 2009 jave jalal

I want to use this code, where i have an N*N blocktridiagonal matrix, each entry is a an N*N tridiagonal matrix in itself. Could you please help me with how to enter the number of blocks.
syntax , nblk=rows/N;
N can be 100
please help me, how to use number of blocks in the algorithm.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
linear algebra Greg von Winckel 22 Oct 2008 07:17:12
block Greg von Winckel 22 Oct 2008 07:17:12
tridiagonal Greg von Winckel 22 Oct 2008 07:17:12
system Greg von Winckel 22 Oct 2008 07:17:12
solver Greg von Winckel 22 Oct 2008 07:17:12
mathematics Greg von Winckel 22 Oct 2008 07:17:12

Contact us at files@mathworks.com