VB.Net行列计算函数

前端之家收集整理的这篇文章主要介绍了VB.Net行列计算函数前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Function Rect(A As Array,L As Integer) As Single '行列式计算L*L
        Dim T0 As Single
        Dim T1 As Single
        Dim T2 As Single
        Dim B(0,0) As Single
        Dim Num As Single
        Dim Cha As Integer
        If L > 0 Then
            Cha = 0
            ReDim B(L - 1,L - 1)
            Num = 0
            If L = 1 Then
                Rect = A(0,0) * A(1,1) - A(0,1) * A(1,0)
                Exit Function
            End If
            For T0 = 0 To L
                For T1 = 1 To L
                    For T2 = 0 To L - 1
                        If T2 = T0 Then Cha = 1
                        B(T1 - 1,T2) = A(T1,T2 + Cha)
                    Next T2
                    Cha = 0
                Next T1
                Num = Num + A(0,T0) * Rect(B,L - 1) * (-1) ^ T0
            Next T0
            Rect = Num
        ElseIf L = 0 Then
            Rect = A(0,0)
        End If
    End Function
原文链接:https://www.f2er.com/vb/257071.html

猜你在找的VB相关文章