Skip to content
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

Improvements and Fixes in rootsur.lib #1204

Merged
merged 2 commits into from
Jan 30, 2024
Merged

Improvements and Fixes in rootsur.lib #1204

merged 2 commits into from
Jan 30, 2024

Conversation

RickRischter
Copy link
Contributor

  1. Variable Reference Correction in Loop:
    I modified a for loop to correct the variable reference. Previously, the loop iterated over p[i], but it has been changed to monic[i] to ensure we are accessing the correct element. This change is crucial, especially for handling polynomials with leading coefficients significantly less than 1, such as in cases like p = (x^3)/10-x-1. The previous code could lead to inaccuracies in such scenarios.

  2. Proper Calculation of nroots in sturm Routine:
    The nroots variable was not initialized, potentially leading to incorrect values in calculations. I have kept the same structure but ensured that the calculation now reflects the correct value.

  3. Removal of Unused Static Routines:
    I removed the static routines search and D, which were not used elsewhere in the code.

  4. Removal of searchnot Routine Function:
    Since the searchnot function was only used by the D routine, which has been removed, I also chose to remove searchnot to simplify the code.

  5. Cleanup of Old Code Comments:
    I deleted some comments of unused code in the sturmha routine. These comments appear to be remnants of older versions, and their removal makes the code cleaner and easier to understand.

I believe these changes contribute to the efficiency, clarity, and maintainability of the code in rootsur.lib. I am available to discuss these modifications further and to make adjustments as needed.

1) Variable Reference Correction in Loop:
I modified a for loop to correct the variable reference. Previously, the loop iterated over p[i], but it has been changed to monic[i] to ensure we are accessing the correct element. This change is crucial, especially for handling polynomials with leading coefficients significantly less than 1, such as in cases like p = (x^3)/10-x-1. The previous code could lead to inaccuracies in such scenarios.

2) Proper Calculation of nroots in sturm Routine:
The nroots variable was not initialized, potentially leading to incorrect values in calculations. I have kept the same structure but ensured that the calculation now reflects the correct value.

3) Removal of Unused Static Routines:
I removed the static routines search and D, which were not used elsewhere in the code. 

4) Removal of searchnot Routine Function:
Since the searchnot function was only used by the D routine, which has been removed, I also chose to remove searchnot to simplify the code.

5) Cleanup of Old Code Comments:
I deleted some comments of unused code in the sturmha routine. These comments appear to be remnants of older versions, and their removal makes the code cleaner and easier to understand.

I believe these changes contribute to the efficiency, clarity, and maintainability of the code in rootsur.lib. I am available to discuss these modifications further and to make adjustments as needed.
 Improvements and Fixes in rootsur.lib
@hannes14
Copy link
Member

hannes14 commented Jan 30, 2024

Thanks

@hannes14 hannes14 merged commit 6661730 into Singular:spielwiese Jan 30, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants