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

Re: [IMP-dev] strange behavior with Vector3D operator== under python



also - the way to compare vectors in using algebra::get_distance
On Feb 23, 2011, at 9:22 AM, Daniel Russel wrote:

> It is "expected" in a certain sense in that one should not expect it to work right as comparisons on geometric objects like that can't be implemented very reliably (due to floating point values getting truncated unexpectedly as they are moved between floating point registers and memory). Specifically, algebra::Vector3D v= v2; assert(v==v2); is not guaranteed to succeed when optimizations are turned on.
> 
> That said, we should probably do something on the python side to make it clearer that it isn't supported (on the C++ side there are no comparison operators). Perhaps provide an implementation of __cmp__ that throws an exception.
> 
> On Feb 23, 2011, at 8:36 AM, Benjamin SCHWARZ wrote:
> 
>> Don't know if it has already been reported or if this is an expected behavior…
>> Tested with latest IMP svn release.
>> 
>> import IMP
>> import IMP.algebra
>> a=IMP.algebra.Vector3D(1,1,2)
>> b=IMP.algebra.Vector3D(1,1,2)
>> a==b
>> 
>> 
>> --> False
>> 
>> 
>>   --Ben (schwarz)
>> _______________________________________________
>> IMP-dev mailing list
>> 
>> https://salilab.org/mailman/listinfo/imp-dev
> 
> 
> _______________________________________________
> IMP-dev mailing list
> 
> https://salilab.org/mailman/listinfo/imp-dev