-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Lang] ti.cross now supports 2D vectors #1068
Conversation
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.
Thanks for the implementation! LGTM in general except for a few nits.
python/taichi/lang/matrix.py
Outdated
|
||
else: | ||
raise Exception( | ||
"CrossProduct only supports 3D vector and 2D vector") |
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.
"CrossProduct only supports 3D vector and 2D vector") | |
"cross product is only supported between 3D or 2D vectors") |
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 Yubing,
Thanks for the quick suggestion. But here I assume "cross product is only supported between pairs of 3D vectors or those of 2D vectors" is more accurate. Just in case people are confused about if they ever tried vec2D.cross(vec3D).
What do you think~
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.
Thank for clarify, that sounds like a better expression.
return true scalar instead of a 1x1 mat Co-authored-by: 彭于斌 <[email protected]>
Btw, would you like to also update this usage in |
No problem I will add it to the todo list here |
update to underline code style Co-authored-by: 彭于斌 <[email protected]>
include var name Co-authored-by: 彭于斌 <[email protected]>
avoid making people confused about return type of cross(vec2d,vec2d) Co-authored-by: 彭于斌 <[email protected]>
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.
Awesome! Thank you so much for implementing 2D cross-product and all the tests!
Just a few writing nits. I think this is ready to merge once they are applied.
writing nits Co-authored-by: Yuanming Hu <[email protected]>
another writing nits Co-authored-by: Yuanming Hu <[email protected]>
last writing nit! Co-authored-by: Yuanming Hu <[email protected]>
Last writing nits in vector.rst Co-authored-by: Yuanming Hu <[email protected]>
Capital letter at the beginning of a sentence. Co-authored-by: Yuanming Hu <[email protected]>
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.
LGTM now. Thank you! Btw, "Add suggestion to batch" looks like a nice feature for you: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request
Thanks, I never notice this reply until today when I am about to work on a new PR. This is very helpful! |
Related issue = 1 or 2 of those in #1016
This PR aimed to make ''ti.matrix.cross'' function work for 2D vectors. The result should be a 1*1 matrix(equivalent to scalar. If I were wrong, please feel free to correct). While reading the document for scalar tensor, I also noticed some issues in the rst, so fixed it BTW.
There are two more items todo:
[Click here for the format server]