private static Matrix operMatrix(ref Matrix m1, ref Matrix m2, Func<double, double, double> func)
{
if (!(m1.rows_ == m2.rows_ && m1.columns_ == m2.columns_))
throw new ApplicationException("operation on matrices with different sizes (" +
m2.rows_ + "x" + m2.columns_ + ", " + m1.rows_ + "x" + m1.columns_ + ")");
Matrix result = new Matrix(m1.rows_, m1.columns_);
for (int i = 0; i < m1.rows_; i++)
for (int j = 0; j < m1.columns_; j++)
result[i, j] = func(m1[i, j], m2[i, j]);
return result;
}