Fast way for matrix multiplication in Python -


does know fast way compute matrices such as:

z{i,j}  = \sum_{p,k,l,q} \frac{a_{ip} b_{pk} c_{kl} d_{lq} e_{qj} }{a_p - b_q - c} 

enter image description here

for normal matrix multiplication use numpy.dot(a,b), got divide elements $a_p$ , $b_q$.

any suggestions?

any suggestions on how compute

$$ c_{i,j} =  \sum _p = \frac{e_{i,p} b_{p,j}}{m_p} $$ 

will of great well.

note (e[i, p] * b[p, j]) / m[p] equal e[i, p] * (b[p, j] / m[p]), can divide m b before calling np.dot.

def f(e, b, m):     b = np.asarray(b)  # matrix     m = np.asarray(m).reshape((b.shape[0], 1))  # row vector     return np.dot(e, b / m)  # m broadcasted match b 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -