Hi,
I found getLengthSqured() method name in AbstractVector slightly
misguiding. As, it is not only getting the lengthSquared value but also
setting it if it is not set previously. Actually, I found this issue
when I am comparing two vectors, though both of them are same, in one
place the lengthSquared value wasn't set (so, by default it has -1) and
for other vector, it is set because the distance(double lengthSquared,
Vector, Vector) method was called. So, when I am comparing the string
format of both of them( as well vectors), they failed though they are
same vectors but the lengthSquared value was different. I am not sure
whether we can ignore this value while outputting in asFormatString().
Just wanted to bring to the notice so that it will be useful to others
while experimenting (especially, in unit tests).
Thanks
Pallavi
- getLengthSquared() method in AbstractVector Pallavi Palleti
-