Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add polynomial type support to generics Introduced a new polynomial_type subdirectory with Indeterminate and Monomial classes. Updated CMakeLists to include the new directory and source files, enhancing the generics module with polynomial capabilities. * Update Monomial class with operator overloads and functions Refactored Monomial class to include new operator overloads and additional member functions for improved functionality. Simplified the 'Indeterminate' constructor and modified stream operators to use the generics namespace. * Fix typo in monomial.cpp header comment Corrected the accidental removal of comment characters which unintentionally disrupted the header section of the file. This change ensures the header comment remains properly formatted. * Remove extraneous characters from comment header Deleted unnecessary characters "zr" from the comment header in monomial.cpp to clean up the file. This change helps maintain code readability and prevents potential confusion for future developers. * Add mpq string representation and hash functions Introduced `mpq_display_rep` for generating string representations of GMP rational numbers and `mpq_hash` for computing their hash values. Refactored `rational_type.cpp` to utilize these new functions, enhancing code modularity and clarity. * Add Polynomial class with arithmetic operations Introduced a new `Polynomial` class along with its header and source files. Implemented essential polynomial arithmetic operations including addition, subtraction, multiplication, and division. Updated the CMakeLists to include the new files, and annotated relevant methods with `RPY_NO_DISCARD` in `monomial.h`. * Refactor index method and add monomial tests Refactored the `index` method in `indeterminate.h` to use `integer_mask` directly for improved clarity and correctness. Added comprehensive unit tests for `Monomial` in the new file `test_monomial.cpp` and updated `CMakeLists.txt` to include these tests when building. * Add unit tests for `Indeterminate` and `Polynomial` classes Implemented GTest-based unit tests for the `Indeterminate` class, verifying constructors, operators, and hash functionality. Additionally, created a test file for the `Polynomial` class and updated the CMakeLists.txt to include these new tests. * Add degree method and various enhancements to Polynomial Introduced a `degree` method to compute the degree of a polynomial. Added additional constructors and utility functions, cleaned up headers, * Add constructor and empty check to Monomial class Introduce a new constructor to initialize Monomial with a prefix, index, and degree. Implement a method to check if the Monomial data is empty, enhancing class usability. * Add unit tests for polynomial operations Implement unit tests for default value, display, addition, subtraction, multiplication, and division of Polynomial class. These tests ensure proper functionality and correctness of polynomial operations. * Add constructors and stream operator to Polynomial class Implemented default copy and move constructors for the Polynomial class to ensure proper object management. Also added an overloaded stream operator for easy printing of Polynomial objects. * Refactor polynomial multiplication test logic. Changed the test case to multiply into a separate result polynomial instead of in-place. The expected result polynomial has been updated to reflect correct multiplication values. Adjusted assertions to compare the updated result correctly. * Add tests for polynomial equality and hashing This commit introduces new test cases for validating polynomial equality and hashing functionality. The tests ensure that polynomials are compared correctly and that their hash values are consistent as expected. This improves reliability and correctness in polynomial-related operations. * Add polynomial type handling files Introduced new header and source files for polynomial types, including arithmetic, comparison, and number traits. Modified the CMakeLists to include these files and added tests for the new polynomial type functionalities in a dedicated test suite. * Refactor `poly_div_inplace` to use `mpq_srcptr` Updated the `poly_div_inplace` function to accept `mpq_srcptr` directly instead of `dtl::RationalCoeff`. This change improves clarity and efficiency by eliminating unnecessary indirection. Additionally, provided an inline function for backward compatibility with existing `dtl::RationalCoeff` usage. * Extend PolynomialArithmetic with ArithmeticTrait methods Implemented the unsafe_add_inplace, unsafe_sub_inplace, unsafe_mul_inplace, and unsafe_div_inplace methods in PolynomialArithmetic, inheriting from ArithmeticTrait. Added necessary includes and assertions to ensure robustness of operations. This enhances polynomial arithmetic capabilities with runtime checks and debug assertions. * Add polynomial_types.cpp to the build configuration This commit includes polynomial_types.cpp in the list of source files in CMakeLists.txt. This change ensures that the polynomial types are compiled and linked properly in the build process. * Refactor `polynomial_type.cpp` for improved readability. Condensed single-line function bodies for better clarity. Updated `basic_properties` to reflect accurate properties. These changes enhance code maintainability without altering functionality. * Update test assertions in `test_polynomial_type.cpp`. Revised test expectations to match updated polynomial representation and improved formatting for properties assertions. These changes make tests more accurate and improve code maintainability without changing core functionality. * Implement PolynomialType constructor and specialized traits Added a constructor to PolynomialType to initialize arithmetic, comparison, and number traits. Updated `get_builtin_trait` method to return these specialized traits based on the given trait ID. * Update tests for PolynomialType operations and functions Modified unit tests to check that division and FromRational functions are supported by PolynomialType. Changed assertions from `EXPECT_FALSE` to `EXPECT_TRUE` to reflect current implementation capabilities. * Add ctre and fmt dependencies Included ctre and fmt packages in CMakeLists.txt for library linkage. Updated vcpkg.json to reflect new dependency versions for consistent package management. * Change base_type to uint64_t and enhance parser functionality. Updated the Indeterminate class to use uint64_t for base_type. Added clear and emplace methods to Monomial. Enhanced PolynomialType parsing with support for integers and rational coefficients, and restored parse_from_string. * Change base_type to uint64_t and enhance parser functionality. Updated the Indeterminate class to use uint64_t for base_type. Added clear and emplace methods to Monomial. Enhanced PolynomialType parsing with support for integers and rational coefficients, and restored parse_from_string. * Add test for parsing mixed monomial with powers Introduce a new unit test to ensure the PolynomialType can correctly parse and display mixed monomials with powers. This helps maintain the accuracy and robustness of polynomial representation. * Add missing <numeric> include and remove unused <iostream> The <numeric> header was added to monomial.cpp to utilize numeric algorithms. The unused <iostream> header was removed from polynomial_type.cpp to clean up the codebase and improve maintainability.
- Loading branch information