shogun icon indicating copy to clipboard operation
shogun copied to clipboard

Replace Math::fequals with new utility function

Open gf712 opened this issue 4 years ago • 16 comments

We are in the process of dropping Math.h and one of the more commonly used operation there is fequals, which checks if the difference between two values is less than the type's epsilon. The task is to write this as a free function, probably in a new file in the util directory and drop Math::fequals.

gf712 avatar Jun 17 '20 11:06 gf712

@karlnapf @vigsterkr I am assuming we should also remove fequals_epsilon in env in favour of std::numeric_limits<T>::epsilon?

gf712 avatar Jun 17 '20 11:06 gf712

there are some issues: CMath is stateful and the fequals_epsilonis modified in some testing parts. I am not sure that is still the case (it was basically to decrease accuracy temporarily in the integration testing without having to pass the epsilon down through 10 functions). Given that serialization now works differently (and should be lossless?), the epsilon is never changed. In that case I agree

karlnapf avatar Jun 17 '20 17:06 karlnapf

Hello! I am new to open source contributions.Can I do some help ?

5aumy4 avatar Jul 03 '20 04:07 5aumy4

is anybody is doing or done something on this issue .?...

Raghibshams456 avatar Jul 07 '20 14:07 Raghibshams456

nope :)

karlnapf avatar Jul 07 '20 14:07 karlnapf

I've looked into math.h and the simplest solution is to lift the fequals function there and add it into a separate function/header file. Doing that will account for the stateful-ness of math.h without diving deep to ascertain the current status of the serialization (presumably lossless).

However, this seems way too simple necessitating my question- would that suffice as a solution? If not, could you please point out what/where this serialization is? @karlnapf @gf712

AvidDrawer avatar Aug 16 '20 13:08 AvidDrawer

Hi! Is anyone working over this issue? I would like to take it up if nobody is. Thanks!

yuvraj2701 avatar Sep 18 '20 21:09 yuvraj2701

Go ahead. From the looks of it, I don't think anyone else is.

I'm stopped since it looked like a fair bit of work that might end up being unused if I end up in the wrong direction.

AvidDrawer avatar Sep 19 '20 04:09 AvidDrawer

Thank you I am a newbie here. If possible could you please give me some direction/hints to help me get started and move forward with the task?

yuvraj2701 avatar Sep 19 '20 05:09 yuvraj2701

I'm not the best person for this. If you search for mathematics.h, you should be able to find the function that we are trying to replace. One potential solution is as I described/queried on the comment above.

AvidDrawer avatar Sep 20 '20 15:09 AvidDrawer

@karlnapf @gf712. Hi, I am new in shogun and want to start contributing. Can I be assigned this issue ?

justdvnsh avatar Sep 28 '20 05:09 justdvnsh

Hey I am still working over it

yuvraj2701 avatar Sep 28 '20 08:09 yuvraj2701

@karlnapf @gf712 can you please tell whether the other methods of Math.h (which are used by fequals function like abs<> ,fequals_abs, etc.) need to be moved to the same new file or to some other file or they should be kept in Math.h itself?

yuvraj2701 avatar Oct 08 '20 15:10 yuvraj2701

Hi, sure, those can be moved as well. Easiest is to start a PR and can take it from there.

gf712 avatar Oct 09 '20 07:10 gf712

@gf712 I have started a pr (#5130) . Not sure about why the tests are failing. Can you please guide me?

yuvraj2701 avatar Oct 10 '20 09:10 yuvraj2701

Hello im new here and i would like to start contributing. Is this thread still open/ not being worked on by anyone ? If so I would also try to get my fingers wet :)

nalinwadhwa02 avatar Nov 16 '20 18:11 nalinwadhwa02