Skip to content
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

Merged
merged 18 commits into from
May 29, 2020
Merged

[Lang] ti.cross now supports 2D vectors #1068

merged 18 commits into from
May 29, 2020

Conversation

Eydcao
Copy link
Contributor

@Eydcao Eydcao commented May 28, 2020

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:

  • test if the function is working well
  • improve the test for linear algebra
  • mention cross 2d in vector doc

[Click here for the format server]

@archibate archibate changed the title [Lang][Doc] make cross product work for 2D vectors [Lang] make cross product work for 2D vectors May 28, 2020
Copy link
Collaborator

@archibate archibate left a 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.


else:
raise Exception(
"CrossProduct only supports 3D vector and 2D vector")
Copy link
Collaborator

@archibate archibate May 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"CrossProduct only supports 3D vector and 2D vector")
"cross product is only supported between 3D or 2D vectors")

Copy link
Contributor Author

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~

Copy link
Collaborator

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]>
@archibate archibate requested a review from taichi-gardener May 28, 2020 07:44
@archibate
Copy link
Collaborator

Btw, would you like to also update this usage in docs/vector.rst?

@Eydcao
Copy link
Contributor Author

Eydcao commented May 28, 2020

Btw, would you like to also update this usage in docs/vector.rst?

No problem I will add it to the todo list here

@yuanming-hu yuanming-hu mentioned this pull request May 28, 2020
18 tasks
@archibate archibate added the GAMES201 GAMES 201 students' wishlist label May 29, 2020
@Eydcao Eydcao marked this pull request as ready for review May 29, 2020 03:38
update to underline code style

Co-authored-by: 彭于斌 <[email protected]>
Eydcao and others added 2 commits May 29, 2020 12:05
include var name

Co-authored-by: 彭于斌 <[email protected]>
avoid making people confused about return type of cross(vec2d,vec2d)

Co-authored-by: 彭于斌 <[email protected]>
@archibate archibate requested review from yuanming-hu and k-ye May 29, 2020 05:24
Copy link
Member

@yuanming-hu yuanming-hu left a 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.

Eydcao and others added 5 commits May 29, 2020 22:16
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]>
@yuanming-hu yuanming-hu changed the title [Lang] make cross product work for 2D vectors [Lang] Make cross product work for 2D vectors May 29, 2020
@yuanming-hu yuanming-hu changed the title [Lang] Make cross product work for 2D vectors [Lang] ti.cross now supports 2D vectors May 29, 2020
Copy link
Member

@yuanming-hu yuanming-hu left a 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

@yuanming-hu yuanming-hu merged commit 2d4ade4 into taichi-dev:master May 29, 2020
@yuanming-hu yuanming-hu mentioned this pull request May 31, 2020
@Eydcao Eydcao deleted the cross2D branch June 5, 2020 05:20
@Eydcao
Copy link
Contributor Author

Eydcao commented Jun 10, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GAMES201 GAMES 201 students' wishlist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants