-
Notifications
You must be signed in to change notification settings - Fork 28
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
Raise AffineError from __rmul__ #48
Comments
After some thought, I think we do want |
I think these right-hand multipliers introduce trouble, since matrix math is not commutative. The Demo, cross-referencing with NumPy. Note that vectors for matmul are in the form (x, y, 1): >>> import numpy as np
>>> from affine import Affine
>>> A = Affine.translation(1, 1) * Affine.scale(2, 3)
>>> print(A)
| 2.00, 0.00, 1.00|
| 0.00, 3.00, 1.00|
| 0.00, 0.00, 1.00|
>>> A * (1, 1)
(3.0, 4.0)
>>> (1, 1) * A
<stdin>:1: DeprecationWarning: Right multiplication will be prohibited in version 3.0
(3.0, 4.0)
>>> np.array(A) @ (1, 1, 1)
array([3., 4., 1.])
>>> (1, 1, 1) @ np.array(A)
array([2., 3., 3.]) The last row is the correct answer from a linear algebra perspective, but this doesn't make sense for affine transformations. So I think the idea to raising an error was a good one to follow through. |
See #32.
The text was updated successfully, but these errors were encountered: