# Announcing Polyroots-Fortran

**URL:** <https://fortran-lang.discourse.group/t/announcing-polyroots-fortran/4347>\
**Category:** Announcements\
**Created:** [September 18, 2022, 8:02pm UTC](https://fortran-lang.discourse.group/t/announcing-polyroots-fortran/4347 "2022-09-18T20:02:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacobwilliams](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jacobwilliams/32/10_2.png) [@jacobwilliams](https://fortran-lang.discourse.group/u/jacobwilliams)\
**Post date:** [September 18, 2022, 8:02pm UTC](https://fortran-lang.discourse.group/t/announcing-polyroots-fortran/4347/1 "2022-09-18T20:02:31Z")

</div>

Announcing [Polyroots-Fortran](https://github.com/jacobwilliams/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](https://github.com/jacobwilliams/polyroots-fortran) 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!

> **[GitHub - jacobwilliams/polyroots-fortran: Polynomial Roots with Modern Fortran](https://github.com/jacobwilliams/polyroots-fortran)**
>
> Polynomial Roots with Modern Fortran. Contribute to jacobwilliams/polyroots-fortran development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [October 5, 2022, 7:06pm UTC](https://fortran-lang.discourse.group/t/announcing-polyroots-fortran/4347/2 "2022-10-05T19:06:46Z")

</div>

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:

- [QPBLAS](https://ccse.jaea.go.jp/software/QPBLAS/index_eng.html)
- [QPEigen\_K](https://ccse.jaea.go.jp/software/QPEigen_K/)

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.)

---

<div class="post-metadata">

**Author:** ![jacobwilliams](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jacobwilliams/32/10_2.png) [@jacobwilliams](https://fortran-lang.discourse.group/u/jacobwilliams)\
**Post date:** [October 6, 2022, 3:24pm UTC](https://fortran-lang.discourse.group/t/announcing-polyroots-fortran/4347/3 "2022-10-06T15:24:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jacobwilliams](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/jacobwilliams/32/10_2.png) [@jacobwilliams](https://fortran-lang.discourse.group/u/jacobwilliams)\
**Post date:** [October 6, 2022, 3:31pm UTC](https://fortran-lang.discourse.group/t/announcing-polyroots-fortran/4347/4 "2022-10-06T15:31:21Z")

</div>

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

| Method name | Polynomial type | Coefficients | Roots | Reference |
| --- | --- | --- | --- | --- |
| [`cpoly`](https://jacobwilliams.github.io/polyroots-fortran/proc/cpoly.html) | General | complex | complex | [Jenkins & Traub (1972)](https://dl.acm.org/doi/abs/10.1145/361254.361262) |
| [`rpoly`](https://jacobwilliams.github.io/polyroots-fortran/proc/rpoly.html) | General | real | complex | [Jenkins & Traub (1975)](https://dl.acm.org/doi/10.1145/355637.355643) |
| [`rpzero`](https://jacobwilliams.github.io/polyroots-fortran/proc/rpzero.html) | General | real | complex | [SLATEC](https://netlib.org/slatec/src/rpzero.f) |
| [`cpzero`](https://jacobwilliams.github.io/polyroots-fortran/proc/cpzero.html) | General | complex | complex | [SLATEC](https://netlib.org/slatec/src/cpzero.f) |
| [`rpqr79`](https://jacobwilliams.github.io/polyroots-fortran/proc/rpqr79.html) | General | real | complex | [SLATEC](https://netlib.org/slatec/src/rpqr79.f) |
| [`cpqr79`](https://jacobwilliams.github.io/polyroots-fortran/proc/cpqr79.html) | General | complex | complex | [SLATEC](https://netlib.org/slatec/src/cpqr79.f) |
| [`dcbcrt`](https://jacobwilliams.github.io/polyroots-fortran/proc/dcbcrt.html) | Cubic | real | complex | [NSWC Library](https://github.com/jacobwilliams/nswc) |
| [`dqdcrt`](https://jacobwilliams.github.io/polyroots-fortran/proc/dqdcrt.html) | Quadratic | real | complex | [NSWC Library](https://github.com/jacobwilliams/nswc) |
| [`dpolz`](https://jacobwilliams.github.io/polyroots-fortran/proc/dpolz.html) | General | real | complex | [MATH77 Library](https://netlib.org/math/) |
| [`polyroots`](https://jacobwilliams.github.io/polyroots-fortran/proc/polyroots.html) | General | real | complex | [LAPACK](https://netlib.org/lapack/explore-html/index.html) |
| [`cpolyroots`](https://jacobwilliams.github.io/polyroots-fortran/proc/cpolyroots.html) | General | complex | complex | [LAPACK](https://netlib.org/lapack/explore-html/index.html) |
| [`rroots_chebyshev_cubic`](https://jacobwilliams.github.io/polyroots-fortran/proc/rroots_chebyshev_cubic.html) | Cubic | real | complex | [Lebedev (1991)](https://doi.org/10.1515/rnam.1991.6.4.315) |
| [`qr_algeq_solver`](https://jacobwilliams.github.io/polyroots-fortran/proc/qr_algeq_solver.html) | General | real | complex | [Edelman & Murakami (1995)](https://www.ams.org/journals/mcom/1995-64-210/S0025-5718-1995-1262279-2/S0025-5718-1995-1262279-2.pdf) |
| [`polzeros`](https://jacobwilliams.github.io/polyroots-fortran/proc/polzeros.html) | General | complex | complex | [Bini (1996)](https://link.springer.com/article/10.1007/BF02207694) |
| [`cmplx_roots_gen`](https://jacobwilliams.github.io/polyroots-fortran/proc/cmplx_roots_gen.html) | General | complex | complex | [Skowron & Gould (2012)](http://www.astrouw.edu.pl/~jskowron/cmplx_roots_sg/) |
| [`fpml`](https://jacobwilliams.github.io/polyroots-fortran/proc/fpml.html) | General | complex | complex | [Cameron (2019)](https://link.springer.com/article/10.1007/s11075-018-0641-9) |

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. 😬
