vb.net的矩阵乘法 [英] matrix multiplication for vb.net
本文介绍了vb.net的矩阵乘法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请尽快帮助我解决矩阵乘法的问题
please help me as early as possible to solve the problem of matrix multiplication
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ar1txt.Text = "2"
ai1txt.Text = "3"
ar2txt.Text = "4"
ai2txt.Text = "5"
ar3txt.Text = "6"
ai3txt.Text = "7"
ar4txt.Text = "8"
ai4txt.Text = "9"
br1txt.Text = "2"
bi1txt.Text = "3"
br2txt.Text = "4"
bi2txt.Text = "5"
br3txt.Text = "6"
bi3txt.Text = "7"
br4txt.Text = "8"
bi4txt.Text = "9"
Dim A(0 To 10, 0 To 10) As Double
Dim B(0 To 10, 0 To 10) As Double
Dim Product(0 To 10, 0 To 10) As Double
Dim J As Integer
Dim K As Integer
Dim X As Integer
For J = 0 To 10
For K = 0 To 10
Product(J, K) = A(J, X) * B(X, K)
For X = 1 To 10
Product(J, K) = Product(J, K) + A(J, X) * B(X, K)
Next X
Next K
Next J
ans1txt.Text = Product(J, K)
ans2txt.Text = Product(J, K)
ans3txt.Text = Product(J, K)
ans4txt.Text = Product(J, K)
End Sub
这是我的矩阵乘法代码
但由于出现索引超出数组范围"而报错
请告诉我哪里出错了
this is my code for matrix multiplication
but getting error as "Index was outside the bounds of the array"
please tell me where its getting wrong
推荐答案
您可以在此处找到矩阵计算的好示例
http://www.a1vbcode.com/app-2384.asp [
You can find the good example of matrix calculation here
http://www.a1vbcode.com/app-2384.asp[^]
这篇关于vb.net的矩阵乘法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文