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

component_min and component_max #619

Open
mandeep opened this issue Jul 18, 2019 · 2 comments · May be fixed by #665
Open

component_min and component_max #619

mandeep opened this issue Jul 18, 2019 · 2 comments · May be fixed by #665
Labels
enhancement good first issue Good first issue for newcomers. P-medium Medium priority

Comments

@mandeep
Copy link

mandeep commented Jul 18, 2019

I had to write my own min and max functions that take in two &Vector3 and compute a new vector containing the minimum components of the two vectors (and the max for the max function). Is there something like this already in nalgebra? max/min and partial_max/partial_min did not seem to do what I want. If this is something that would be beneficial to the library I would be happy to add it.

@sebcrozet
Copy link
Member

Hi! There are currently two ways of doing this in nalgebra:

  • Using zip_map, i.e., vector1.zip_map(&vector2, |a, b| a.min(b))
  • nalgebra::inf(&a, &b) for componentwise min or nalgebra::sup(&a, &b) for componentwise max. The inf and sup operations are what is called the supremum and the infimum.

I agree it wouldn't hurt to have component_min and component_max too for clarity (in the base/componentwise.rs file).

@mandeep
Copy link
Author

mandeep commented Jul 18, 2019

Thanks! I'll get on it.

@sebcrozet sebcrozet added enhancement good first issue Good first issue for newcomers. P-medium Medium priority labels Aug 15, 2019
@mandeep mandeep linked a pull request Oct 21, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Good first issue for newcomers. P-medium Medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants