Announcing Polyroots-Fortran

Announcing Polyroots-Fortran, a new Modern Fortran library for finding the roots of polynomial equations. Many of the routine are refactored versions of classic codes (e.g., from SLATEC), but there are also more modern routines. The goal is to continue to expand the library.

Features include:

  • Lots of different methods (see the Readme for a list), for both real and complex coefficients.
  • Modern code (free-form, no gotos, etc.)
  • Works with the amazing Fortran Package Manager
  • Selectable real kind (works for real32, real64, and real128). To my knowledge, this library contains some of the only real128 compatible versions of these algorithms that I’ve seen.

Join us and help to improve it!


Thanks for all the effort you’ve put into this so far!

I wonder if the MATLAB roots routine does anything differently than the polyroots function in your new collection. For a quad-precision (Fortran) eigenvalue solver, I’ve located the following two packages:

offered by the Center for Computational Science & e-Systems of the Japan Atomic Energy Agency. Looking at the documentation it appears that both double-double (DD) and quadruple precision (QP) routines are available. (For the latter only if the compiler supports it.)

1 Like

Nice! I’ll look into them. For the record, all the routines in there now do support quad precision, except for the two LAPACK-based ones.

For the record, these are the methods we have now:

Method name Polynomial type Coefficients Roots Reference
cpoly General complex complex Jenkins & Traub (1972)
rpoly General real complex Jenkins & Traub (1975)
rpzero General real complex SLATEC
cpzero General complex complex SLATEC
rpqr79 General real complex SLATEC
cpqr79 General complex complex SLATEC
dcbcrt Cubic real complex NSWC Library
dqdcrt Quadratic real complex NSWC Library
dpolz General real complex MATH77 Library
polyroots General real complex LAPACK
cpolyroots General complex complex LAPACK
rroots_chebyshev_cubic Cubic real complex Lebedev (1991)
qr_algeq_solver General real complex Edelman & Murakami (1995)
polzeros General complex complex Bini (1996)
cmplx_roots_gen General complex complex Skowron & Gould (2012)
fpml General complex complex Cameron (2019)

What I love about this is that here are 50 years of Fortran codes, all in one place, well documented, easy to use, easy to incorporate into other codes (via FPM), cleaned up and modernized and ready for use for the next 50 years.

Meanwhile I have Python and Julia code from a couple years ago that doesn’t work anymore. :grimacing: