% 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
引用格式
Lateef Adewale Kareem (2024). Block Pentadiagonal Solver (https://www.mathworks.com/matlabcentral/fileexchange/112335-block-pentadiagonal-solver), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2022a
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!