public static Matrix operator *(Matrix m1, Matrix m2)
{
if (m1.Cols != m2.Rows)
throw new InvalidOperationException("Invalid multiplication dimenstion");
var result = new double[m1.Rows][];
for (int i = 0; i < m1.Rows; i++)
{
result[i] = new double[m2.Cols];
for (int j = 0; j < m2.Cols; j++)
for (int k = 0; k < m1.Cols; k++)
result[i][j] += m1[i, k] * m2[k, j];
}
return result;
}