-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overhaul polynomial type #172
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
# Conflicts: # platform/src/generics/CMakeLists.txt
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.
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.
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.
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.
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`.
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.
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.
Introduced a `degree` method to compute the degree of a polynomial. Added additional constructors and utility functions, cleaned up headers,
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.
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.
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.
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.
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.
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.
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.
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.
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.
Condensed single-line function bodies for better clarity. Updated `basic_properties` to reflect accurate properties. These changes enhance code maintainability without altering functionality.
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.
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.
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.
Included ctre and fmt packages in CMakeLists.txt for library linkage. Updated vcpkg.json to reflect new dependency versions for consistent package management.
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.
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.
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.
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds basic support for polynomial coefficients. This is part of the generic values overhaul outlined in #168.
To support the string parsing, I've brought in CTRE (compile time regular expressions) to avoid using
<regex>
which is dreadfully slow and tricky to use. I've also brought infmt
because it will be useful.