public static Matrix StupidMultiply(Matrix m1, Matrix m2) // Stupid matrix multiplication
{
if (m1.cols != m2.rows) throw new MException("Wrong dimensions of matrix!");
Matrix result = ZeroMatrix(m1.rows, m2.cols);
for (int i = 0; i < result.rows; i++)
for (int j = 0; j < result.cols; j++)
for (int k = 0; k < m1.cols; k++)
result[i, j] += m1[i, k] * m2[k, j];
return result;
}
private static Matrix Multiply(double n, Matrix m) // Multiplication by constant n