-
Notifications
You must be signed in to change notification settings - Fork 317
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
[SofaPython] print cleaning + SofaPython quaternion dot product #404
[SofaPython] print cleaning + SofaPython quaternion dot product #404
Conversation
removed comments
Thank you for your pull request! |
[ci-build] |
[ci-build] |
I add a comment to explain the usage of the product
[ci-build] |
1 similar comment
[ci-build] |
@@ -35,6 +35,10 @@ def angle(q): | |||
"""get angle in rad""" | |||
return 2.0* math.acos(re(q)) | |||
|
|||
def product(qa, qb): |
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.
Hi,
I think your "product" function does exactly the same as the "prod" function just below (I checked).
I prefer yours, because of the comment and the fact that the formula is easier to understand/verify.
So maybe we should remove the "prod" function?
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.
Hi,
Python noob here, I see hstack
and numpy
, I think performance issue. @matthieu-nesme could you help?
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.
If it is the same, why adding a new function?
Rather than removing the prod
function (that is used in existing code), I would keep it, but replace its code with the new implem (personnaly I would keep the old implementation as a comment as I find it clearer/closer to the math).
But please be sure that is exactly the same.
Also, rather than using directly the [] operator, I would use re(a), im(b)[0], im(b)[1], im(b)[2]. That way it is easier to read, and independent to the scalar order.
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.
There is a performance issue in both cases:
hstack
+ list (!) is useless and can be replaced byres = np.zeros(4); res[:3] = ...; res[-1] = ...;
- yet the proposed version is probably even less efficient since it does all the computations in python which is waaay slower than letting numpy doing its stuff in C
Ok... Do we all consider that numpy is mandatory when using SOFA with python ? It is just a question so that people are aware of that dependency. But I agree to remove the new implementation if less performant . Erwan will do it |
And added some explanation (readable version)
Yes numpy is a mandatory part of SofaPython which is (almost) a mandatory part of SOFA itself. |
[ci-build] |
This pull request contains few cleaning cout/print/comments.
@ChristianDuriez also added the dot poduct for SofaPython Quaternion
This PR:
Reviewers will merge only if all these checks are true.