| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 753 人关注过本帖
标题:帮忙看一下这两函数是做什么的
只看楼主 加入收藏
zhuor508
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-9-16
收藏
 问题点数:0 回复次数:1 
帮忙看一下这两函数是做什么的
好象是矩阵变换,但看不太懂,高手可否解释一下。最好能举例说明。多谢!
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
搜索更多相关主题的帖子: 函数 
2009-09-16 17:31
zhuor508
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-9-16
收藏
得分:0 
高手帮忙呀!自己顶!
2009-09-21 16:22
快速回复:帮忙看一下这两函数是做什么的
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019231 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved