Performance
-
qrfacandqformare about 2× faster (up to 2.8× in some builds): each Householder transformation is now applied to several columns at a time (contributed by @xizhexin, #80). All solvers that factor the Jacobian benefit:lmdif,lmder,lmstr,hybrd,hybrj. The number of columns is set at compile time withCMINPACK_BLOCK(default 4;-DCMINPACK_BLOCK=8is faster on arm64).qrfacwith pivoting, ms, before → after:m × n x86_64, gcc 13 -O2x86_64, gcc 13 -O3arm64, gcc 16 -O2arm64, Apple clang -O22000 × 100 20.4 → 9.3 17.0 → 7.3 11.0 → 4.3 7.4 → 4.8 500 × 200 17.8 → 7.7 14.9 → 5.9 9.6 → 3.9 5.8 → 3.8 qformon an n × n matrix, ms, before → after:n x86_64, gcc 13 -O2x86_64, gcc 13 -O3arm64, gcc 16 -O2arm64, Apple clang -O2100 0.69 → 0.29 0.65 → 0.23 0.59 → 0.25 0.37 → 0.19 300 18.1 → 7.4 15.3 → 5.6 9.27 → 3.29 5.11 → 2.90 600 145 → 62 122 → 47 73.4 → 26.0 40.8 → 21.9 -
New examples
tlmderfd.candthybrjfd.cshow how to compute the finite-difference Jacobian in parallel with OpenMP, by passing anlmdif/hybrdfunction tolmder/hybrj. No change to the library is needed. On an 18-core arm64 machine, with m = 20000 and n = 30,lmdertakes 100 ms with 8 threads, wherelmdiftakes 309 ms.
Library fixes
lmstrnow returns the user's negativeiflagwhen the user aborts during the Jacobian (#81).fdjac1andfdjac2now restorexwhen the user aborts (#89).hybrdandfdjac1no longer skip the Jacobian whenmlormuis huge, e.g.INT_MAX(#88).- The work-array size checks of
hybrd,hybrjand thelmdif1,lmder1,lmstr1,hybrd1,hybrj1drivers no longer overflow, and reject a negative size (#87). - In long double,
enormnow scales correctly on platforms where long double has the range of double (#82). USE_LAPACK:qrfacno longer reads pastawhenm < n(#84), works whenwaandrdiagare the same array (#85), and handles allocation failures and LAPACK errors.USE_BLAS: the integers passed to BLAS now have the BLAS integer type (#86). Generic BLAS/LAPACK libraries can be used on macOS (#157, #158).- The Windows DLL now exports the low-level routines (#91).
- The library sources can be built with
CMAKE_UNITY_BUILD(#90) and with-Werror=comment(#83). - CUDA port: it builds without warnings with recent nvcc versions (#190).
C++ wrapper (cminpackcpp.hpp)
- Accept a plain function passed by name (#92).
- Call a const callable as const (#93).
- Rethrow the callable's exceptions after the solver returns, instead of letting them unwind through C code (#94).
CMake and pkg-config
- C99 is required (#162).
- An invalid
CMINPACK_PRECISIONis rejected with a clear message (#109). An emptyCMAKE_BUILD_TYPEis treated as unset (#110). - The tests now run for every precision that is built (#108, #168).
- The pkg-config file lists the BLAS/LAPACK libraries correctly (#106), defines
CMINPACK_NO_DLLfor static builds (#107), and is relocatable, including on Windows (#155, #186).
Tests and examples
- Fix bugs in the FORTRAN and C test drivers and in the Jacobians used by the tests (#95, #96, #97, #98, #99, #100). The FORTRAN references were regenerated from the pure-FORTRAN drivers.
- The cross-check against FORTRAN MINPACK is stricter: it checks the least-squares residuals (#103) and the
chkdererror vectors (#99), and reports NaN residuals (#152).cmpfilesnow accepts FORTRANDexponents (#151) and alternative valuesa|b(#154), and has a smaller tolerance (#102). - Remove the unused and buggy
fortran/minpack.f90(#115).
CI
- GitHub Actions only, with one job per configuration. New: macOS jobs (Apple clang and GCC, with BLAS/LAPACK) and a CUDA build (CUDA 13.0 and 12.4). AppVeyor and Travis are removed.
Thanks
Thanks to @xizhexin for the blocked Householder transformations in qrfac (#80), which started this release's speed-ups.