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

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

% 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