Fix comparison of translation parts in MSG type identification#382
Fix comparison of translation parts in MSG type identification#382lan496 merged 5 commits intospglib:developfrom
Conversation
|
@atztogo I am not sure how to name the function |
ef573f2 to
50852f1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #382 +/- ##
===========================================
+ Coverage 83.80% 83.84% +0.04%
===========================================
Files 24 24
Lines 8167 8172 +5
===========================================
+ Hits 6844 6852 +8
+ Misses 1323 1320 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Thanks for your fix @lan496.
No idea.
D means double. You can change if you want. |
@atztogo Thank you. I think no need to change the function name. |
When we compare two translation parts, we consider they are equal when the displacements is zero module 1. For this comparison, `mat_Dmod1` is not appropriate because, for example, mat_Dmod1(0 - eps) = 1 - eps for eps > 0. This commit adds a new function `mat_rem1`, which is similar to numpy's fmod. For the example, abs(mat_rem1(0 - eps)) = abs(-eps) = eps gives the smallest displacement.
Co-authored-by: Cristian Le <[email protected]>
Fixes: #381
When we compare two translation parts, we consider they are equal when the displacement is zero in module 1. For this comparison,
mat_Dmod1is not appropriate because, for example, mat_Dmod1(0 - eps) = 1 - eps for eps > 0.This commit adds a new function
mat_rem1, which is similar to numpy's fmod. For the example, abs(mat_rem1(0 - eps)) = abs(-eps) = eps gives the smallest displacement.