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

Add commutative multiplication on primitive scalar types for Vectors #116

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

sunsided
Copy link
Contributor

This one partially addresses #105 and the implementation is somewhat debatable. In general, commutative operations (e.g. Mul<C> for Vector3d<C> and Mul<Vector3d<C>> for C) cannot be implemented due to trait implementation coherence rules.

Given that the crate exports some standard types such as F32x2, I16x3 etc. it is at least possible to define commutative math for these specific implementations, and this is what this PR does.

@sunsided sunsided changed the title Add commutative operations on primitive types Add commutative multiplication on primitive scalar types for Vectors Jul 17, 2024
@sunsided
Copy link
Contributor Author

I did not add scalar Add here as it didn't exist before and is mathematically meaningless.

@tarcieri tarcieri merged commit 8533f2d into tarcieri:main Sep 5, 2024
11 checks passed
@sunsided sunsided deleted the feature/right-hand-side-ops branch September 5, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants