blob: 902ce414b8fbcc68bb69eeff023c54a647706fac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
//example no. 3.15
//solve system by cholesky method
A=[4 -1 0 0;-1 4 -1 0;0 -1 4 -1;0 0 -1 4]
b=[1;0;0;0]
L=cholesky (A,4) //call cholesky function to evaluate the root of the system
n=4;
Z=fore(L,b);
X=back(L',Z)
//since A=L*L' ,
// inv(A)=inv(L')*inv(L)
// let inv(A)=AI
AI=L'^-1*L^-1
|