Let's get LFortran to compile Minpack

Ok, another month later, thanks to Smit, Pranav, Gagandeep and many others, we fixed several of the implicit interface issues, the values now look a lot closer.

GFortran:

$ gf/examples/example_hybrd 
   3.0000000000000000     
 OK
 Done
   1.1926358347598092E-008          14           1
 Computed:
 -0.57065451160065905      -0.68162834229123059      -0.70173245256347117      -0.70421294008375235      -0.70136904762728880      -0.69186564337991419      -0.66579201215468919      -0.59603420128081663      -0.41641206299847200     
 Reference:
 -0.57065449999999995      -0.68162829999999996      -0.70173249999999998      -0.70421290000000003      -0.70136900000000002      -0.69186559999999997      -0.66579200000000005      -0.59603419999999996      -0.41641210000000001     

LFortran:

$ lf/examples/example_hybrd
3.00000000000000000e+00
OK
Done
3.20285655606697024e-09 15 1
Computed:
-5.70654512008728076e-01
-6.81628341355134837e-01
-7.01732451588553130e-01
-7.04212939801392657e-01
-7.01369048199748324e-01
-6.91865644303652494e-01
-6.65792012508090947e-01
-5.96034200751178744e-01
-4.16412063091758433e-01

Reference:
-5.70654499999999953e-01 -6.81628299999999965e-01 -7.01732499999999981e-01 -7.04212900000000031e-01 -7.01369000000000020e-01 -6.91865599999999970e-01 -6.65792000000000050e-01 -5.96034199999999958e-01 -4.16412100000000007e-01

Still not the same. It could be some numerical issues stemming from different order of operations, or possibly the usual single/double precision corruption, but it could also be another bug. We’ll have to investigate. We agree to about 1e-10:

>>> -5.70654512008728076e-01 - (-0.57065451160065905)
-4.080690230168216e-10
>>> -4.16412063091758433e-01 - (-0.41641206299847200)
-9.328643413297755e-11

If you want to help, just reproduce the above and put printing statements and see when it starts to differ, then create a minimal reproducible example and report it as a bug. Use the scipy21 branch here: GitHub - certik/minpack at scipy21 and follow the instructions in the README.

Overall, this is excellent progress, I am very happy about this.

10 Likes