toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Toon-members] comparing vectors of different sizes


From: E. Rosten
Subject: Re: [Toon-members] comparing vectors of different sizes
Date: Tue, 16 Nov 2010 16:55:30 +0000 (GMT)
User-agent: Alpine 2.00 (LSU 1167 2008-08-23)

On Tue, 16 Nov 2010, Alex Flint wrote:

Hi there,
It seems that TooN crashes when comparing two vectors of different sizes, at least one of 
which is dynamic. The error is "size mismatch",
which is understandable, though in this case (checking for equality) it would 
seem to make more sense to return false. What do you think?

The current design of TooN is that everything that is a compile time error using static sized vectors should crash with dynamic vectors. I.e. it indicates that the program is not correct and therefore no recovery cannot be performed.

However that makes the assumption that there is no reasonable case where one might want to compare two vectors of different lengths. Actually, even the test current for equality is a bit dubious since one will usually be at the mercy of floating point numbers and rounding errors.

Would you mind describing why you are comparing vectors of different lengths for equality? I'd like to better understand the use cases of TooN which I haven't considered.


Also, in the more general case of unavoidable size mismatches, I would like to have TooN throw exceptions. This seems to have been implemented via TOON_TEST_INTERNALS but I'm not sure what other ramifications this debug flag will cause -- any suggestions?

I expect you don't want to run with that flag on. It will make your program slow, also it's not part of the public interface, so it may change without warning.

-Ed

--
Edward Rosten                     Machine Intelligence Laboratory
http://mi.eng.cam.ac.uk/~er258          Department of Engineering
+44 1223 7 65960                          University of Cambridge





reply via email to

[Prev in Thread] Current Thread [Next in Thread]