namespace SolH
{
class H7
{
static int[,] MatrixMultiply(int[,] A, int[,] B)
{
int[,] R = new int[A.GetLength(0), B.GetLength(1)];
for (int i = 0; i < A.GetLength(0); i++)
{
for (int j = 0; j < B.GetLength(1); j++)
{
for (int k = 0; k < A.GetLength(1); k++) // why are we looping through A's columns?
{
R[i, j] = R[i, j] + A[i, k] * B[k, j]; //why do we need to add R[i, j]? Isnt it an empty array after we initialize it?
}
}
}
return R;
}
namespace SolH
{
class H7
{
static int[,] MatrixMultiply(int[,] A, int[,] B)
{
int[,] R = new int[A.GetLength(0), B.GetLength(1)];
for (int i = 0; i < A.GetLength(0); i++)
{
for (int j = 0; j < B.GetLength(1); j++)
{
for (int k = 0; k < A.GetLength(1); k++) // why are we looping through A's columns?
{
R[i, j] = R[i, j] + A[i, k] * B[k, j]; //why do we need to add R[i, j]? Isnt it an empty array after we initialize it?
}
}
}
return R;
}