-
Notifications
You must be signed in to change notification settings - Fork 26
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
Remove polynomial
and refactor core
submodules
#78
Open
bqth29
wants to merge
14
commits into
main
Choose a base branch
from
cleaning/remove-polynomial-package
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
bqth29
added
the
refactoring
Existing code is refactored (no new feature, no breaking change)
label
Sep 28, 2024
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #78 +/- ##
===========================================
- Coverage 100.00% 97.03% -2.97%
===========================================
Files 36 32 -4
Lines 1600 1449 -151
===========================================
- Hits 1600 1406 -194
- Misses 0 43 +43
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Refactor `core` module
bqth29
changed the title
Remove
Remove Sep 29, 2024
polynomial
submodulepolynomial
and refactor core
submodules
This was referenced Sep 29, 2024
bqth29
added
bug
Something isn't working
feature
New feature
breaking change
A breaking change is brought by this PR
labels
Sep 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking change
A breaking change is brought by this PR
bug
Something isn't working
feature
New feature
refactoring
Existing code is refactored (no new feature, no breaking change)
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.
💬 Pull Request Description
The
polynomial
was becoming redundant and less relevant as other libraries like SymPy allow polynomial manipulation. As it is a bit out of the scope of this package, it makes sense removing it.QuadraticPolynomial
s can still be instanciated from SymPy's Polys or tensors/arrays, but they no longer inherit fromPolynomial
which means that all the data coherence checks are now carried in the__init__
method of theQuadraticPolynomial
class.This cleaning was carried out alongside a refactoring of the
core
module that received new responsabilities. For a better alignment of theIsing
andQuadraticPolynomial
classes, two main changes were introduced:Ising
,QuadraticPolynomial
and the mainsimulated_bifurcation
module are now keyword-only, which replaces PR Use keyword-only parameters for backend optimization functions + do not use default value for optimization domain #53QuadraticPolynomial
as well as theto_ising
method now require a dtype and a device to separate the model's dtype (which can be any int or float dtype) and the computation dtype which must either betorch.float32
ortorch.float64
; this replaces PR Force backend computation dtype to float #64 and fixes SB Optimizer computation dtype v. Model dtype #41Finally, the
domain
argument of the optimization functions no longer has a default value.✔️ Check list
Before you open the pull request, make sure the following requirements are met.
🚀 New features
None.
🐞 Bug fixes
When an Ising model was turned into a single tensor using the
as_simulated_bifurcation_tensor
method while it had linear terms,Ising.J
was passed into the block matrix instead of its null-diagonal and symmetrized version. This was fixed.📣 Supplementary information
The instances of
QuadraticPolynomial
now have 4 key properties:quadratic
: square 2-dimensional tensor that gathers all the quadratic coefficientslinear
: 1-dimensional tensor that gathers all the linear coefficientsbias
: 0-dimensional tensor that contains the bias of the polynomialpoly
: SymPy polynomial representation of the QuadraticPolynomial (stored for an easier visualization, manipulation)Note that either the
QuadraticPolynomial
is initialized with tensors and then the Poly is created, or inversely, it is initialized from a Poly and the coefficient tensors are generated afterwards.Parametrized tests were introduced to cover the
core
module. They allow the tests to be run using different dtypes and devices (if the computer has a CUDA GPU). Draft PR #61 was closed because this PR replaces it.