On Sun, Dec 29, 2013 at 7:30 PM, Tharindu Rusira
<tharindurus...@gmail.com>wrote:

> Hi Ted, Thanks for taking this discussion back alive. It's true, as
> Sebestian mentioned, equality checking for matrices is an expensive task
> and Ted has come up with a smart one liner here(even though a considerable
> amount of computational complexity is hidden somewhere).
> But don't you think (at least for the sake of completeness) that we should
> have an implementation of this?
>

Not really.  The problem is that there are many different meanings of
"equal" for matrices. In fact there are many definitions of zero, as well.
 This stems partly from the fact that we have to inherit a sense of nearly
zero or nearly equal from the fact that we are using floating point
arithmetic.  This is exactly why equals is poorly defined for floating
point numbers, but worse.

As such any single definition is going to be seriously problematic.  Any
definition that doesn't have a tolerance argument is inherently dangerous
to use except in very limited situations.

For example here are some possibilities for vector equality:

   | x - y|_F < \delta
   | x - y|_1 < \delta
   | x - y|_0 < \delta
   (x-y)^T A (x-y) < \delta
   x^T A y > 1-\delta/2

The first says that the sum of the squares of the components of the
difference is less than a particular number.  The second says that the sum
of the absolute values of the difference is less.  The third says that the
maximum value of the difference is different.  The third says that the dot
product of the of the difference is nearly zero neglecting components in
the null space of A.  The last form is useful for cases where x and y have
unit norm with respect to A (i.e. x^T A x = 1).

Which of these is correct?  Of all of these, only the last two are
equivalent and only in limited situations.

For matrices, there are even more possibilities.



> Btw, this thread has turned into a developers discussion, so I'm not sure
> whether we should continue this on the developers list.
>

I think that this is a very important thread for users at large as well.

Reply via email to