相关代码 |
|
procedure TRIDAG(A, B, C, R:array of real;var U:array of real; N:integer); var GAM:array[0..100] of real; J:integer; BET:real; begin If B[1] = 0 Then Exit; BET:=B[1]; U[1]:=R[1] / BET; For J:=2 To N do begin GAM[J]:=C[J - 1] / BET; BET:=B[J] - A[J] * GAM[J]; If BET = 0 Then Exit; U[J]:=(R[J] - A[J] * U[J - 1]) / BET; end; For J:=N - 1 DownTo 1 do U[J]:=U[J] - GAM[J + 1] * U[J + 1]; end;
相关资源 |
|