中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > .NET > 临时文章
Matrix 计算之旅1---初等行变换
作者:未知 时间:2004-12-16 12:12 出处:Blog 责编:chinaitpower
              摘要:暂无

'初等行变换之互换两行
Public Sub Matrix_Specify_Tow_Row_Exchange(Row_A_Index As Integer, Row_B_Index As Integer, temp_matrix() As Single)
Dim i As Integer
For i = 1 To UBound(temp_matrix, 2)
    swap temp_matrix(Row_A_Index, i), temp_matrix(Row_B_Index, i)
Next i
End Sub
'初等行变换之一行自乘一个数后加至另一行上去
Public Sub Matrix_Single_Row_ShuChen_Addition_To_Other_Row(temp_matrix() As Single, Row_A_Index As Integer, Row_B_Index As Integer, k As Single)
Dim i As Integer
For i = 1 To UBound(temp_matrix, 2)
    temp_matrix(Row_B_Index, i) = temp_matrix(Row_B_Index, i) + k * temp_matrix(Row_A_Index, i)
Next i
End Sub
'初等行变换之某一行的全体自乘一个数
Public Sub Matrix_Single_Row_ShuChen(k As Single, temp_a() As Single, Row_Index As Integer)
Dim i As Integer
For i = 1 To UBound(temp_a, 2)
    temp_a(Row_Index, i) = k * temp_a(Row_Index, i)
Next i
End Sub

'最简行阶梯阵的计算。
Option Explicit
Public Function Matrix_Basic_Row_Transformation(temp_matrix() As Single)
    Dim Row_Index As Integer, col_index As Integer, Row_Num As Integer, Col_Num As Integer
    Dim i As Integer, j As Integer, Not_Zero_Row_Index As Integer
    Dim temp_chen As Single
    Dim flag As Boolean
    Row_Num = UBound(temp_matrix, 1)
    Col_Num = UBound(temp_matrix, 2)
    Row_Index = 1: col_index = 1
    Do While (Row_Index <= Row_Num And col_index <= Col_Num)
    'Do While (col_index <= Col_Num)
         
          flag = If_Specify_Col_Zero(temp_matrix, col_index, Row_Index, Not_Zero_Row_Index)
          If (flag = False) Then
                'FormTest.Print "did it!"
                'If col_index = 2 And Row_Index = 2 Then output_matrix temp_matrix
                If (Not_Zero_Row_Index <> Row_Index) Then
                       Matrix_Specify_Tow_Row_Exchange Row_Index, Not_Zero_Row_Index, temp_matrix
                End If
               
                'FormTest.List1.AddItem Row_Index
                'FormTest.List2.AddItem col_index
                For i = 1 To Row_Num
                        If (i <> Row_Index) Then
                              Matrix_Single_Row_ShuChen_Addition_To_Other_Row temp_matrix, Row_Index, i, -temp_matrix(i, col_index) / temp_matrix(Row_Index, col_index)
                        End If
                        'If Row_Index = 2 Then FormTest.List1.AddItem temp_matrix(i, Col_Num)
                Next i
               
                Matrix_Single_Row_ShuChen 1 / temp_matrix(Row_Index, col_index), temp_matrix, Row_Index
               
                Row_Index = Row_Index + 1
                col_index = col_index + 1
          Else
                'FormTest.Print col_index, Row_Index
                col_index = col_index + 1
          End If
    Loop
End Function

 

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有