lessthanoptimal / ddogleg

Java numerics library for optimization, polynomial root finding, sorting, robust model fitting, and more.
http://ddogleg.org
49 stars 17 forks source link

Complex Polynomials #22

Open machielg opened 2 years ago

machielg commented 2 years ago

I'm looking for a Java library to calculate the roots of a polynomial with complex components. Is it feasible to add this to ddogleg? It seems like the current implementation is transferable.

lessthanoptimal commented 2 years ago

Doesn't look like it will be easy to add support for polynomials with complex components. There are two approaches implemented in DDogleg. One uses Eigen Value Decomposition and the other Strum sequence. EJML doesn't support complex EVD and would be a major undertaking to support. Strum sequence can only be used to find real valued roots, so it's eliminated.

Your best bet might be to find a linear algebra library that supports complex EVD (LAPACK does and Eigen might) then use the companion matrix approach for finding the roots of a polynomial.