相关代码 |
|
procedure CHODCM(A:matrx2; N:integer;var D:array of real; T:array of real); var I,J,K:integer; SUM:real; begin For I:=1 To N do begin Sum:=A[I, I]; For J:=1 To I - 1 do begin T[J]:=A[J, I]; For K:=1 To J - 1 do T[J]:=T[J] - T[K] * A[J, K]; If D[J] = 0 Then begin If T[J] 0 Then ShowMessage('No Cholesky decomposition') Else A[I, J]:=1; end Else A[I, J]:=T[J] / D[J]; Sum:=Sum - T[J] * A[I, J]; end; D[I]:=Sum; end; end;