public static void AreEqual(Matrix<double> expected, Matrix<double> actual, double tolerance = 1e-6)
 {
     Assert.AreEqual(expected.RowCount, actual.RowCount);
     Assert.AreEqual(expected.ColumnCount, actual.ColumnCount);
     double[] expectedRowWiseArray = expected.ToRowWiseArray();
     double[] actualRowWiseArray = actual.ToRowWiseArray();
     for (int i = 0; i < expectedRowWiseArray.Length; i++)
     {
         Assert.AreEqual(expectedRowWiseArray[i], actualRowWiseArray[i], tolerance);
     }
 }