更新时间:2022-12-09 18:04:23
您的矩阵乘法的代码是错误的。代替:
Your code for multiplication of the matrices is wrong. Instead of:
for (int i = 0; i < a; i++)
{
for (int j = 0; j < d; j++)
{
Mat3[i][j] = Mat1[i][j] * Mat1[i][j];
}
}
您需要:
for (int i = 0; i < a; i++)
{
for (int j = 0; j < d; j++)
{
Mat3[i][j] = 0;
for (int k = 0; k < c; k++)
{
Mat3[i][j] += Mat1[i][k] * Mat2[k][j];
}
}
}