python - apply a function to each pair of rows of an array -
I have a numpy array of sizes 4x400
. I want to apply the function to all pairs of rows of this narrow array. Function:
def func (vector1, vector2): ... ... return x
where X
is a Float value
Then in the end I will get a vector of 10.
Is it anyhow efficiently (fast) without using loops? Imported itertools as imported into arr = numpy.random.rand (4,400)
Transposed = arr.T values = [Numpy.dot (i, j) i, j (transposed, 2)] print value in it.comb
Comments
Post a Comment