Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14448

How to get the highest element in absolute value in a numpy matrix?

$
0
0

Here is what I am currently doing, it works but it's a little cumbersome:

x = np.matrix([[1, 1], [2, -3]])xmax = x.flat[abs(x).argmax()]

Viewing all articles
Browse latest Browse all 14448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>