implement dot for higher-dimensional arrays with Ix2#1602
implement dot for higher-dimensional arrays with Ix2#1602EbrahimEldesoky wants to merge 3 commits into
Conversation
|
hi @akern40 please when you have time check this pr |
|
One thing you could do before someone checks your PR is remove the formatting changes. It's hard[er] to know what you actually modified. We should probably format the whole project with a specific rule but it hasn't been done yet. |
e252287 to
45415b4
Compare
45415b4 to
642d18d
Compare
Thank you @nilgoyette, Please take a look. |
|
I don't know how common this operation is used (I never had to use it). If it is common, then yes we should add this feature to ndarray. Is it the same behavior as numpy dot? |
closes #1587
right now calling
.dot()on anything aboveIx2doesn't work, so if you have a 3-D or 5-D array and want to multiply it by a matrix you have to manually reshape, dot, then reshape back.this adds
Dot<ArrayRef<A, Ix2>>forIx3,Ix4,Ix5,Ix6, andIxDyn. the implementation flattens all axes except the last into a single "rows" dimension, delegates to the existing 2-D dot (which already handles BLAS), then reshapes the result back to the correct output shape.for example: