public void Invert() { ColumnWiseMatrix A = GetInvertibleMatrix(128); DeviceManager.CheckDeviceSanity(); ColumnWiseMatrix AMinus1 = new ColumnWiseMatrix(A); AMinus1.Invert(); DeviceManager.CheckDeviceSanity(); var eye = A.Multiply(AMinus1); var _eye = eye.GetMatrix <float>(); var _A = A.GetMatrix <float>(); var _AMinus1 = AMinus1.GetMatrix <float>(); for (int i = 0; i < A.nRows; ++i) { for (int j = 0; j < A.nCols; ++j) { double expected = i == j ? 1.0 : 0.0; Assert.IsTrue(Math.Abs(_eye[i, j] - expected) <= 5e-5); } } }