Re: [Numpy-discussion] largest matrix element

Hi Scott, et al. First off I goofed -- that last reply should have gone to the list as a whole. Second, mere seconds after I pushed send I realized one problem with it: 'flat' only works for contiguous arrays. Its probably safer to use ravel after all, unless it's known that the array is contiguous. On the other hand, it would be slightly more efficient to ravel the matrix after taking its absolute value since ravel potentially allocates a new array and an array of Floats is going to be half the size of an array of Complexes. But then we know the resulting array is going to be contiguous. So after rewriting and erasing the thing a few times I end up with: max(abs(a).flat) Which is almost the same as my first one, except that the flat has been moved and now it should work when the array starts out noncontiguous. -tim
participants (1)
-
Tim Hochberg