Hacker News new | ask | show | jobs
by tomr_stargazer 1131 days ago
I thought that the PRIMA developer’s comment in this thread was really mature and thoughtful. Reproduced below (minus some formatting):

> My goal is to make Professor Powell 12’s solvers as accessible as possible to scientists, engineers, and algorithm researchers. I am not particularly in favor of or against any language. I hope that everyone can easily use Powell’s solvers in her/his favorite languages.

> The first implementation of PRIMA is in modern Fortran simply because Powell’s implementation was in Fortran 77. Using Fortran, I can systematically verify the bit-to-bit faithfulness of the modernized implementation (not only “faithful up to an epsilon”). In addition, the intrinsic support for matrix-vector calculations is a strong advantage when developing reference implementations (or templates) of numerical solvers — most numerical algorithms are combinations of such calculations anyway.

> The major motivation for developing the modern Fortran version is to provide a reference for the implementation in other languages, namely Python, MATLAB, C++, Julia, and R. A reference implementation must be structured, modularized, readable, understandable, and extendable. The original Fortran 77 code is a true masterpiece, but it is not proper at all for being used as a reference implementation. You do not want to use a spaghetti-style codebase with 244 GOTOs as a reference, or your implementation will be of the same style.

> Putting it more straightforwardly, I implemented the modern-Fortran version of PRIMA in order to develop versions that are entirely Fortran-free 3.

> Coming back to the point, I fully understand why the SciPy community has “little appetite for taking on more Fortran code”. The reputation of Fortran has been damaged over the years. I do not agree with the damaged reputation, and I feel sorry for those who do not have a chance to know (or refuse to know) modern Fortran due to this false reputation, but I do not blame them. It is the responsibility of the Fortran community to re-establish the reputation. I do not regard it as a bully to request non-Fortran implementations. It is not a question of surrendering or not.

> I do consider myself a member of the Fortran community. Taking my share of the aforementioned responsibilty, I will try to promote the usage of modern Fortran via the PRIMA project. There is nothing more convincing than a successful real-life project.

> For the inclusion of PRIMA in SciPy, I will keep communicating with both the SciPy and the Fortran community (e.g., those on this discourse), trying to find the best route. As pointed out by others, f2c is not an option due to its incapability of handling modern Fortran. Official C++ and Python implementations are being planned, but they will not be delivered in the near future. The most probable and practical solution, as suggested here and under the other thread, is to wrap the modern Fortran implementation of PRIMA using iso_c_bindings + ctypes or similar facilities. I hope the SciPy maintainers will accept this solution.

2 comments

Yeah, I agree 100% - I really support the approach of the developer here and am totally aligned with all the reasoning.

The libprima/prima codebase is very readable, even if you're not accustomed to modern Fortran (let alone Fortran period). It has fantastic comments throughout the numerical algorithms, and even though there are a lot of lines of code, in most places it really seems to be a minimally-complex implementation with very little magic. I haven't built anything against the codebase yet but based on the examples I feel it will be far easier than many other libraries out there.

A motivated developer could very quickly port this code to their preferred numerical programming language.

Thank you so much for your very warm and encouraging comments!

PRIMA has been a black hole that absorbs all my time and energy in the past three years, which even puts my career (as a junor professor) in real danger. The positive feedback like yours is vital for me. Without it, I would not have the energe or courage to continue. Many thanks!

> A motivated developer could very quickly port this code to their preferred numerical programming language.

I am much glad to hear a person other than myself saying this. It is the very reason why I develop this reference implementation. PRIMA achieves its success if others can implement Powell's solvers to high quality using PRIMA as a referene, without the genius like Powell and without the long-term experience and strugling like me.

Many thanks! --- Zaikun

Hey, all the thanks go to you! I really wish we could do more to reward contributions like this when they're coming from folks in the academic world... the impact of this work is easily on par with anything else you could do as a junior faculty.

Have you considered setting up a regular search on GitHub to try to find public codebases that are likely using your library? That might be a great complementary set of statistics that you can use to promote the impact of this work.

Thank you very much for quoting this! --- Zaikun