该方法并不检测矩阵中没一个单元格的值是否相等,因为其类型是double,只是检测单元格的值是否接近,double也不能判断相等。
static bool areMatricesEqual(double[][] matrixOne, double[][] matrixTwo, double delta)
{
int aRows = matrixOne.Length;
int bCols = matrixTwo[0].Length;
for (int i = 0; i < aRows; ++i) // each row of One and Two
for (int j = 0; j < bCols; ++j) // each col of One and Two
if (Math.Abs(matrixOne[i][j] - matrixTwo[i][j]) > delta)
return false;
return true;
}
