Put real parameter names in the stubs#1
Draft
jonathanberthias wants to merge 16 commits intoenable-stubtestfrom
Draft
Put real parameter names in the stubs#1jonathanberthias wants to merge 16 commits intoenable-stubtestfrom
jonathanberthias wants to merge 16 commits intoenable-stubtestfrom
Conversation
* Fix mypy errors * Generate stubtest allowlist * Split expected errors out of todo * Move all stub-related files to stubs folder * Add workflow to check stubs * Simplify file names * Don't run ruff on everything * Revert error added for testing * Clarify requirements for stubtest * Run mypy in CI
* Add test for matrix sum return type Adds a test to ensure that summing a matrix variable along an axis returns a MatrixExpr type instead of MatrixVariable, addressing issue scipopt#1117. * return `MatrixExpr` type * Update CHANGELOG.md * Speed up `MatrixExpr.sum(axis=...)` Enhanced the MatrixExpr.sum method to accept axis as int or tuple, handle keepdims, and provide better error checking for axis bounds. This improves compatibility with numpy's sum behavior and allows more flexible summation over matrix expressions. * Test `MatrixExpr.sum(axis=...)` Removed n=200 from the sum performance test to limit test size. Added additional performance assertions comparing np.ndarray.sum and the optimized sum method for matrix variables. * Test `MatrixExpr.sum(axis=tuple(range(ndim))` Renamed test_matrix_sum_argument to test_matrix_sum_axis and updated tests to use explicit axis arguments in sum operations. This clarifies the behavior when summing over all axes and improves test coverage for axis handling. * Refactor MatrixExpr.sum axis handling with numpy utility Replaces manual axis validation and normalization in MatrixExpr.sum with numpy's normalize_axis_tuple for improved reliability and code clarity. Updates type hints and simplifies logic for summing across all axes. * Add tests for matrix sum error Added tests to verify error handling in matrix variable sum operations for invalid axis types, out-of-range values, and duplicate axes. * Add tests for matrix sum with keepdims parameter Introduces test cases to verify the shape of matrix variable sums when using the keepdims argument, ensuring correct behavior for both full and axis-specific summation. * call `.sum` via positional argument Replaces the use of the 'axis' keyword argument with a positional argument in the z.sum() method call to align with the expected function signature. * Refactor sum method to use np.apply_along_axis Replaces np.fromiter with np.apply_along_axis for summing along specified axes in MatrixExpr. This simplifies the code and improves readability. * Directly test the `.sum` result Added a comment to clarify the purpose of the test_matrix_sum_axis function, indicating it compares the result of summing a matrix variable after optimization. * Update CHANGELOG.md * Expand docstring for MatrixExpr.sum method The docstring for the MatrixExpr.sum method was updated to provide detailed information about parameters, return values, and behavior, improving clarity and alignment with numpy conventions. * Clarify MatrixExpr.sum docstring and note quicksum usage Updated the docstring for MatrixExpr.sum to specify that it uses quicksum for speed optimization instead of numpy.ndarray.sum. Added a detailed note explaining the difference between quicksum (using __iadd__) and numpy's sum (using __add__). * Split up two costing time test cases Renamed the existing performance test to clarify it tests the case where axis is None. Added a new test to measure performance when summing along a specific axis. * Supports numpy 1.x Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Supports Python 3.8 * Simplify a bit Refactored the sum method in MatrixExpr to clarify axis typing and simplify the application of np.apply_along_axis. The new implementation improves readability and maintains the intended behavior. * suggestion --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Joao-Dionisio <up201606210@up.pt> Co-authored-by: João Dionísio <57299939+Joao-Dionisio@users.noreply.github.com>
aa28664 to
0d9e6e3
Compare
* first attempt at script * wrapped SCIPaddClique * remove clique
This file contains hidden or 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
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.
(stacked on top of scipopt#1141)
(A)I wrote a script to process the output of
stubtestto input the correct parameter names to all methods. This reduces the number of remaining "TODO" items to just 3 🎉Changes:
...default if the parameters have default valuesIncomplete