Foxtable(狐表)用户栏目专家坐堂 → [求助]如何做矩阵计算


  共有3529人关注过本帖树形打印复制链接

主题:[求助]如何做矩阵计算

帅哥哟,离线,有人找我吗?
jaegea
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:480 积分:3838 威望:0 精华:0 注册:2011/5/31 15:45:00
  发帖心情 Post By:2016/7/29 11:20:00 [显示全部帖子]

矩阵定义
Dim Jm,Tm,Zm As New List(Of List(Of Integer))
Dim J0,T0 As List(Of Integer)
Dim sz() As Integer
sz = New Integer() { 3,1,2,3,4,0,0,0 }:J0 = New List(Of Integer):J0.AddRange(sz):Jm.Add(J0)
sz = New Integer() { 1,4,2,3,0,0,0,0 }:J0 = New List(Of Integer):J0.AddRange(sz):Jm.Add(J0)
sz = New Integer() { 3,4,1,2,1,0,0,0 }:J0 = New List(Of Integer):J0.AddRange(sz):Jm.Add(J0)
sz = New Integer() { 2,3,4,1,4,3,0,0 }:J0 = New List(Of Integer):J0.AddRange(sz):Jm.Add(J0)
sz = New Integer() { 4,2,3,4,1,3,4,0 }:J0 = New List(Of Integer):J0.AddRange(sz):Jm.Add(J0)
sz = New Integer() { 1,2,1,3,4,1,3,1 }:J0 = New List(Of Integer):J0.AddRange(sz):Jm.Add(J0)
sz = New Integer() { 8,2,4,24,6,0,0,0  }:T0 = New List(Of Integer):T0.AddRange(sz):Tm.Add(T0)
sz = New Integer() { 4,5,3,4,0,0,0,0   }:T0 = New List(Of Integer):T0.AddRange(sz):Tm.Add(T0)
sz = New Integer() { 3,7,15,20,8,0,0,0 }:T0 = New List(Of Integer):T0.AddRange(sz):Tm.Add(T0)
sz = New Integer() { 7,6,21,1,16,3,0,0 }:T0 = New List(Of Integer):T0.AddRange(sz):Tm.Add(T0)
sz = New Integer() { 10,4,8,4,12,6,1,0 }:T0 = New List(Of Integer):T0.AddRange(sz):Tm.Add(T0)
sz = New Integer() { 1,4,7,3,5,2,5,8   }:T0 = New List(Of Integer):T0.AddRange(sz):Tm.Add(T0)
矩阵运算
For x As Integer = 0 To Jm.Count - 1
    Dim Z0 As List(Of Integer)
    For y As Integer = 0 To Jm(x).Count - 1
        Z0.Add(Jm(x)(y)*Tm(x)(y))
    Next
    Zm.Add(Z0)
Next

[此贴子已经被作者于2016/7/29 11:21:24编辑过]

 回到顶部