Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
linear_algebra/lu_tridiag.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
15 lines (11 sloc)
388 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [ udiag,uoff,loff ] = lu_tridiag(e, f, g) | |
%lu_tridag Calculates LU-decomposition of a tridiagonal matrix. | |
% Calculates the off diagonal matrices of the lower and upper matrix of | |
% the LU factorizatin. | |
udiag(1) = f(1); | |
for k = 2:size(f) | |
loff(k, 1) = e(k-1)/udiag(k-1,1); | |
udiag(k, 1) = f(k)-loff(k,1)*g(k-1); | |
end | |
uoff = [g;0]; | |
end |