Reece Dunn wrote:
2008/7/13 Nikolay Sivov bunglehead@gmail.com:
What do you think about matrix comparison or in general float comparison implementation? What is the best way to implement this. We have two cases now:
- GdipIsMatrixEqual which compares two matrices (with simple bitwise
operation now)
Is this the way it works on Windows? You have 4 basic cases: a. exactly equal; b. equal + epsilon for rounding/representation errors; c. equal - epsilon for rounding/representation errors; d. not equal.
The code at the moment covers a and d (is there a test for d?), but what about b and c? These would be useful, because if the Windows version of GdipIsMatrixEqual *is* catering for error of a given epsilon, then you can use that function for validation. If not, you have tests that prove that Windows is using a simplistic comparison method.
Exactly, so I plan to test this deeper on native. As I see now after some basic tests, most probably native call does a bitwise comparison cause the result is affected by a smallest matrix element change (e.g. 1.0000000f -> 1.0000001f). But I'll test it more. Reece, do you have any suggestions to do some bounds test (I mean test is call affected by representation or round errors or not)?
- GdipIsMatrixInvertible which contains a check for 'not above zero'
determinant.
It has been a while since I have done any matrix math. I'll assume that the above is the correct definition/check for invertible (makes sense because you have inv(a(ij)) = a(ij)/det(A), so can't have det(A) == 0).
Now here, you have several 'classes' of matrices w.r.t. whether they are invertible or not: a. det(A) > 0 b. det(A) == 0 c. det(A) < 0
So does Windows match your assumption for the answer to these (a ==> yes; b, c ==> no).
What do you mean here by (c => no)? Native allows negative det and I do so.
I think first of all we should choose an appropriate method to do so and only after that try to compare results with native. What do you think of that?
Are you saying that GdipIsMatrixInvertible should be used for comparison of two matrices? If so, you can have two different matrices that are invertible, so it does not make sense.
Where did I say that? It's weird.
A good first step would be to print out the expected and returned values for the matrices, and keep the GdipIsMatrixEqual check. This will allow you to determine if the reason this is failing is due to rounding errors, or that they are completely different results.
- Reece
With last patch marked 'try3' http://www.winehq.org/pipermail/wine-patches/2008-July/057797.html test and crosstest work for me cause there aren't affected by representation errors using det == 16..