FloatKey In a Double precision?
Dear all IMP developers,
By default, Float data type is defined as "typedef float Float;" and it can have a corresponding FloatKey.
But in the case of "double" data type for higher accuracy, there is no DoubleKey assigned currently.
I'm just curious about it. Do you think is it necessary to define DoubleKey as well?
or is it safe to use FloatKey instead?
Thanks a lot! Seung Joong Kim
Seung Joong Kim wrote: > By default, Float data type is defined as "typedef float Float;" and it > can have a corresponding FloatKey. > > But in the case of "double" data type for higher accuracy, there is no > DoubleKey assigned currently. > > I'm just curious about it. Do you think is it necessary to define > DoubleKey as well? > or is it safe to use FloatKey instead?
If all you want to do is to use double-precision floating point data in your calculations, by all means go ahead and use the "double" data type. We would only need a "DoubleKey" if we wanted to explicitly store double-precision floating point data in the IMP Particles (but we probably don't need to do that).
Ben
I have another question with regard to maintaining double precision.
Currently all vector related classes are defined on the basis of float data type (single-precision), so I'm losing accuracy whenever I use double data type in a Vector3D class.
Do you have any update plan to implement Vector3D class in a double precision? I think it should be very useful for higher accuracy.
Many Thanks! Seung Joong Kim
Ben Webb wrote: > Seung Joong Kim wrote: > >> By default, Float data type is defined as "typedef float Float;" and it >> can have a corresponding FloatKey. >> >> But in the case of "double" data type for higher accuracy, there is no >> DoubleKey assigned currently. >> >> I'm just curious about it. Do you think is it necessary to define >> DoubleKey as well? >> or is it safe to use FloatKey instead? >> > > If all you want to do is to use double-precision floating point data in > your calculations, by all means go ahead and use the "double" data type. > We would only need a "DoubleKey" if we wanted to explicitly store > double-precision floating point data in the IMP Particles (but we > probably don't need to do that). > > Ben >
I was just thinking about that. Since the Vector3D (and rotation) is basically a computational convenience class which stores intermediates in computations rather than being used to store data in particles, it should probably use doubles. Easy enough to change.
On Jan 30, 2009, at 2:16 AM, Seung Joong Kim wrote:
> I have another question with regard to maintaining double precision. > > Currently all vector related classes are defined on the basis of > float data type (single-precision), so I'm losing accuracy whenever > I use double data type in a Vector3D class. > > Do you have any update plan to implement Vector3D class in a double > precision? I think it should be very useful for higher accuracy. > > Many Thanks! > Seung Joong Kim > > > Ben Webb wrote: >> Seung Joong Kim wrote: >> >>> By default, Float data type is defined as "typedef float Float;" >>> and it >>> can have a corresponding FloatKey. >>> >>> But in the case of "double" data type for higher accuracy, there >>> is no >>> DoubleKey assigned currently. >>> >>> I'm just curious about it. Do you think is it necessary to define >>> DoubleKey as well? >>> or is it safe to use FloatKey instead? >>> >> >> If all you want to do is to use double-precision floating point >> data in >> your calculations, by all means go ahead and use the "double" data >> type. >> We would only need a "DoubleKey" if we wanted to explicitly store >> double-precision floating point data in the IMP Particles (but we >> probably don't need to do that). >> >> Ben >> > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
Many times you use XYZDecorator to get the initial Vector3D. And the results of the Rotations/Transformations are stored back in particles - so the double precision will be lost in the optimization process. Can one change FloatKey to be really "double" in compilation time using a flag ? On Jan 30, 2009, at 7:13 AM, Daniel Russel wrote:
> I was just thinking about that. Since the Vector3D (and rotation) is > basically a computational convenience class which stores > intermediates in computations rather than being used to store data > in particles, it should probably use doubles. Easy enough to change. > > > On Jan 30, 2009, at 2:16 AM, Seung Joong Kim wrote: > >> I have another question with regard to maintaining double precision. >> >> Currently all vector related classes are defined on the basis of >> float data type (single-precision), so I'm losing accuracy whenever >> I use double data type in a Vector3D class. >> >> Do you have any update plan to implement Vector3D class in a double >> precision? I think it should be very useful for higher accuracy. >> >> Many Thanks! >> Seung Joong Kim >> >> >> Ben Webb wrote: >>> Seung Joong Kim wrote: >>> >>>> By default, Float data type is defined as "typedef float Float;" >>>> and it >>>> can have a corresponding FloatKey. >>>> >>>> But in the case of "double" data type for higher accuracy, there >>>> is no >>>> DoubleKey assigned currently. >>>> >>>> I'm just curious about it. Do you think is it necessary to define >>>> DoubleKey as well? >>>> or is it safe to use FloatKey instead? >>>> >>> >>> If all you want to do is to use double-precision floating point >>> data in >>> your calculations, by all means go ahead and use the "double" data >>> type. >>> We would only need a "DoubleKey" if we wanted to explicitly store >>> double-precision floating point data in the IMP Particles (but we >>> probably don't need to do that). >>> >>> Ben >>> >> >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
Keren Lasker wrote: > Many times you use XYZDecorator to get the initial Vector3D. And the > results of the Rotations/Transformations are stored back in particles - > so the double precision will be lost in the optimization process.
Sure, but the 'noise' introduced by double to single precision rounding is surely several orders of magnitude less the error bounds on the data, approximations made in the optimizers (e.g. MD timestep) etc. so you're not really losing anything here.
> Can one change FloatKey to be really "double" in compilation time using > a flag ?
Since Float is just a typedef, you only need to change one line of code if you want to play with it.
Ben
participants (4)
-
Ben Webb
-
Daniel Russel
-
Keren Lasker
-
Seung Joong Kim