帮忙看一下这两函数是做什么的
好象是矩阵变换,但看不太懂,高手可否解释一下。最好能举例说明。多谢!Friend Module MathLuDecomp
Public Sub LuBksb(ByVal A(,) As Double, ByVal Indx() As Long, ByVal B() As Double)
Dim N As Integer = A.GetUpperBound(0)
Dim II As Integer = 0
For I As Integer = 0 To N
Dim Ip As Long = Indx(I)
Dim Sum As Double = B(Ip)
B(Ip) = B(I)
If II >= 0 Then
For J As Integer = II To I - 1
Sum -= A(I, J) * B(J)
Next J
ElseIf Sum <> 0.0# Then
II = I
End If
B(I) = Sum
Next I
For I As Integer = N To 0 Step -1
Dim Sum As Double = B(I)
For J As Integer = I + 1 To N
Sum -= A(I, J) * B(J)
Next J
B(I) = Sum / A(I, I)
Next I
End Sub
Public Sub LuDcmp(ByVal A(,) As Double, ByRef Indx() As Long, ByRef D As Double)
Const TINY As Double = 1.0E-20#
Dim N As Integer = A.GetUpperBound(0)
Dim VV(N) As Double
ReDim Indx(N)
D = 1.0#
For I As Integer = 0 To N
Dim Big As Double = 0.0#
For J As Integer = 0 To N
Dim Temp As Double = Abs(A(I, J))
If Temp > Big Then Big = Temp
Next J
If Big = 0.0# Then Throw New System.ArithmeticException("Singular Matrix in LuDcmp")
VV(I) = 1.0# / Big
Next I
For J As Integer = 0 To N
Dim IMAX As Integer
For I As Integer = 0 To J - 1
Dim Sum As Double = A(I, J)
For K As Integer = 0 To I - 1
Sum -= A(I, K) * A(K, J)
Next K
A(I, J) = Sum
Next I
Dim Big As Double = 0.0#
For I As Integer = J To N
Dim Sum As Double = A(I, J)
For K As Integer = 0 To J - 1
Sum -= A(I, K) * A(K, J)
Next K
A(I, J) = Sum
Dim Dum As Double = VV(I) * Abs(Sum)
If Dum >= Big Then
Big = Dum
IMAX = I
End If
Next I
If J <> IMAX Then
For K As Integer = 0 To N
Dim Dum As Double = A(IMAX, K)
A(IMAX, K) = A(J, K)
A(J, K) = Dum
Next K
D = -D
VV(IMAX) = VV(J)
End If
Indx(J) = IMAX
If A(J, J) = 0.0# Then A(J, J) = TINY
If J <> N Then
Dim Dum As Double = 1.0# / A(J, J)
For I As Integer = J + 1 To N
A(I, J) *= Dum
Next I
End If
Next J
End Sub