Derive special Gauss-elimination strategy to transfer the resulting penta-diagonal system into an upper semi-penta system
The following algorithm was designed and developed to handle a general banded \(A\) matrix to solve the problem of solving \(A x=b\).
This algorithm works on Matrices which contain only one band of speciﬁc width such as those found in tri-diagonal and penta-diagonal matrices.
The main idea of the algorithm is to locate submatrices within the main matrix \(A\), so as to process those by applying the standard Gaussian elimination algorithm on them.
The algorithm locates these submatrices which are bounded below and to the right by the ﬁrst zero entry. Starting at ﬁrst pivot in \(A(1,1)\), looking down and locating the ﬁrst zero entry to determine the lower bound, and then looking right from that location to locate the ﬁrst zero entry. This determines the boundaries of the submatrix.
This process is repeated by shifting one row down and one column to the right, and each time a new submatrix boundaries are located as described above, and Gaussian elimination is called to process this new lower submatrix.
Hence we travel down the main matrix from the top left corner to the bottom right corner, processing small submatrices along the way. The \(b\) vector is updated all the time. Hence in each step, we create a new separate \(A x=b\) with its own \(A\) and \(b\) variables extracted from the original \(A\) and original \(b\) variables.
Notice that no data copying is involved, and the data is processed in-place.
The advantage of this algorithm is that it will work on any central banded Matrix \(A\), tri-diagonal, penta-diagonal and larger bands.
The algorithm is illustrated in the following diagram
Derive special backward-substitution algorithm to solve the resulting upper semi-penta diagonal matrix.
The resulting \(U\) matrix from part(1) above is a banded matrix. Hence a special backward substitution algorithm was devised to take advantage of the sparseness of this \(U\) matrix.
Only the non-zero entries in each row are used to solve for \(x\) during the process of back substitution.
This is in comparison with the standard back substitution routine written for solving general \(A x=b\), which processed all entries in the upper triangular matrix regardless if the entries contain zero or not.
The following diagram illustrates the algorithm
Elimination process: each submatrix is of size \(3 \times 5\). There are \(n-1\) such submatrices.
Each submatrix requires 2 divisions (for the multipliers), and 6 multiplications. (3 per row, we have 2 rows). Hence each submatrix requires 8 ops. Hence the total is \(10(n-1)\)
For the special backsub: each \(x\) requires 2 multiplications and one division, and there are \((n-1)\) rows to process. Also there is the ﬁrst division for the \(x(n)\).
Hence the total is \(2(n-1)+1\).
Adding the elimination process with the backsub, we obtain \[ 8(n-1)+2(n-1)+1 = 10(n-1) + 1 \]
The ﬁle nma_pentaSolve.m is Main driver. Called to solve \(A x=b\) when \(A\) is penta-banded. Locates matrices within the main matrix A and calls nma_gaussian_elimination on each problem.
The ﬁle nma_backSub.m is special back substitution for special banded U matrices
The ﬁle nma_gaussian_elemination.m is Gaussian elimination routine
The ﬁle nma_penta_test.m is script that calls nma_pentaSolve repeatedly with diﬀerent \(A,b\) and compares the results with Matlab’s "\" solver to check for correctness.
Appendix has source code listing.
A Matlab script was written which tested the above implementation using diﬀerent \(A,b\) input. Each test was veriﬁed against Matlab "\" solver. The following is the output of the test.