-
Notifications
You must be signed in to change notification settings - Fork 867
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
Avoid using full equality (==
) to compare float, avoid assert_array_equal
compare float array
#4159
Open
DanielYang59
wants to merge
56
commits into
materialsproject:master
Choose a base branch
from
DanielYang59:4158-fix-eq-check
base: master
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.
+1,236
−1,150
Open
Changes from 15 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
588ceb8
replace some float equality check
DanielYang59 0b97cb0
explicit encoding
DanielYang59 82f3431
charge is also float
DanielYang59 389c59b
enhance types
DanielYang59 1d22fee
access gcd via math namespace as math is already imported
DanielYang59 84e3b70
put dunder method to top
DanielYang59 ea6089e
fix typo
DanielYang59 e264890
tweak _proj implementation
DanielYang59 95a6192
Merge branch 'master' into 4158-fix-eq-check
DanielYang59 e431882
support array like
DanielYang59 8f30f13
Merge branch '4158-fix-eq-check' of https://github.com/DanielYang59/p…
DanielYang59 e6ea809
add arg and return type
DanielYang59 bf0ff16
tweak type
DanielYang59 5c9992e
avoid more == for float comparison
DanielYang59 4920eb7
replace some == in test, more left to do
DanielYang59 f343503
replace more in core test
DanielYang59 808c495
replace more in test
DanielYang59 c0692dd
replace even more
DanielYang59 48e0ead
replace last batch
DanielYang59 cdff78d
clean up assert approx
DanielYang59 7eb7caa
replace pytest.approx with approx
DanielYang59 7745458
also fix membership check
DanielYang59 24edca5
replace some equality check of list
DanielYang59 089e3d2
replace some sequences
DanielYang59 20abc2a
fix test
DanielYang59 4871d1b
replace float comparison as dict
DanielYang59 7a8c148
fix test
DanielYang59 1137a72
replace more float compare, mostly for VASP
DanielYang59 88aad8b
fix test
DanielYang59 d12a07b
fix approx in condition block
DanielYang59 4552881
replace sci notation
DanielYang59 30e0f66
suppress buggy ruff sim300
DanielYang59 4f0ff82
number_of_permutations to int
DanielYang59 24e81d2
revert change for formula_double_format, in favor of another PR
DanielYang59 8ef27dc
c_indices seems to be int
DanielYang59 5ac947d
use sci notation for crazily large int
DanielYang59 2bde949
simplify numpy.testing usage
DanielYang59 16fa94d
set tol as pos arg
DanielYang59 300dc30
avoid array equal for list of str
DanielYang59 d4309b7
assert_array_equal should not be used on float array
DanielYang59 8cbfcfc
fix module level var name
DanielYang59 dbe8659
more assert_array_equal on complex number
DanielYang59 5ff4248
simplify approx on dict value
DanielYang59 1f01241
avoid module level var when it's used only 3 times
DanielYang59 32929d4
pytext.approx to approx
DanielYang59 16dbec3
fix approx on nested dict
DanielYang59 3df99ab
avoid unnecessary convert to np.array
DanielYang59 fd573cd
array_equal to all close for float array
DanielYang59 e46dbf9
assert all close for float array
DanielYang59 857581b
capital class attrib is treated as constant
DanielYang59 7787a25
Merge remote-tracking branch 'upstream/master' into 4158-fix-eq-check
DanielYang59 5700f3b
Merge remote-tracking branch 'upstream/master' into 4158-fix-eq-check
DanielYang59 79d3ffc
Merge branch 'master' into 4158-fix-eq-check
DanielYang59 1724f9e
Merge remote-tracking branch 'upstream/master' into 4158-fix-eq-check
DanielYang59 e7e5209
Merge branch 'master' into 4158-fix-eq-check
DanielYang59 626c3fb
Merge branch 'master' into 4158-fix-eq-check
DanielYang59 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new implementation is slightly more readable (personal taste) and gives ~4x speedup, reference (the following is a project to b):
Test script (by GPT):