mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tharindu Rusira <tharindurus...@gmail.com>
Subject Re: Equality of two DenseMatrix objects
Date Sun, 29 Dec 2013 17:17:37 GMT
Thanks Chameera and Sebestian for sharing your expertise :)
Just wanted to know the reason behind the absence of an equality check for
Matrices.

Regards,


On Sun, Dec 29, 2013 at 10:25 PM, Sebastian Schelter <
ssc.open@googlemail.com> wrote:

> Ah, I see, you just pointed to the issue, sorry misread your mail.
>
> The problem is that checking matrices and vectors for equality is a very
> costly operation (you have to compare at least all non-zero entries).
> For that reason, we did not implement equals correctly (which is in
> general a very bad thing).
>
> We advise users not use vectors and matrices in places where equality
> checks on them are necessary (e.g. in a HashSet or as key in a HashMap)
>
> A way to manually check the equivalence of two dense matrices is to
> compare all entries.
>
> --sebastian
>
>
> On 29.12.2013 17:49, Chameera Wijebandara wrote:
> > Sebastian,
> > Yes It's not enought to check the reference. i mean
> DenseMatrix*.*equals()
> > methord does that and it cannot use for check equity is that wrong?
> >
> >
> >
> > On Sun, Dec 29, 2013 at 8:40 AM, Sebastian Schelter <ssc@apache.org>
> wrote:
> >
> >> Chameera,
> >>
> >> This is wrong. It's not enought to check the reference, two different
> >> instances can be semantically equivalent,
> >>
> >> A dense matrix represents its entries in a two dimensional double array.
> >> You have to check for the equality of these arrays.
> >>
> >> --sebastian
> >>
> >> On 29.12.2013 17:14, Chameera Wijebandara wrote:
> >>> Hi Tharindu
> >>>
> >>> In the DenseMatrix class does not implement equals method so it use
> >>> Object.equals witch check the reference.
> >>> You have implement equals method by overriding Object.equals method.
> >>>
> >>> Thanks
> >>>   Chameera
> >>>
> >>
> >>
> >
> >
>
>


-- 
M.P. Tharindu Rusira Kumara

Department of Computer Science and Engineering,
University of Moratuwa,
Sri Lanka.
+94757033733
www.tharindu-rusira.blogspot.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message