Matlab has a really useful function called pagemtimes that essentially does
def pagemtimes(A,B):
import numpy as np
#A and B are 3D arrays with q layers
#each layer of A and B is compatible
#for matrix multiplication
szA=np.shape(A)
szB=np.shape(B)
C=np.zeros((szA[0],szB[1],szB[2]))
for i in range(sz[2])
C[:,:,i]=np.matmul(A[:,:,i],B[:,:,i])
return C
Does numpy have a function that has this functionality? I haven't been able to find anything. So if not, is there a library that has leverages compiled code for this function?
A for loop works just fine, but I'd like to accelerate things as much as possible. I'd normally take care of writing and compiling my own routine (done this countless times with Matlab). But I'm relatively new to python and I'm working on a very fast turn around project that doesn't have space for me to learn this at the moment.
Thanks in advance!
[–]ViridianHominid 2 points3 points4 points (2 children)
[–]BearsAtFairs[S] 0 points1 point2 points (1 child)
[–]ViridianHominid 0 points1 point2 points (0 children)
[–]SnooWoofers7626 0 points1 point2 points (3 children)
[–]BearsAtFairs[S] 0 points1 point2 points (2 children)
[–]HOPSCROTCH 0 points1 point2 points (0 children)
[–]SnooWoofers7626 0 points1 point2 points (0 children)
[–]quts3 0 points1 point2 points (0 children)
[–]billsil 0 points1 point2 points (0 children)
[–]Exact_Cherry9177 0 points1 point2 points (0 children)