From: David P G. <dp...@lb...> - 2001-01-29 19:30:39
|
<html><head></head><body><br> So, what does one do for an array that is not contiguous?<br> Dave Grote<br> <br> Paul F. Dubois wrote:<br> <blockquote type="cite" cite="mid:ADE...@pf..."> <blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><pre wrap="">import Numeric<br>x=Numeric.arange(24)<br>x.shape=(3,2,4)<br>print Numeric.maximum.reduce(x.flat)<br></pre></blockquote></blockquote></blockquote> <pre wrap=""><!---->23<br><br>The .flat operator does not copy the data. <br>-----Original Message-----<br>From: <a class="moz-txt-link-abbreviated" href="mailto:num...@li...">num...@li...</a><br>[<a class="moz-txt-link-freetext" href="mailto:num...@li...">mailto:num...@li...</a>]On Behalf Of Jon<br>Saenz<br>Sent: Monday, January 29, 2001 6:47 AM<br>To: <a class="moz-txt-link-abbreviated" href="mailto:Numpy-Discussion@Lists">Numpy-Discussion@Lists</a>. Sourceforge. Net<br>Subject: [Numpy-discussion] Is this a wheel?<br><br><br>Hello, there.<br><br>I needed last Saturday a function which returns the greatest/smallest<br>element of a NumPy array. I seeked through the documentation and found the<br>argmax/argmin functions. However, they must be called recursively to find<br>the greatest(smallest) element of a multidimendional array. As I needed t! ! o<br>process a BIG dataset of multidimensional arrays, I wrote a function in C<br>which returns as a NumPy array shaped (2,) the [smallest one,biggest one]<br>elements in an arbitrarily shaped NumPy array. It is pure C and works for<br>multidimensional arrays. The return typecode is the same of the input<br>array (except with complex numbers, which compare numbers through their<br>modules).<br><br>I can make this function available to general public by means of my WEB<br>page or my starship account as a module. However, I wonder:<br>a) Is this a wheel already invented some 40,000 years ago? May be I missed<br>something in the manual?<br>b) If the answer to the previous question is NO, would you (main<br>developers) be interested in making it available as one of the "general<br>purpose" NumPy functions? It is quite general-purpose, indeed. I have<br>needed it five times or so in the last two years...<br><br>Looking after your comments.<br><br><br>Jon Saenz. | Tfno: +34 94601! ! 2470<br>Depto. Fisica Aplicada II | Fax: +34 944648500<br>Facultad de Ciencias. \\ Universidad del Pais Vasco \\<br>Apdo. 644 \\ 48080 - Bilbao \\ SPAIN<br><br><br>_______________________________________________<br>Numpy-discussion mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:Num...@li...">Num...@li...</a><br><a class="moz-txt-link-freetext" href="http://lists.sourceforge.net/lists/listinfo/numpy-discussion">http://lists.sourceforge.net/lists/listinfo/numpy-discussion</a><br><br><br>_______________________________________________<br>Numpy-discussion mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:Num...@li...">Num...@li...</a><br><a class="moz-txt-link-freetext" href="http://lists.sourceforge.net/lists/listinfo/numpy-discussion">http://lists.sourceforge.net/lists/listinfo/numpy-discussion</a><br></pre> </blockquote> <br> </body></html> |