forked from sed12008/ME3255S2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from rcc02007/master
update 2/25/17
- Loading branch information
Showing
17 changed files
with
2,676 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function [L, U] = LU_naive(A) | ||
% GaussNaive: naive Gauss elimination | ||
% x = GaussNaive(A,b): Gauss elimination without pivoting. | ||
% input: | ||
% A = coefficient matrix | ||
% y = right hand side vector | ||
% output: | ||
% x = solution vector | ||
[m,n] = size(A); | ||
if m~=n, error('Matrix A must be square'); end | ||
nb = n; | ||
L=diag(ones(n,1)); | ||
U=A; | ||
% forward elimination | ||
for k = 1:n-1 | ||
for i = k+1:n | ||
fik = U(i,k)/U(k,k); | ||
L(i,k)=fik; | ||
U(i,k:nb) = U(i,k:nb)-fik*U(k,k:nb); | ||
end | ||
end | ||
%% back substitution | ||
%x = zeros(n,1); | ||
%x(n) = Aug(n,nb)/Aug(n,n); | ||
%for i = n-1:-1:1 | ||
% x(i) = (Aug(i,nb)-Aug(i,i+1:n)*x(i+1:n))/Aug(i,i); | ||
%end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
function [L,U,P] = LU_pivot(A) | ||
% GaussPivot: Gauss elimination pivoting | ||
% x = GaussPivot(A,b): Gauss elimination with pivoting. | ||
% input: | ||
% A = coefficient matrix | ||
% b = right hand side vector | ||
% output: | ||
% x = solution vector | ||
[m,n]=size(A); | ||
if m~=n, error('Matrix A must be square'); end | ||
nb = n; | ||
L=diag(ones(n,1)); | ||
U=A; | ||
P=diag(ones(n,1)); | ||
% forward elimination | ||
for k = 1:n-1 | ||
% partial pivoting | ||
[big,i]=max(abs(U(k:n,k))); | ||
ipr=i+k-1; | ||
if ipr~=k | ||
P([k,ipr],:)=P([ipr,k],:); % if the max is not the current index ipr, pivot count | ||
%L([k,ipr],:)=L([ipr,k],:); | ||
%U([k,ipr],:)=U([ipr,k],:); | ||
end | ||
for i = k+1:n | ||
fik=U(i,k)/U(k,k); | ||
L(i,k)=fik; | ||
U(i,k:nb)=U(i,k:nb)-fik*U(k,k:nb); | ||
end | ||
end | ||
% back substitution | ||
%x=zeros(n,1); | ||
%x(n)=Aug(n,nb)/Aug(n,n); | ||
%for i = n-1:-1:1 | ||
% x(i)=(Aug(i,nb)-Aug(i,i+1:n)*x(i+1:n))/Aug(i,i); | ||
%end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
\relax | ||
\providecommand\hyper@newdestlabel[2]{} | ||
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} | ||
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined | ||
\global\let\oldcontentsline\contentsline | ||
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} | ||
\global\let\oldnewlabel\newlabel | ||
\gdef\newlabel#1#2{\newlabelxx{#1}#2} | ||
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} | ||
\AtEndDocument{\ifx\hyper@anchor\@undefined | ||
\let\contentsline\oldcontentsline | ||
\let\newlabel\oldnewlabel | ||
\fi} | ||
\fi} | ||
\global\let\hyper@last\relax | ||
\gdef\HyperFirstAtBeginDocument#1{#1} | ||
\providecommand\HyField@AuxAddToFields[1]{} | ||
\providecommand\HyField@AuxAddToCoFields[2]{} | ||
\providecommand \oddpage@label [2]{} | ||
\@writefile{toc}{\contentsline {section}{\numberline {1}LU Decomposition}{1}{section.1}} | ||
\newlabel{lu-decomposition}{{1}{1}{LU Decomposition}{section.1}{}} | ||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.0.1}efficient storage of matrices for solutions}{1}{subsubsection.1.0.1}} | ||
\newlabel{efficient-storage-of-matrices-for-solutions}{{1.0.1}{1}{efficient storage of matrices for solutions}{subsubsection.1.0.1}{}} | ||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Pivoting for LU factorization}{2}{subsection.1.1}} | ||
\newlabel{pivoting-for-lu-factorization}{{1.1}{2}{Pivoting for LU factorization}{subsection.1.1}{}} | ||
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Springs-masses\relax }}{5}{figure.caption.1}} | ||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Cholesky Factorization}{6}{subsection.1.2}} | ||
\newlabel{cholesky-factorization}{{1.2}{6}{Cholesky Factorization}{subsection.1.2}{}} |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
This is BibTeX, Version 0.99d (TeX Live 2015/Debian) | ||
Capacity: max_strings=35307, hash_size=35307, hash_prime=30011 | ||
The top-level auxiliary file: lecture_11.aux | ||
I found no \citation commands---while reading file lecture_11.aux | ||
I found no \bibdata command---while reading file lecture_11.aux | ||
I found no \bibstyle command---while reading file lecture_11.aux | ||
You've used 0 entries, | ||
0 wiz_defined-function locations, | ||
83 strings with 494 characters, | ||
and the built_in function-call counts, 0 in all, are: | ||
= -- 0 | ||
> -- 0 | ||
< -- 0 | ||
+ -- 0 | ||
- -- 0 | ||
* -- 0 | ||
:= -- 0 | ||
add.period$ -- 0 | ||
call.type$ -- 0 | ||
change.case$ -- 0 | ||
chr.to.int$ -- 0 | ||
cite$ -- 0 | ||
duplicate$ -- 0 | ||
empty$ -- 0 | ||
format.name$ -- 0 | ||
if$ -- 0 | ||
int.to.chr$ -- 0 | ||
int.to.str$ -- 0 | ||
missing$ -- 0 | ||
newline$ -- 0 | ||
num.names$ -- 0 | ||
pop$ -- 0 | ||
preamble$ -- 0 | ||
purify$ -- 0 | ||
quote$ -- 0 | ||
skip$ -- 0 | ||
stack$ -- 0 | ||
substring$ -- 0 | ||
swap$ -- 0 | ||
text.length$ -- 0 | ||
text.prefix$ -- 0 | ||
top$ -- 0 | ||
type$ -- 0 | ||
warning$ -- 0 | ||
while$ -- 0 | ||
width$ -- 0 | ||
write$ -- 0 | ||
(There were 3 error messages) |
Oops, something went wrong.