标签:
1.数学定义
1) 在一个n阶行列式D中,把元素aij (i,j=1,2,.....n)所在的行与列划去后,剩下的(n-1)^2个元素按照原来的次序组成的一个n-1阶行列式Mij,称为元素aij的余子式,Mij带上符号(-1)^(i+j)称为aij的代数余子式,记作Aij=(-1)^(i+j) Mij.
2.算法实现
1)代数余子式
‘‘‘ <summary> ‘‘‘ 返回一个矩阵的行列式的第i行j列元素的代数余子式 ‘‘‘ </summary> ‘‘‘ <param name="aMatrix">原矩阵</param> ‘‘‘ <param name="aI">元素的行索引,从1开始</param> ‘‘‘ <param name="aJ">元素的列索引,从1开始</param> ‘‘‘ <returns></returns> ‘‘‘ <remarks></remarks> Public Shared Function AlgebraicCofactor(ByVal aMatrix As Matrix, ByVal aI As Integer, ByVal aJ As Integer) As Double Dim tempRank As Integer = aMatrix.RowLength Dim tempDet As New Determinant(tempRank - 1) For i = 1 To tempRank For j = 1 To tempRank If Not i = aI AndAlso Not j = aJ Then tempDet.Item(i - IIf(i > aI, 1, 0), j - IIf(j > aJ, 1, 0)) = aMatrix.Item(i, j) End If Next Next Return Math.Pow(-1, aI + aJ) * tempDet.value ‘返回代数余子式 End Function
2)伴随矩阵
‘伴随矩阵 ‘‘‘ <summary> ‘‘‘ 返回一个矩阵的伴随矩阵 ‘‘‘ </summary> ‘‘‘ <param name="amatrix">原矩阵</param> ‘‘‘ <returns></returns> ‘‘‘ <remarks></remarks> Public Shared Function AdjointMatrix(ByVal amatrix As Matrix) As Matrix Dim TempMatrix As New Matrix(amatrix.RowLength, amatrix.ColLength) For i = 1 To amatrix.RowLength For j = 1 To amatrix.ColLength TempMatrix.Item(j, i) = Matrix.AlgebraicCofactor(amatrix, i, j) Next Next Return (TempMatrix) End Function
标签:
原文地址:http://www.cnblogs.com/experdot/p/4661642.html