I have two matrices X and Y
, both of order mxn
. I want to create a new matrix O of order mxm
such that each i,j th
entry in this new matrix is computed by applying a function to ith
and jth
row of X
and Y
respectively. In my case m = 10000
and n = 500
. I tried using a loop but it takes forever. Is there an efficient way to do it?
I am targeting two functions dot product -- dot(row_i, row_j)
and exp(-1*norm(row_i-row_j))
. But I was wondering if there is a general way so that I can plugin any function.