晕死!学数学的我,竟然把矩阵的乘法忘了!
今天写程序需要用到矩阵的乘法算法,我靠,我竟然忘了!
鄙视我自己!
‘这个函数用来计算两个矩阵的乘积的
Public Function chenji(m As Integer, n As Integer, k As Integer, a() As Integer, b() As Integer)
‘函数的各个参数分别表示A矩阵的行数,B矩阵的列数,B矩阵的行数,A矩阵,B矩阵
Dim i As Integer, j As Integer, h As Integer
Dim c(2, 2) As Integer
‘算法部分
For i = 1 To m
For j = 1 To n
c(i, j) = 0
For h = 1 To k
c(i, j) = c(i, j) + a(i, h) * b(h, j)
Next
Next
Next
End Sub
这个是用vb写的!记在博客里,就算对自己的警告!