列表框中的矩阵乘法 [英] Matrix Multiplication in Listbox

查看:101
本文介绍了列表框中的矩阵乘法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,我试图为我的考试制作一个矩阵乘法应用程序,但我不明白它为什么不起作用,这是真的.

请你帮我一下吗?

多数民众赞成在我的项目
http://hotfile.com/dl/21069629/455bf5e/question.rar.html

在列表框中产生数字

Hi dears, im trying to make a matrix multiplication application for my exam but i can''t understand if it true why it doesn''t work.

May you help me,please?

Thats my project
http://hotfile.com/dl/21069629/455bf5e/question.rar.html

Produce numbers in listbox

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Randomize()
        '' matris 1 için rastgele sayı üretme - random
        For i = 0 To 3
            For x = 0 To 3
                If i = 0 Then
                    matris1(i, x) = 1 + Rnd() * 4
                    ListBox1.Items.Add(matris1(i, x))
                End If
                If i = 1 Then
                    matris1(i, x) = 1 + Rnd() * 4
                    ListBox2.Items.Add(matris1(i, x))
                End If
                If i = 2 Then
                    matris1(i, x) = 1 + Rnd() * 4
                    ListBox3.Items.Add(matris1(i, x))
                End If
                If i = 3 Then
                    matris1(i, x) = 1 + Rnd() * 4
                    ListBox4.Items.Add(matris1(i, x))
                End If
            Next
        Next
        ''matris 2 için rastgele sayı üretme - random
        For y = 0 To 3
            For z = 0 To 3
                If y = 0 Then
                    matris2(y, z) = 1 + Rnd() * 4
                    ListBox5.Items.Add(matris2(y, z))
                End If
                If y = 1 Then
                    matris2(y, z) = 1 + Rnd() * 4
                    ListBox6.Items.Add(matris2(y, z))
                End If
                If y = 2 Then
                    matris2(y, z) = 1 + Rnd() * 4
                    ListBox7.Items.Add(matris2(y, z))
                End If
                If y = 3 Then
                    matris2(y, z) = 1 + Rnd() * 4
                    ListBox8.Items.Add(matris2(y, z))
                End If
            Next
        Next
    End Sub


计算


Calculate

For i = 0 To 3
      For j = 0 To 3
          For k = 0 To 3
              sonuc(i, j) = sonuc(i, j) + (matris1(i, k) * matris2(k, j))
          Next
          If i = 0 Then
              ListBox16.Items.Add(sonuc(i, j))
          ElseIf i = 1 Then
              ListBox15.Items.Add(sonuc(i, j))
          ElseIf i = 2 Then
              ListBox14.Items.Add(sonuc(i, j))
          ElseIf i = 3 Then
              ListBox13.Items.Add(sonuc(i, j))
          End If
      Next
  Next





thanks for your help.

推荐答案

写道:​​

如果i = 0则



为什么嵌套循环?为什么不通过一个循环删除内部的所有检查并仅通过四个控件运行循环?

实际上,为什么要用两组循环来做到这一点?




Why the nested loop ? Why not one loop that removes all the checks inside and just runs through the four controls ?

In fact, why the two sets of loops to do this ?


写道:​​

对于k = 0到3 sonuc(i,j)= sonuc(i,j)+(matris1(i,k)* matris2(k,j))下一页

For k = 0 To 3 sonuc(i, j) = sonuc(i, j) + (matris1(i, k) * matris2(k, j)) Next



我不确定这是否会为您带来所需的结果.我建议逐步检查它的运行状况,然后向我们询问更多细节,因为现在,我看到它应该执行某些操作,但是我不知道它是否正在执行您想要的操作.



I am not sure that this is going to give you the result you want. I would suggest stepping through it to see what is going on, and then asking us with more detail, because right now, I see that it should do SOMETHING, but I have no idea if what it does, is what you want it do.


这篇关于列表框中的矩阵乘法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆