github devernay/cminpack v1.3.15
cminpack 1.3.15

one hour ago

Performance

  • qrfac and qform are 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 with CMINPACK_BLOCK (default 4; -DCMINPACK_BLOCK=8 is faster on arm64).

    qrfac with pivoting, ms, before → after:

    m × n x86_64, gcc 13 -O2 x86_64, gcc 13 -O3 arm64, gcc 16 -O2 arm64, Apple clang -O2
    2000 × 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

    qform on an n × n matrix, ms, before → after:

    n x86_64, gcc 13 -O2 x86_64, gcc 13 -O3 arm64, gcc 16 -O2 arm64, Apple clang -O2
    100 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.c and thybrjfd.c show how to compute the finite-difference Jacobian in parallel with OpenMP, by passing an lmdif/hybrd function to lmder/hybrj. No change to the library is needed. On an 18-core arm64 machine, with m = 20000 and n = 30, lmder takes 100 ms with 8 threads, where lmdif takes 309 ms.

Library fixes

  • lmstr now returns the user's negative iflag when the user aborts during the Jacobian (#81).
  • fdjac1 and fdjac2 now restore x when the user aborts (#89).
  • hybrd and fdjac1 no longer skip the Jacobian when ml or mu is huge, e.g. INT_MAX (#88).
  • The work-array size checks of hybrd, hybrj and the lmdif1, lmder1, lmstr1, hybrd1, hybrj1 drivers no longer overflow, and reject a negative size (#87).
  • In long double, enorm now scales correctly on platforms where long double has the range of double (#82).
  • USE_LAPACK: qrfac no longer reads past a when m < n (#84), works when wa and rdiag are 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_PRECISION is rejected with a clear message (#109). An empty CMAKE_BUILD_TYPE is 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_DLL for 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 chkder error vectors (#99), and reports NaN residuals (#152). cmpfiles now accepts FORTRAN D exponents (#151) and alternative values a|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.

Don't miss a new cminpack release

NewReleases is sending notifications on new releases.