Added an 'elementary' function. - #4573
Conversation
There was a problem hiding this comment.
"are square by definition", perhaps?
|
Im not sure whether this function should be added, but it will definitely need test cases as well if it is. |
There was a problem hiding this comment.
PEP8 wants spaces around operators. Also checking for None should be done with is.
|
Tests are still forthcoming. |
|
I haven't looked at this in detail, but yes, please don't use np.matrix in For now the best way to write matrix multiplication is just as a call to
|
|
So, I've added test coverage, switched to using np.dot instead of np.matrix, dropped the string formatting, and reworded the documentation. What do numpy devs think of this patch? Any other thoughts? |
|
hm elementary matrices may be useful for mathematical notation, but why would you want to use them computations? |
|
You might want to compose several linear transformations by multiplying their corresponding matrices together. |
|
hm it would still be very inefficient. But its probably useful for code clarity on operations where performance does not matter and could become more useful for other cases when numpy gains a smart matrix-dot chaining function. |
|
Other cases I can imagine it might be useful:
|
is the last 1 on the diagonal correct here? it isn't a multiplier anymore in this case. |
|
Needs rebase. |
There was a problem hiding this comment.
Any reason not to document the dtype arg?
|
I was looking for a numpy |
The new function creates an identity array that's had a single row operation performed on it. Quite useful when doing matrix multiplication. https://en.wikipedia.org/wiki/Elementary_matrix