Created
December 7, 2015 22:39
-
-
Save kersulis/2f333a319388e3fe67e7 to your computer and use it in GitHub Desktop.
Naive LU decomposition.
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
""" | |
Naive LU decomposition (no pivoting) from | |
[Bindel's CS6210 class notes](http://www.cs.cornell.edu/~bindel/class/cs6210-f12/notes/lec09.pdf). | |
Beware A[1,1] = 0... | |
""" | |
function mylu(A) | |
m,n = size(A) | |
for j = 1:n-1 | |
A[j+1:n,j] = A[j+1:n,j]/A[j,j] | |
A[j+1:n,j+1:n] = A[j+1:n,j+1:n] - A[j+1:n,j]*A[j,j+1:n] | |
end | |
return A | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment