Skip to content

Foundation Classes - Modernize TKMath with new packages#944

Merged
dpasukhi merged 6 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:math_modernize
Dec 22, 2025
Merged

Foundation Classes - Modernize TKMath with new packages#944
dpasukhi merged 6 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:math_modernize

Conversation

@dpasukhi
Copy link
Member

This commit introduces several new packages and corresponding tests to the TKMath toolkit, enhancing its mathematical capabilities. Key changes include:

  1. New Packages:

    • Added MathUtils, MathPoly, MathLin, MathOpt, MathRoot, and MathSys packages, each containing essential mathematical functions and algorithms.
  2. Integration of Tests:

    • Comprehensive test files for each new package have been created, ensuring the correctness and reliability of the implemented algorithms.
  3. Documentation:

    • README files for each package have been added, providing an overview and usage instructions.

This commit introduces several new packages and corresponding tests to the TKMath toolkit, enhancing its mathematical capabilities. Key changes include:

1. **New Packages**:
   - Added `MathUtils`, `MathPoly`, `MathLin`, `MathOpt`, `MathRoot`, and `MathSys` packages, each containing essential mathematical functions and algorithms.

2. **Integration of Tests**:
   - Comprehensive test files for each new package have been created, ensuring the correctness and reliability of the implemented algorithms.

3. **Documentation**:
   - README files for each package have been added, providing an overview and usage instructions.

These additions aim to provide a robust foundation for mathematical operations within the OCCT framework, improving both functionality and user experience.
@dpasukhi dpasukhi added this to the Release 8.0 milestone Dec 20, 2025
@dpasukhi dpasukhi requested a review from Copilot December 20, 2025 21:04
@dpasukhi dpasukhi self-assigned this Dec 20, 2025
@dpasukhi dpasukhi added 2. Enhancement New feature or request 1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code labels Dec 20, 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 modernizes the TKMath toolkit by introducing six new packages with comprehensive mathematical algorithms and test coverage. The changes enhance OCCT's mathematical capabilities with modern C++17+ implementations of polynomial solvers, linear algebra, optimization, root finding, numerical integration, and nonlinear systems.

Key Changes

  • Added six new packages: MathUtils, MathPoly, MathLin, MathOpt, MathRoot, MathSys, and MathInteg
  • Implemented modern template-based algorithms with consistent result structures and error handling
  • Added comprehensive test files for all new packages

Reviewed changes

Copilot reviewed 55 out of 82 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/FoundationClasses/TKMath/MathRoot/MathRoot_All.hxx Root finding with null interval detection
src/FoundationClasses/TKMath/MathRoot/FILES.cmake CMake configuration for MathRoot package
src/FoundationClasses/TKMath/MathPoly/README.md Documentation for polynomial solvers
src/FoundationClasses/TKMath/MathPoly/MathPoly_Quartic.hxx Quartic equation solver using Ferrari's method
src/FoundationClasses/TKMath/MathPoly/MathPoly_Quadratic.hxx Linear and quadratic equation solvers
src/FoundationClasses/TKMath/MathPoly/MathPoly_Cubic.hxx Cubic equation solver using Cardano's method
src/FoundationClasses/TKMath/MathPoly/FILES.cmake CMake configuration for MathPoly package
src/FoundationClasses/TKMath/MathOpt/README.md Documentation for optimization algorithms
src/FoundationClasses/TKMath/MathOpt/MathOpt_Uzawa.hxx Constrained least squares solver
src/FoundationClasses/TKMath/MathOpt/MathOpt_Powell.hxx Powell's conjugate direction method
src/FoundationClasses/TKMath/MathOpt/MathOpt_PSO.hxx Particle swarm optimization
src/FoundationClasses/TKMath/MathOpt/MathOpt_Newton.hxx Newton's method with Hessian
src/FoundationClasses/TKMath/MathOpt/MathOpt_GlobOpt.hxx Global optimization strategies
src/FoundationClasses/TKMath/MathOpt/MathOpt_FRPR.hxx Fletcher-Reeves-Polak-Ribiere conjugate gradient
src/FoundationClasses/TKMath/MathOpt/MathOpt_Brent.hxx Brent's method for 1D minimization
src/FoundationClasses/TKMath/MathOpt/MathOpt_BFGS.hxx BFGS quasi-Newton optimization
src/FoundationClasses/TKMath/MathOpt/FILES.cmake CMake configuration for MathOpt package
src/FoundationClasses/TKMath/MathLin/README.md Documentation for linear algebra solvers
src/FoundationClasses/TKMath/MathLin/MathLin_SVD.hxx Singular value decomposition
src/FoundationClasses/TKMath/MathLin/MathLin_LeastSquares.hxx Least squares solvers with multiple methods
src/FoundationClasses/TKMath/MathLin/MathLin_Jacobi.hxx Jacobi eigenvalue decomposition
src/FoundationClasses/TKMath/MathLin/MathLin_Householder.hxx QR decomposition using Householder reflections
src/FoundationClasses/TKMath/MathLin/MathLin_Gauss.hxx LU decomposition with partial pivoting
src/FoundationClasses/TKMath/MathLin/MathLin_EigenSearch.hxx QL algorithm for tridiagonal matrices
src/FoundationClasses/TKMath/MathLin/MathLin_Crout.hxx Crout LDL^T decomposition for symmetric matrices
src/FoundationClasses/TKMath/MathLin/FILES.cmake CMake configuration for MathLin package
src/FoundationClasses/TKMath/MathInteg/README.md Documentation for numerical integration
src/FoundationClasses/TKMath/MathInteg/MathInteg_Set.hxx Vector-valued function integration
src/FoundationClasses/TKMath/MathInteg/MathInteg_Multiple.hxx Multi-dimensional Gauss integration
src/FoundationClasses/TKMath/MathInteg/MathInteg_Kronrod.hxx Gauss-Kronrod quadrature with error estimation
src/FoundationClasses/TKMath/MathInteg/MathInteg_Gauss.hxx Gauss-Legendre quadrature
src/FoundationClasses/TKMath/MathInteg/FILES.cmake CMake configuration for MathInteg package
src/FoundationClasses/TKMath/GTests/FILES.cmake Added test files for all new packages

Updated mathematical comments in various test files to use the notation "~=" instead of "≈" for approximations. This change enhances consistency across the codebase and improves readability. Affected files include MathInteg_Comparison_Test.cxx, MathInteg_Test.cxx, MathOpt_NDim_Test.cxx, MathRoot_Multiple_Test.cxx, and MathRoot_Test.cxx.
…trix operations. This change simplifies the code by eliminating an unused function, enhancing maintainability.
…y with root count. Changed loop variable from size_t to int for better alignment with expected data types.
- Modified MathInteg_GaussTest to reflect the correct unsupported order (9) and updated comments to list all supported orders (3, 4, 5, 6, 7, 8, 10, 15, 21, 31).
- Enhanced MathInteg_Gauss.hxx and MathInteg_Kronrod.hxx documentation to include the new supported quadrature points and weights.
- Added new Gauss-Legendre points and weights for orders 4, 6, 8, 10, and 31 in MathUtils_Gauss.hxx, improving the integration capabilities of the library.
@dpasukhi dpasukhi marked this pull request as ready for review December 22, 2025 16:47
@dpasukhi dpasukhi merged commit 0ad3a1a into Open-Cascade-SAS:IR Dec 22, 2025
24 checks passed
@dpasukhi dpasukhi deleted the math_modernize branch December 22, 2025 16:52
@github-project-automation github-project-automation bot moved this from Todo to Done in Maintenance Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code 2. Enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants