You would always need to maintain some amount of extra code. The question is, how much freedom do you want to keep or are willing to give away. I’ve been personally disappointed by the restrictions of automagical tooling, so at the end, since already a few years, I decided to go the ctypes
way with Fortran
+iso_c_binding
, no need to write intermediate C code, you can check a micro example here Optimization Without Using Derivatives: the PRIMA Package, its Fortran Implementation, and Its Inclusion in SciPy - #19 by hkvzjal
1 Like