summaryrefslogtreecommitdiff
path: root/50/DEPENDENCIES/cholesky.sce
diff options
context:
space:
mode:
Diffstat (limited to '50/DEPENDENCIES/cholesky.sce')
-rwxr-xr-x50/DEPENDENCIES/cholesky.sce16
1 files changed, 16 insertions, 0 deletions
diff --git a/50/DEPENDENCIES/cholesky.sce b/50/DEPENDENCIES/cholesky.sce
new file mode 100755
index 000000000..b3911d495
--- /dev/null
+++ b/50/DEPENDENCIES/cholesky.sce
@@ -0,0 +1,16 @@
+function L=cholesky (A,n)
+ L=zeros(n,n);
+ for k=1:1:n
+ S=0;
+ P=0;
+ for j=1:1:k-1
+ S=S+(L(k,j)^2);
+ P=P+L(i,j)*L(k,j)
+ end
+ L(k,k)=sqrt(A(k,k)-S);
+ for i=k+1:1:n
+ L(i,k)=(A(i,k)-P)/L(k,k);
+ end
+ end
+
+endfunction \ No newline at end of file