谁能介绍一下,全主元高斯—约当消去法求逆矩阵的理论(不需要代码)?

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/22 15:07:46
谁能介绍一下,全主元高斯—约当消去法求逆矩阵的理论(不需要代码)?谁能介绍一下,全主元高斯—约当消去法求逆矩阵的理论(不需要代码)?谁能介绍一下,全主元高斯—约当消去法求逆矩阵的理论(不需要代码)?下

谁能介绍一下,全主元高斯—约当消去法求逆矩阵的理论(不需要代码)?
谁能介绍一下,全主元高斯—约当消去法求逆矩阵的理论(不需要代码)?

谁能介绍一下,全主元高斯—约当消去法求逆矩阵的理论(不需要代码)?
下面是:实矩阵求逆的全选主元高斯-约当法
'
Public Function Gauss_AX(ByRef A() As Double,ByVal N As Long,ByRef B() As Double) As Boolean
Dim IA(),IR(),IC()
Dim iRow As Long,iCol As Long
Dim lMax As Single
Dim I,J,K,L,LL,lTemp,pIV
ReDim IA(1 To N)
ReDim IR(1 To N)
ReDim IC(1 To N)
Gauss_AX = True
For J = 1 To N
IA(J) = 0
Next
For I = 1 To N
lMax = 0#
For J = 1 To N
If IA(J) 1 Then
For K = 1 To N
If IA(K) = 0 Then
If Abs(A(J,K)) > = lMax Then
lMax = Abs(A(J,K))
iRow = J
iCol = K
End If
ElseIf IA(K) > 1 Then
Gauss_AX = False '计算失败
Exit Function
End If
Next
End If
Next
IA(iCol) = IA(iCol) + 1
If iRow iCol Then
For L = 1 To N
lTemp = A(iRow,L)
A(iRow,L) = A(iCol,L)
A(iCol,L) = lTemp
Next
lTemp = B(iRow)
B(iRow) = B(iCol)
B(iCol) = lTemp
End If
IR(I) = iRow
IC(I) = iCol
If A(iCol,iCol) = 0 Then
Gauss_AX = False '计算失败
Exit Function
End If
pIV = 1# / A(iCol,iCol)
A(iCol,iCol) = 1#
For L = 1 To N
A(iCol,L) = A(iCol,L) * pIV
Next
B(iCol) = B(iCol) * pIV
For LL = 1 To N
If LL iCol Then
lTemp = A(LL,iCol)
A(LL,iCol) = 0#
For L = 1 To N
A(LL,L) = A(LL,L) - A(iCol,L) * lTemp
Next
B(LL) = B(LL) - B(iCol) * lTemp
End If
Next
For L = N To 1 Step -1
If IR(L) IC(L) Then
For K = 1 To N
lTemp = A(K,IR(L))
A(K,IR(L)) = A(K,IC(L))
A(K,IC(L)) = lTemp
Next
End If
Next
Next
Erase IA,IR,IC
End Function