Skip to content

Commit 36007e9

Browse files
committed
updated function header
1 parent c9abd4b commit 36007e9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tridiagonal.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
%==========================================================================
22
%
3-
% tridiagonal Solves the tridiagonal linear system Ax=d for x using the
3+
% tridiagonal Solves the tridiagonal linear system Ax = d for x using the
44
% tridiagonal matrix algorithm (i.e. the Thomas algorithm).
55
%
66
% x = tridiagonal(A,d)
77
%
88
% Copyright © 2021 Tamas Kis
9-
% Last Update: 2022-04-16
9+
% Last Update: 2022-10-11
1010
% Website: https://tamaskis.github.io
1111
1212
%
1313
% TECHNICAL DOCUMENTATION:
14-
% https://tamaskis.github.io/documentation/Tridiagonal_Matrix_Algorithm__Thomas_Algorithm_.pdf
14+
% https://tamaskis.github.io/files/Tridiagonal_Matrix_Algorithm__Thomas_Algorithm_.pdf
1515
%
1616
%--------------------------------------------------------------------------
1717
%
@@ -24,11 +24,11 @@
2424
% -------
2525
% OUTPUT:
2626
% -------
27-
% x - (n×1 double) solution of the tridiagonal linear system Ax=d
27+
% x - (n×1 double) solution of the tridiagonal linear system Ax = d
2828
%
2929
%==========================================================================
3030
function x = tridiagonal(A,d)
31-
31+
3232
% determines n
3333
n = length(d);
3434

@@ -40,20 +40,20 @@
4040

4141
% extracts first element of "b" from "A"
4242
b(1) = A(1,1);
43-
43+
4444
% forward loop
4545
for i = 2:n
46-
46+
4747
% extract relevant elements of "a", "b", and "c" from "A"
4848
a(i-1) = A(i,i-1);
4949
b(i) = A(i,i);
5050
c(i-1) = A(i-1,i);
51-
51+
5252
% forward elimination
5353
w = a(i-1)/b(i-1);
5454
b(i) = b(i)-w*c(i-1);
5555
d(i) = d(i)-w*d(i-1);
56-
56+
5757
end
5858

5959
% backward loop (backward substitution)

0 commit comments

Comments
 (0)