Block Pentadiagonal Solver

version 1.0.2 (1.77 KB) by Lateef Adewale Kareem
Solves the block pentadiagonal system Ax = f, where a, b, c, d, and e are the five diagonals of A

10 Downloads

Updated Sat, 28 May 2022 06:40:47 +0000

View License

% BlockPentSolve.m
%
% Solves the block pentadiagonal system Ax = f, where a, b, c, d, and e are
% the five diagonals of A. if the size of the block is n-by-n, then c is M-by-n,
% b and d are each (M-n)-by-n, while a and e are each (M - 2n)-by-n, f is
% M-by-X, M is divisible by n, n >= 1.
%
% M = 12; n = 3;
% a = rand((M-2)*n, n); b = rand((M-1)*n, n); c = 5+rand(M*n, n);
% d = rand((M-1)*n, n); e = rand((M-2)*n, n); f = rand(M*n,10);
% x = BlockPentSolve(a, b, c, d, e, f);
%
% We can make block matrix A = BlockDiag(a, n, n, -2) +
% BlockDiag(b, n, n, -1) + BlockDiag(c, n, n) + BlockDiag(d, n, n, 1) +
% BlockDiag(e, n, n, 2); and then x = A\d to confirm the solution.
%
% Computational Cost of this method is 2M(5n^3+4n^2-n/3). The cost is
% of order M*n^3. This is better than the backslash which is order (M*n)^3
%
% For M = 500, n = 4; This function is faster than inbuilt backslash by
% factor of 2.5
%
% Written by: Lateef Adewale Kareem 05/25/2022
% Contact: talk2laton@yahoo.co.uk

Cite As

Lateef Adewale Kareem (2022). Block Pentadiagonal Solver (https://www.mathworks.com/matlabcentral/fileexchange/112335-block-pentadiagonal-solver), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!