Skip to content

Adds a Durand-Kerner polynomial solver to core and improves solver API#1865

Merged
kennyweiss merged 9 commits into
developfrom
feature/kweiss/polynomial-solvers
May 19, 2026
Merged

Adds a Durand-Kerner polynomial solver to core and improves solver API#1865
kennyweiss merged 9 commits into
developfrom
feature/kweiss/polynomial-solvers

Conversation

@kennyweiss
Copy link
Copy Markdown
Member

Summary

  • This PR improves Axom's polynomial solver capabilities
  • It adds a Durand-Kerner polynomial solver, which returns the complex roots for a univariate polynomial
  • It also modernizes the API for the linear, quadratic and cubic solvers to use axom::ArrayViews instead of pointers to C-style arrays. The latter have been deprecated
  • Misc: It also adds axom::Array::pop_back() for compatibility with std::vector

Durand-Kerner solver

Here's a visualization (courtesy of claude) of how the solver works for the polynomial: $z^3-1$, initialized with three seed points near the unit circle -- powers of $.4+.9i$

durand_kerner_z3_minus_1

@kennyweiss kennyweiss added enhancement New feature or request Core Issues related to Axom's 'core' component labels May 13, 2026
*/
template <typename ScalarType>
ScalarType evaluate_polynomial(ArrayView<const double> coeffs_descending, const ScalarType& x)
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the tparam doc says ScalarType is double or Complex. Is a static_assert() for that in order here, or might be useful to pass Vector<double,3> or other things in down the road?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a static_assert. If we need more flexibility later, we can modify the function/signature.


result.roots.resize(effective_degree);
// Powers of this non-real base with magnitude around 1 give deterministic, distinct initial guesses.
const Complex seed_center {0.4, 0.9};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything special about this particular seed value? Could there ever be utility to letting a user pick the seed value? I know that can help a lot in regular Newton solvers.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was the value on the wikipedia page and they explicitly say it's not special :)

Sure -- we can pass update the API to optionally pass in a seed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Copy Markdown
Contributor

@jcs15c jcs15c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@kennyweiss kennyweiss self-assigned this May 15, 2026
@kennyweiss kennyweiss force-pushed the feature/kweiss/polynomial-solvers branch from 0ac7df3 to a1f685a Compare May 19, 2026 03:03
@kennyweiss kennyweiss merged commit fdab45f into develop May 19, 2026
25 of 29 checks passed
@kennyweiss kennyweiss deleted the feature/kweiss/polynomial-solvers branch May 19, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Issues related to Axom's 'core' component enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants