Skip to content

Conversation

@osanstrong
Copy link

This pull request adds FerrariSolver, a class implementing the Ferrari-Cardano method to solve quartic polynomials of the form ax⁴ + bx³ + cx² + dx + e = 0, and QuarticSolver.test, a class with tests for quartic solvers.

The Ferrari-Cardano method solves a related cubic equation to find a factor which breaks the quartic equation into two quadratic equations, which are then solved for the final roots.

The QuarticSolver test file contains a brief abstract framework for testing quartic functions, and a specific subclass FerrariSolverTest which plugs in FerrariSolver for those tests. Most of the tests can then be easily reused to test an alternative quartic solver, with a different subclass.

… required higher precision than tolerance allowed
…fixed backwards iterator, fixed a couple of arithmetic bugs
@github-actions
Copy link

github-actions bot commented Oct 6, 2025

Test summary

 5 750 files   9 236 suites   18m 11s ⏱️
 2 088 tests  2 062 ✅  26 💤 0 ❌
32 224 runs  32 095 ✅ 129 💤 0 ❌

Results for commit 58bf4c5.

♻️ This comment has been updated with latest results.

@sethrj sethrj requested a review from elliottbiondo October 6, 2025 12:43
@sethrj sethrj requested review from Copilot and sethrj October 6, 2025 12:43
@sethrj sethrj added enhancement New feature or request orange Work on ORANGE geometry engine labels Oct 6, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds a Ferrari-Cardano method implementation for solving quartic polynomial equations and a comprehensive test suite. The implementation is designed to find positive, real, non-zero roots for quartic functions used in geometric surface calculations.

Key changes include:

  • Implementation of the Ferrari-Cardano algorithm in FerrariSolver class
  • Comprehensive test framework for quartic solvers with abstract base class design
  • Addition of CMake preset configurations for development workflows

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
src/orange/surf/detail/FerrariSolver.hh Core implementation of Ferrari-Cardano quartic solver with cubic and quadratic utility functions
test/orange/surf/detail/QuarticSolver.test.cc Abstract test framework and specific Ferrari solver tests covering various root scenarios
test/orange/CMakeLists.txt Registration of new quartic solver test
scripts/cmake-presets/.json CMake preset configurations for development builds

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 93.22034% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.92%. Comparing base (8db575e) to head (58bf4c5).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
src/corecel/math/FerrariSolver.hh 93.22% 4 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2010      +/-   ##
===========================================
+ Coverage    84.89%   84.92%   +0.02%     
===========================================
  Files         1273     1274       +1     
  Lines        44667    44787     +120     
  Branches     16765    16638     -127     
===========================================
+ Hits         37922    38035     +113     
+ Misses        4933     4763     -170     
- Partials      1812     1989     +177     
Files with missing lines Coverage Δ
src/corecel/math/FerrariSolver.hh 93.22% <93.22%> (ø)

... and 135 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@elliottbiondo
Copy link
Contributor

For posterity, @osanstrong and I decided that it's better to switch to using the Numerical Recipes cubic solver because 1) it's more citable, 2) it's whats used with Algorithm 1010, 3) it's pretty similar to what we originally had, so it's not a big change.

Owen has already updated this MR accordingly.

@osanstrong your new citation key is press-numericalrecipes-2007

Copy link
Contributor

@elliottbiondo elliottbiondo left a comment

Choose a reason for hiding this comment

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

I think this is basically ready to merge: just a few minor comments

Copy link
Member

@sethrj sethrj left a comment

Choose a reason for hiding this comment

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

Looks great Owen! Just a few final comments based on the changes.

@sethrj
Copy link
Member

sethrj commented Dec 5, 2025

@elliottbiondo I think this is ready to merge!

@sethrj
Copy link
Member

sethrj commented Dec 5, 2025

@osanstrong @elliottbiondo Since we've made the solver more generic, I've moved it to its rightful place in corecel/math. I also made a couple of small adjustments to the documentation so that the key capabilities appear in the user docs. Thanks again!

@sethrj sethrj dismissed elliottbiondo’s stale review December 5, 2025 13:43

Changes have been addressed!

This reverts commit 303a17b.
@sethrj
Copy link
Member

sethrj commented Dec 5, 2025

Copy link
Contributor

@elliottbiondo elliottbiondo left a comment

Choose a reason for hiding this comment

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

These changes look good to me. Let's wait for @osanstrong to take a look before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request orange Work on ORANGE geometry engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants