python - How to compare two matrices (numpy ndarrays) element by element and get the min-value of each comparison -


so want make comparison between 2 matrices (size: 98000 x 64). comparison should done element element , want min value of each comparison stored in third matrix same dimensions. want comparison being done without use of loops!

here's small example:

a=np.array([1,2,3]) b=np.array([4,1,2]) 

a function compares 1 , 4, 2 , 1 , 3 , 2 , stores in vector c

answer

c=[1,1,2] 

is there efficient way this?

numpy has minimum feature, below:

c = np.minimum(a,b) 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -