I have two arrays, each of them is composed by a pair of two integer (int1,int2). I want to compute a sum only on the first values of the pair of each array, and i want to apply a multiplication(for instance) on the second values. Clearly, if i write this code:
tab1=np.array([(1,2),(1,5),(0,6)])
tab2=np.array([(0,7),(1,4),(0,2)])
tab3=tab1+tab2
tab4=tab1*tb2
the result of tab3 will be tab3=array([[1, 9],[2, 9],[0, 8]])
The sum was applied also in the second part. but i want to obtain (1+0),(1+1),(0+0), thus: tab3=array([1,2,0])
Is it possible to have this result without do a loop on the arrays?