-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Float: Fix use of MPZ constructor when unpickling #21996
Float: Fix use of MPZ constructor when unpickling #21996
Conversation
✅ Hi, I am the SymPy bot (v161). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like: This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.9. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
I forgot how monstrous Is it even necessary or useful to use MPZ there? |
I cannot answer this question; first time I look at this code. |
Failing tests:
These failing tests are wrong |
Why are they wrong? Should they not use strings? |
OK, it's actually a bit more complicated than I thought...
|
Indeed, https://trac.sagemath.org/ticket/26756 (merged in Sage 8.2) removed the |
ef19d5c
to
9737261
Compare
OK, here is a version that works with both types of inputs. |
This looks better. We shouldn't break existing ways of constructing Floats, especially if there are tests for it. |
Should I add tests for the version with |
Benchmark results from GitHub Actions Lower numbers are good, higher numbers are bad. A ratio less than 1 Significantly changed benchmark results (PR vs master) Significantly changed benchmark results (master vs previous release) before after ratio
[ed9a550f] [5c2dfe72]
<sympy-1.8^0>
- 1.29±0.02s 172±4ms 0.13 dsolve.TimeDsolve01.time_dsolve
- 9.86±0.03s 5.11±0s 0.52 integrate.TimeIntegrationRisch02.time_doit(100)
- 9.74±0.02s 5.04±0.05s 0.52 integrate.TimeIntegrationRisch02.time_doit_risch(100)
- 83.9±4μs 35.6±2μs 0.42 matrices.TimeDiagonalEigenvals.time_eigenvals
- 98.0±3μs 64.3±4μs 0.66 matrices.TimeMatrixGetItem.time_ImmutableDenseMatrix_getitem
- 107±2μs 63.4±0.6μs 0.60 matrices.TimeMatrixGetItem.time_MutableSparseMatrix_getitem
- 98.3±4μs 62.3±4μs 0.63 solve.TimeMatrixArithmetic.time_dense_add(10, 0)
+ 102±3μs 160±7μs 1.57 solve.TimeMatrixArithmetic.time_dense_add(10, 5)
+ 14.0±0.4μs 22.2±1μs 1.58 solve.TimeMatrixArithmetic.time_dense_add(3, 0)
+ 16.7±0.4μs 37.6±2μs 2.25 solve.TimeMatrixArithmetic.time_dense_add(3, 5)
+ 23.6±0.6μs 47.7±2μs 2.02 solve.TimeMatrixArithmetic.time_dense_add(4, 5)
+ 44.6±1μs 78.1±0.4μs 1.75 solve.TimeMatrixArithmetic.time_dense_add(6, 5)
- 1.49±0.05ms 289±30μs 0.19 solve.TimeMatrixArithmetic.time_dense_multiply(10, 0)
- 53.9±1μs 26.8±0.9μs 0.50 solve.TimeMatrixArithmetic.time_dense_multiply(3, 0)
+ 89.3±3μs 146±7μs 1.64 solve.TimeMatrixArithmetic.time_dense_multiply(3, 5)
- 114±3μs 38.3±1μs 0.34 solve.TimeMatrixArithmetic.time_dense_multiply(4, 0)
- 318±10μs 74.6±3μs 0.23 solve.TimeMatrixArithmetic.time_dense_multiply(6, 0)
- 108±3μs 51.5±3μs 0.48 solve.TimeMatrixOperations.time_det(3, 0)
- 213±9μs 123±3μs 0.58 solve.TimeMatrixOperations.time_det(3, 2)
- 192±5μs 114±10μs 0.59 solve.TimeMatrixOperations.time_det(3, 5)
- 102±3μs 49.4±3μs 0.48 solve.TimeMatrixOperations.time_det_bareiss(3, 0)
- 199±3μs 124±4μs 0.62 solve.TimeMatrixOperations.time_det_bareiss(3, 2)
- 197±4μs 108±2μs 0.55 solve.TimeMatrixOperations.time_det_bareiss(3, 5)
- 106±10μs 47.9±1μs 0.45 solve.TimeMatrixOperations.time_det_berkowitz(3, 0)
- 211±10μs 121±3μs 0.57 solve.TimeMatrixOperations.time_det_berkowitz(3, 2)
- 189±4μs 111±5μs 0.59 solve.TimeMatrixOperations.time_det_berkowitz(3, 5)
+ 893±30μs 1.42±0.08ms 1.59 solve.TimeMatrixOperations.time_det_berkowitz(4, 0)
+ 1.11±0.06ms 2.16±0.2ms 1.94 solve.TimeMatrixOperations.time_det_berkowitz(4, 5)
+ 345±9μs 562±20μs 1.63 solve.TimeMatrixOperations.time_rank(3, 0)
+ 540±40μs 847±20μs 1.57 solve.TimeMatrixOperations.time_rank(4, 0)
+ 143±6μs 218±10μs 1.53 solve.TimeMatrixOperations.time_rref(3, 0)
- 5.53±0.3ms 3.42±0.2ms 0.62 solve.TimeRationalSystem.time_linsolve(10)
Full benchmark results can be found as artifacts in GitHub Actions |
Ready for review |
Some tests failed although they seem unrelated:
Closing and reopening to rerun the tests. |
Looks good. Thanks! |
BTW, the Sage doctest failures for |
Thanks. I'm seeing some new failures like:
Is that perhaps related to this recent Maxima thread? |
Thanks, this is https://trac.sagemath.org/ticket/29966#comment:14 and unrelated to sympy |
@mkoeppe how should we manage this part of the CI going forward? I guess there are going to be continuously failing tests as various projects update. Should we forward reports of these or are they automatically recorded somewhere for sage? If we can see failures related to something changed in sympy that would also need a change in sage then I guess it makes sense to open a sage ticket explaining the change. The example above is one where it seemed clear to me that sympy was not relevant but in general we won't always know if that's the case. |
That's a great and important question.
Reporting as Sage tickets (after a cursory check that there is not already a ticket for it) is always welcome. We do have our automatic test runs but they do require some manual inspection, which is not happening for every beta and every platform that we support.
Currently, So after merging https://trac.sagemath.org/ticket/32420 (probably after the SymPy 1.9 release), the baseline to compare with is https://github.com/sagemath/sage/actions/workflows/tox.yml, which runs automatically on each new beta pushed to |
That sounds good. We'll keep an eye on the sage workflow and see how it goes.
There's a lot of red in that CI... I'm glad we now have proper integration tests for Sage. As it happens I have just today managed to make the rest of SymPy's CI both complete and green but the master commits will still show as red for now because of the sage workflow - I think that's the way it should be though because that is what CI is for. |
Yes, exactly – that's what I meant with "manual inspection" being necessary. It's very complex and we can't just count green checkmarks, unfortunately. But from your side you'll be able to focus just on the two platforms that we put into |
References to other Issues or PRs
Fixes #19690
Brief description of what is fixed or changed
Use
MPZ
constructor as documented.Other comments
Release Notes
Float
from being unpickled in SageMath was fixed.