-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
PMVector/PMMatrix >> #dot: does not compute a dot product. #29
Comments
I think I could swap them. |
Yes, for that reason I think swap is a bad idea. Moreover, #* is a natural message for dot product because that is what we would expect, from the mathematical notation, to be polymorphic with scalars. Still, having #dot: not compute the dot product is probably not ideal under any circumstances. My thought would be to leave the default multiplication #* as the dot product, make #dot: just delegate to #*, and add a new method for elementwise multiplication. |
We can try to swap because I don't silent breaks ;-) we have also a lot of tests to cover these kind of changes. Before that we can have a look to dot: implementors if they are any others. |
I don't think we should swap. I didn't fully think it through before I made that suggestion. Dot product IS the default multiplication for matrices and vectors, so it makes sense to leave #* as the dot product. I think all we need to do is rename #dot: to something like #elementwiseMultiply: or maybe some shorter binary message. |
Indeed, dot: is misleading and should be renamed... |
I had a quick look at wikipedia and this binary operation is referred to as the Hadamard product (or Schur product/entrywise product) and the symbol used to refer to it is a circle with a dot inside it. Could we call the message |
yes better to be more precise. Maybe |
I think we can introduce |
Currently, #* computes the dot product:
#(1 2) asPMVector * #(2 1) asPMVector. "4"
and #dot: computes elementwise multiplication:
#(1 2) asPMVector dot: #(2 1) asPMVector. "a PMVector(2 2)"
#dot: should probably be renamed to something like #elementwiseMultiply: or maybe a shorter binary message.
The text was updated successfully, but these errors were encountered: