79809299

Date: 2025-11-04 19:09:18
Score: 0.5
Natty:
Report link

imho, the easiest way is to prepare an array to multiply original one with, based on the arithmetical signs of your reshaped D array. And then mutiply it with your flipped original T array.

m = np.where(np.sign(D)[:, None]>0, [-1, 1], [1, -1])
res = np.flip(T,1)*m

res:

[[ 2 -1]
 [-4  3]
 [-6  5]
 [ 8 -7]]
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: strawdog