Python Forum
comparing each rows of two matrix
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
comparing each rows of two matrix
#5
Use itertools.product, to avoid nested loops:
[x for x,y in itertools.product(a,b) if np.array_equal(x,y)]
There is also a hint on StackOverflow how to make a Cartesian product with numpy:
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
comparing each rows of two matrix - by PhysChem - Apr-18-2019, 06:17 AM
RE: comparing each rows of two matrix - by PhysChem - Apr-18-2019, 12:03 PM
RE: comparing each rows of two matrix - by DeaD_EyE - Apr-18-2019, 12:19 PM
RE: comparing each rows of two matrix - by PhysChem - Apr-21-2019, 03:13 PM
RE: comparing each rows of two matrix - by PhysChem - May-14-2019, 09:22 AM
RE: comparing each rows of two matrix - by PhysChem - May-16-2019, 09:47 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020