From paul at pfdubois.com Sun Apr 1 23:24:24 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Sun, 1 Apr 2001 20:24:24 -0700 Subject: [Numpy-discussion] arg matrix max question In-Reply-To: <002c01c0d29e$865b9af0$cfefb418@cc911046a> Message-ID: >>> x array([[ 0, 1, 2, 3, 4, 5], [ 6, 7, 8, 9, 10, 11], [ 12, 13, 14, 15, 1000, 17], [ 18, 19, 20, 21, 22, 23]]) >>> n = argmax(ravel(x)) >>> divmod(n, x.shape[1]) (2, 4) >>> x[2,4] 1000 >>> divmod is a builtin -- the rest are from Numeric. -----Original Message----- From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Eric Hagemann Sent: Tuesday, May 01, 2001 5:26 PM To: Numpy-discussion at lists.sourceforge.net Subject: [Numpy-discussion] arg matrix max question I need to find the location of the maximum value in a two dimensional Numeric array The best I have come up with uses a couple of calls to argmax and then cross checking the results I know there must be a better way and that I am not the only one who needs to do such a thing Anybody got a code snippet to share ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From Karl.Bellve at umassmed.edu Tue Apr 3 11:20:09 2001 From: Karl.Bellve at umassmed.edu (Karl Bellve) Date: Tue, 03 Apr 2001 11:20:09 -0400 Subject: [Numpy-discussion] Web Server Message-ID: <3AC9EA29.2D0E381B@umassmed.edu> When you go to www.numpy.org, it tries to redirect you to www.numpy.org/numeric/ which it can't find... -- Cheers, Karl Bellve, Ph.D. ICQ # 13956200 Biomedical Imaging Group TLCA# 7938 University of Massachusetts Email: Karl.Bellve at umassmed.edu Phone: (508) 856-6514 Fax: (508) 856-1840 PGP Public key: finger kdb at molmed.umassmed.edu From Karl.Bellve at umassmed.edu Tue Apr 3 11:30:45 2001 From: Karl.Bellve at umassmed.edu (Karl Bellve) Date: Tue, 03 Apr 2001 11:30:45 -0400 Subject: [Numpy-discussion] Using Numpy inside an application... Message-ID: <3AC9ECA5.F6DF58AC@umassmed.edu> Since I can't search the web site, here is a question... I am using the following calls inside my C++ app: import_array(); a=PyRun_SimpleString("from image_module import *"); // my module for wrapping a C++ class a=PyRun_SimpleString("image=imagemanager()\n"); // load a new instance of the class into Python a=PyRun_SimpleString("a=image.GetImage(0)"); // assign image 0 to a Basically, GetImage() returns a numpy Array Object for image 0, properly initialized by PyArray_FromDimsAndData(). I can't return all the images because they might not be sequential in memory (off loaded to the filesystem). "a" appears to be an list of numbers. I am not sure if Python knows it is a PyArrayObject. This is where I am getting into trouble. I can't do something like a=PyRun_SimpleString("a = a + 100"); I get an error "Value Error: Function not Supported". I am trying to figure out what namespace did "import_array()" import Numeric into. Also, I am using _numpy_d.pyd that I compiled under Windows NT and MSVC 6.0. -- Cheers, Karl Bellve, Ph.D. ICQ # 13956200 Biomedical Imaging Group TLCA# 7938 University of Massachusetts Email: Karl.Bellve at umassmed.edu Phone: (508) 856-6514 Fax: (508) 856-1840 PGP Public key: finger kdb at molmed.umassmed.edu From dubois1 at llnl.gov Tue Apr 3 11:32:09 2001 From: dubois1 at llnl.gov (Paul F. Dubois) Date: Tue, 3 Apr 2001 08:32:09 -0700 Subject: [Numpy-discussion] redirection? Message-ID: <01040308343800.21243@almanac> Since I made that typo I have people going to pfdubois.com/numeric when I actually made it /numpy. I can create a numerc -- but I think it would be nicer if I did the automatic redirection trick. So what does one do to get a browser to switch to a different site? From Karl.Bellve at umassmed.edu Tue Apr 3 11:45:35 2001 From: Karl.Bellve at umassmed.edu (Karl Bellve) Date: Tue, 03 Apr 2001 11:45:35 -0400 Subject: [Numpy-discussion] redirection? References: <01040308343800.21243@almanac> Message-ID: <3AC9F01F.A96306AD@umassmed.edu> Here is a template html page. Change the appropiate content/urls and put this in www.python.org/numeric/ You are being redirected This page was been moved. If you aren't redirected automatically, please click here. "Paul F. Dubois" wrote: > > Since I made that typo I have people going to pfdubois.com/numeric when I > actually made it /numpy. I can create a numerc -- but I think it would be nicer > if I did the automatic redirection trick. So what does one do to get a browser > to switch to a different site? > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion at lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Cheers, Karl Bellve, Ph.D. ICQ # 13956200 Biomedical Imaging Group TLCA# 7938 University of Massachusetts Email: Karl.Bellve at umassmed.edu Phone: (508) 856-6514 Fax: (508) 856-1840 PGP Public key: finger kdb at molmed.umassmed.edu From mdrumheller at yahoo.com Tue Apr 3 11:50:48 2001 From: mdrumheller at yahoo.com (Michael Drumheller) Date: Tue, 3 Apr 2001 08:50:48 -0700 (PDT) Subject: [Numpy-discussion] numpy newbie question Message-ID: <20010403155048.190.qmail@web12108.mail.yahoo.com> Hi, I am pretty new to numpy and am using it for image processing. (Also, I am not 100% sure that this is the appropriate email address for this question--feel free to redirect me.) My problem is that I would like to be able to dive down into C and write my own filters etc., but I do not want to have to surmount the somewhat daunting Python/C-extension learning curve if that is at all possible. I am wondering if anybody has "packaged" this ability anywhere, sort of like Perl's Inline.pm. Thanks, Mike Drumheller ===== Michael Drumheller 2735 NE 87th Street, Seattle, Washington 98115 206/523-7865 drumheller at alum.mit.edu __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ From jsaenz at wm.lc.ehu.es Tue Apr 3 11:59:48 2001 From: jsaenz at wm.lc.ehu.es (Jon Saenz) Date: Tue, 3 Apr 2001 17:59:48 +0200 (MET DST) Subject: [Numpy-discussion] numpy newbie question In-Reply-To: <20010403155048.190.qmail@web12108.mail.yahoo.com> Message-ID: Try SWIG (http://www.swig.org), to see whether it supports your needs. Jon Saenz. | Tfno: +34 946012470 Depto. Fisica Aplicada II | Fax: +34 944648500 Facultad de Ciencias. \\ Universidad del Pais Vasco \\ Apdo. 644 \\ 48080 - Bilbao \\ SPAIN On Tue, 3 Apr 2001, Michael Drumheller wrote: > Hi, > I am pretty new to numpy and am using it for > image processing. (Also, I am not 100% sure > that this is the appropriate email address for > this question--feel free to redirect me.) > My problem is that I would like to be able > to dive down into C and write my own filters etc., > but I do not want to have to surmount the > somewhat daunting Python/C-extension learning curve if > that is at all possible. I am wondering if > anybody has "packaged" this ability anywhere, > sort of like Perl's Inline.pm. > Thanks, > Mike Drumheller > > ===== > Michael Drumheller > 2735 NE 87th Street, Seattle, Washington 98115 > 206/523-7865 drumheller at alum..mit.edu > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion at lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/numpy-discussion > From siopis at astro.ufl.edu Tue Apr 3 11:09:31 2001 From: siopis at astro.ufl.edu (Christos Siopis ) Date: Tue, 3 Apr 2001 18:09:31 +0300 (EEST) Subject: [Numpy-discussion] Documentation typos Message-ID: I was reading some sections of the latest NumPy tutorial (the one currently listed as http://pfdubois.com/numpy/numdoc.pdf ) and spotted these typos, listed below in case you want to fix them. Page numbers refer to the actual page numbers printed on the page (not the PDF document's numbers). - p.14: "A very useful features of arrays..." (should be "feature"). - p.15, top-of-page NumPy example: arrays are shown printed before the corresponding "print" command (see "print a" and "print b"). - p.17: in the "Advanced Users" section: the explanation of what these sections are for should perhaps be included in the previous page's "Advanced Users" section, since that one is the first such occurrence in the tutorial. - p.19, near the end: Above "identity": "The first example BELOW satisfies... while the second array ...": there is only one example "below", the buggy example. The first, correct example is probably the one given previously on the same page. Christos From Karl.Bellve at umassmed.edu Tue Apr 3 13:35:50 2001 From: Karl.Bellve at umassmed.edu (Karl Bellve) Date: Tue, 03 Apr 2001 13:35:50 -0400 Subject: [Numpy-discussion] Using Numpy inside an application... References: <3AC9ECA5.F6DF58AC@umassmed.edu> Message-ID: <3ACA09F6.5953CCE6@umassmed.edu> Karl Bellve wrote: > > Since I can't search the web site, here is a question... > > > "a" appears to be an list of numbers. I am not sure if Python knows it > is a PyArrayObject. This is where I am getting into trouble. I can't do > something like a=PyRun_SimpleString("a = a + 100"); I get an error > "Value Error: Function not Supported". > > I corrected a few things. First, I wasn't importing Numeric but just import_array (thanks to Pete Shinners). Although I am getting DLL collisions and relocations, it still works. I am able to do the following now: a=a+100. I need to figure out why I am getting the DLL collisions... -- Cheers, Karl Bellve From paul at pfdubois.com Tue Apr 3 18:56:11 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Tue, 3 Apr 2001 15:56:11 -0700 Subject: [Numpy-discussion] Documentation typos In-Reply-To: Message-ID: Changes in my master copy, will appear next release. Thanks very much. The last point was interesting as due to rich comparisons the buggy example no longer had an exception, but it didn't work "right" either. I expanded the example to explain. -----Original Message----- From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Christos Siopis Sent: Tuesday, April 03, 2001 8:10 AM To: numpy-discussion at lists.sourceforge.net Subject: [Numpy-discussion] Documentation typos I was reading some sections of the latest NumPy tutorial (the one currently listed as http://pfdubois.com/numpy/numdoc.pdf ) and spotted these typos, listed below in case you want to fix them. Page numbers refer to the actual page numbers printed on the page (not the PDF document's numbers). - p.14: "A very useful features of arrays..." (should be "feature"). - p.15, top-of-page NumPy example: arrays are shown printed before the corresponding "print" command (see "print a" and "print b"). - p.17: in the "Advanced Users" section: the explanation of what these sections are for should perhaps be included in the previous page's "Advanced Users" section, since that one is the first such occurrence in the tutorial. - p.19, near the end: Above "identity": "The first example BELOW satisfies... while the second array ...": there is only one example "below", the buggy example. The first, correct example is probably the one given previously on the same page. Christos _______________________________________________ Numpy-discussion mailing list Numpy-discussion at lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/numpy-discussion From dubois at users.sourceforge.net Tue Apr 3 19:05:34 2001 From: dubois at users.sourceforge.net (Paul F. Dubois) Date: Tue, 3 Apr 2001 16:05:34 -0700 Subject: [Numpy-discussion] redirection? In-Reply-To: <3AC9F01F.A96306AD@umassmed.edu> Message-ID: It works! Thanks for coming to my aid. -----Original Message----- From: Karl Bellve [mailto:Karl.Bellve at umassmed.edu] Sent: Tuesday, April 03, 2001 8:46 AM To: Paul F. Dubois; Numpy Subject: Re: [Numpy-discussion] redirection? Here is a template html page. Change the appropiate content/urls and put this in www.python.org/numeric/ You are being redirected This page was been moved. If you aren't redirected automatically, please click here. "Paul F. Dubois" wrote: > > Since I made that typo I have people going to pfdubois.com/numeric when I > actually made it /numpy. I can create a numerc -- but I think it would be nicer > if I did the automatic redirection trick. So what does one do to get a browser > to switch to a different site? > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion at lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Cheers, Karl Bellve, Ph.D. ICQ # 13956200 Biomedical Imaging Group TLCA# 7938 University of Massachusetts Email: Karl.Bellve at umassmed.edu Phone: (508) 856-6514 Fax: (508) 856-1840 PGP Public key: finger kdb at molmed.umassmed.edu From ransom at cfa.harvard.edu Tue Apr 3 21:05:13 2001 From: ransom at cfa.harvard.edu (Scott Ransom) Date: Tue, 03 Apr 2001 21:05:13 -0400 Subject: [Numpy-discussion] curious FFFT timing References: <006801c0d434$9e7d3ed0$cfefb418@cc911046a> Message-ID: <3ACA7349.421BAD50@cfa.harvard.edu> Hi Eric, > Any one want to speculate on the timing difference for the 4095 vice > 4096 long transforms ? > Since 4095 is not a power of two I would have expected a greater time > difference (DFT vice FFT) You are correct in that 4095 is not a power of two, but is is the product of only small prime factors: 3 * 3 * 5 * 7 * 13 = 4095 Since the FFT code implements a N*log_2(N) algorithm for numbers that contain only small prime factors, the difference in times is rather small. FFTs that have lengths that are powers-of-two tend to be more efficient in general (since the decimation routines are cleaner for this case). If you test with 4097 (17 * 241) it will be quite a bit slower I'd guess... Scott -- Scott M. Ransom Address: Harvard-Smithsonian CfA Phone: (617) 495-4142 60 Garden St. MS 10 email: ransom at cfa.harvard.edu Cambridge, MA 02138 GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 From hinsen at cnrs-orleans.fr Wed Apr 4 10:14:48 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Wed, 4 Apr 2001 16:14:48 +0200 Subject: [Numpy-discussion] Citing NumPy Message-ID: <200104041414.QAA26362@chinon.cnrs-orleans.fr> I am just working on an article describing a program which makes heavy use of NumPy, so I should cite some reference to it. Did anyone do this before? What is the most appropriate reference? I think URLs are acceptable these days, but it should be a rather stable one. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From pete at shinners.org Thu Apr 5 03:09:15 2001 From: pete at shinners.org (Pete Shinners) Date: Thu, 5 Apr 2001 00:09:15 -0700 Subject: [Numpy-discussion] Broken Win32 Package for 19.0 References: <200104041414.QAA26362@chinon.cnrs-orleans.fr> Message-ID: <00f401c0bd9f$54ba0220$0200a8c0@petebox> hey folks. i'm the guy who put the win32 package for Numeric-19.0 for Python-2.0 together. turns out the package is missing one small and important file, the Numeric.pth file. i've just found out about this and created a new archive that actually works. hopefully this can replace the current file available for download on the sourceforge pages. http://pygame.seul.org/ftp/contrib/Numeric-19.0.0b-Python-2.0.zip sorry about the foul-up, hopefully no one got stuck on it. i only just received an email about the problem tonight. From paul at pfdubois.com Thu Apr 5 11:33:09 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Thu, 5 Apr 2001 08:33:09 -0700 Subject: [Numpy-discussion] Broken Win32 Package for 19.0 In-Reply-To: <00f401c0bd9f$54ba0220$0200a8c0@petebox> Message-ID: Done. Erroneous file removed. -----Original Message----- From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Pete Shinners Sent: Thursday, April 05, 2001 12:09 AM To: numpy-discussion at lists.sourceforge.net Subject: [Numpy-discussion] Broken Win32 Package for 19.0 hey folks. i'm the guy who put the win32 package for Numeric-19.0 for Python-2.0 together. turns out the package is missing one small and important file, the Numeric.pth file. i've just found out about this and created a new archive that actually works. hopefully this can replace the current file available for download on the sourceforge pages. http://pygame.seul.org/ftp/contrib/Numeric-19.0.0b-Python-2.0.zip sorry about the foul-up, hopefully no one got stuck on it. i only just received an email about the problem tonight. _______________________________________________ Numpy-discussion mailing list Numpy-discussion at lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/numpy-discussion From tchur at optushome.com.au Sun Apr 8 17:32:09 2001 From: tchur at optushome.com.au (Tim Churches) Date: Mon, 09 Apr 2001 07:32:09 +1000 Subject: [Numpy-discussion] Optimisation of a Numpy set intersection function Message-ID: <3AD0D8D9.774F26D1@optushome.com.au> I have been trying to optimise a simple set intersection function for a Numpy-based application on which I am working. The function needs to find the common elements (i.e the intersection) of two or more Numpy rank-1 arrays of integers passed to it as arguments - call them array A, array B etc. My first attempt used searchsorted() to see where in array A each element of array B would fit and then check if the element in array A at that position equalled the element in array B - if it did, then that element was part of the intersection: def intersect(A,B): c = searchsorted(A,B) d = compress(less(c,len(A)),B) return compress(equal(take(A,compress(less(c,len(A)),c)),d),d) This works OK but it requires the arrays to be stored in sorted order (which is what we did) or to be sorted by the function (not shown). I should add that the arrays passed to the function may have up to a few million elements each. Ole Nielsen at ANU (Australian National University), who gave a paper on data mining using Python at IPC9, suggested an improvement, shown below. Provided the arrays are pre-sorted, Ole's function is about 40% faster than my attempt, and about the same speed if the arrays aren't pre-sorted. However, Ole's function can be generalised to find the intersection of more than two arrays at a time. Most of the time is spent sorting the arrays, and this increases as N.log(N) as the total size of the concatenated arrays (N) increases (I checked this empirically). def intersect(Arraylist): C = sort(concatenate(Arraylist)) D = subtract(C[0:-n], C[n:]) #or # D = convolve(C,[n,-n]) return compress(equal(D,0),C) #or # return take(C,nonzero(equal(D,0))) Paul Dubois suggested the following elegant alternative: def intersect(x,y): return compress(sum(equal(subtract.outer(x,y),0),1),x) Unfortunately, perhaps due to the overhead of creating the rank-2 array to hold the results of the subtract.outer() method call, it turns out to be slower than Ole's function, as well as using huge tracts of memory. My questions for the list, are: a) can anyone suggest any further optimisation of Ole's function, or some alternative? b) how much do you think would be gained by re-implementing this function in C using the Numpy C API? If such an effort would be worthwhile, are there any things we should consider while tackling this task? Regards, Tim Churches Sydney, Australia From Robert.Denham at dnr.qld.gov.au Sun Apr 8 19:06:34 2001 From: Robert.Denham at dnr.qld.gov.au (Robert.Denham at dnr.qld.gov.au) Date: Mon, 9 Apr 2001 09:06:34 +1000 Subject: [Numpy-discussion] Nieghbourhood functions Message-ID: I am looking for efficient ways to code neighbourhood functions. For example a neighbourhod add for an element in an array will simply be the sum of the neighbours: 1 0 2 3 x 3 , then x becomes 7 (first order neighbour), 11 (2nd order) etc. 1 1 0 I would be interested in efficient ways of doing this for a whole array, something like a_nsum = neighbour_sum(a, order=1), where each element in a_nsum is the sum of the corresponding element in a. There must be some work done on neighbourhood functions for arrays, so I would be grateful for some pointers. Thanks, Robert Denham ************************************************************************ The information in this e-mail together with any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any form of review, disclosure, modification, distribution and/or publication of this e-mail message is prohibited. If you have received this message in error, you are asked to inform the sender as quickly as possible and delete this message and any copies of this message from your computer and/or your computer system network. ************************************************************************ From ransom at cfa.harvard.edu Sun Apr 8 21:46:45 2001 From: ransom at cfa.harvard.edu (Scott Ransom) Date: Sun, 08 Apr 2001 21:46:45 -0400 Subject: [Numpy-discussion] Nieghbourhood functions References: Message-ID: <3AD11485.183D7D57@cfa.harvard.edu> Hi Robert, Isn't this just a convolution? For your first order case you are convolving the array with a kernel that looks like: 0 1 0 1 0 1 0 1 0 and for second order: 1 1 1 1 0 1 1 1 1 If this is what you are looking for, there is a convolve function built in to Numeric but it is for rank-1 arrays only. You can use 2D FFTs for a 2D case -- although the efficiency won't be the greatest unless you can use the FFT of the kernel array and/or the data array over and over again (since in general a convolution by FFTs takes 3 FFTs -- 1 for the data, 1 for the kernel, and 1 inverse one after you have multiplied the first two together). It would work well for higher order cases...(but beware of the wrapping that goes on accross the boundaries!) For lower order cases or when you can't re-use the FFTs, you'll probably want a brute force technique -- which I'll leave for someone else... Scott Robert.Denham at dnr.qld.gov.au wrote: > > I am looking for efficient ways to code neighbourhood functions. For > example a neighbourhod add for an element in an array will simply be the sum > of the neighbours: > > 1 0 2 > 3 x 3 , then x becomes 7 (first order neighbour), 11 (2nd order) etc. > 1 1 0 > > I would be interested in efficient ways of doing this for a whole array, > something like a_nsum = neighbour_sum(a, order=1), where each element in > a_nsum is the sum of the corresponding element in a. -- Scott M. Ransom Address: Harvard-Smithsonian CfA Phone: (617) 495-4142 60 Garden St. MS 10 email: ransom at cfa.harvard.edu Cambridge, MA 02138 GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 From cgw at alum.mit.edu Sun Apr 8 23:36:42 2001 From: cgw at alum.mit.edu (Charles G Waldman) Date: Sun, 8 Apr 2001 22:36:42 -0500 (CDT) Subject: [Numpy-discussion] Nieghbourhood functions In-Reply-To: <3AD11485.183D7D57@cfa.harvard.edu> References: <3AD11485.183D7D57@cfa.harvard.edu> Message-ID: <15057.11850.960826.430382@cgw-sirius.dyndns.org> > Robert.Denham at dnr.qld.gov.au wrote: > > > > I am looking for efficient ways to code neighbourhood functions. For > > example a neighbourhod add for an element in an array will simply be the sum > > of the neighbours: > > > > 1 0 2 > > 3 x 3 , then x becomes 7 (first order neighbour), 11 (2nd order) etc. > > 1 1 0 > > > > I would be interested in efficient ways of doing this for a whole array, > > something like a_nsum = neighbour_sum(a, order=1), where each element in > > a_nsum is the sum of the corresponding element in a. As Scott Ransom already mentioned, these "neighborhood functions" are usually referred to as convolutions and are widely used in signal/image processing. For large convolution kernels, the most efficient implementation is to use Fourier methods, since a convolution in the spatial domain maps to a multiplication in the Fourier domain. However for small kernels this is inefficient because the time spent doing the forward and inverse FFT's dwarfs the time that it would take to just do the convolution. There is a convolve function built into Numeric but it only is implemented for 1-d arrays. It would be nice if this were generalized... when somebody gets the time. In the meanwhile - here are two more comments which may help. If your kernel is separable (i.e. a rank-one matrix, or equivalently, the outer product of a column and a row vector) then the 2-d convolution is equivalent to doing 2 1-d convolutions in sequence. For your "first order neighborhood function" the kernel is 0 1 0 1 0 1 0 1 0 which is not separable. But for the "second order" case, the kernel is 1 1 1 1 0 1 1 1 1 which is *almost* separable if you made that middle 0 into a 1. But if you were to convolve with the kernel 1 1 1 1 1 1 1 1 1 then subtract off the value of the original array, then you'd have what you were looking for. And convolving with this kernel is essentially the same as convolving with the 1-d kernel [1 1 1], then transposing, then convolving with [1 1 1] again, and transposing a second time. This scales up to larger separable kernels. I'm not sure how efficient this winds up being - transposing large arrays can be slow, if the arrays are too large to sit in physical memory - the access pattern of a transpose is hell on virtual memory. Finally, I would suggest that you look at the file Demo/life.py in the Numeric Python distribution - in particular the functions shift_up, shift_down, shift_left, and shift_right. Using these you could write: def first_order(arr): return shift_left(arr) + shift_right(arr) + shift_up(arr) + shift_down(arr) which is nice and terse and understandable, but unfortunately not very memory-efficient. If speed and memory usage are both critical, your best bet is probably to write the functions in C and use SWIG to create Python bindings. Charles G. Waldman Object Environments cgw at objenv.com From turner at blueskystudios.com Mon Apr 9 12:57:53 2001 From: turner at blueskystudios.com (John A. Turner) Date: Mon, 9 Apr 2001 12:57:53 -0400 Subject: [Numpy-discussion] redirection? In-Reply-To: References: <3AC9F01F.A96306AD@umassmed.edu> Message-ID: <15057.59921.747661.656823@denmark.blueskystudios.com> >>>>> "PFD" == Paul F Dubois : PFD> It works! Thanks for coming to my aid. however, that didn't seem to help the http://www.numpy.org/ redirection, as reported here: >>>>> "KB" == Karl Bellve : KB> When you go to www.numpy.org, it tries to redirect you to KB> www.numpy.org/numeric/ which it can't find... I've fixed it so it now redirects to http://pfdubois.com/numpy, and seems to be working sorry for the delay in updating -- John A. Turner, Ph.D. Senior Research Associate Blue Sky Studios, 44 S. Broadway, White Plains, NY 10601 http://www.blueskystudios.com/ (914) 259-6319 From tariq at envisional.com Mon Apr 9 19:13:01 2001 From: tariq at envisional.com (Tariq Rashid) Date: Tue, 10 Apr 2001 00:13:01 +0100 Subject: [Numpy-discussion] wavelets Message-ID: <001001c0c14a$a0f7a9e0$394a063e@badass> I'm about to start work on a wavelets module for python... don't know how far i want to go yet.... is there an existsing project? i couldn't find one! tariq From cspence at sarnoff.com Thu Apr 12 11:13:11 2001 From: cspence at sarnoff.com (Clay Spence) Date: Thu, 12 Apr 2001 11:13:11 -0400 Subject: [Numpy-discussion] RandArray initialization and docs Message-ID: <3AD5C607.11425048@sarnoff.com> Hi, I have occasionally dabbled with numpy in the past, but I'm starting to use it more heavily now. I have two (minor, I think) question/comments: 1) RandomArray seems to be initialized from the time. At least when I repeatedly execute a script that uses RandomArray.uniform, the first number generated changes very little from one invocation to another. For example, with the following file: --------- # testRA.py from RandomArray import * print uniform(-1.0, 1.0) --------- I get: -------- cholla 192% python testRA.py 0.434084415436 cholla 193% python testRA.py 0.433970689774 cholla 194% python testRA.py 0.433856964111 cholla 195% python testRA.py 0.433781266212 -------- Is that really desirable behavior? It is easily fixed in my script; I just generate one random number first and throw it away. (I'm running on a sparc under solaris 2.6.) 2) The example in the documentation on negative strides in slices is incorrect, or old. It says: >>> a = reshape(arrayrange(9),(3,3)) >>> print a[2:-1, 0] [6 3 0] That's not the result I get. I think two colons were wanted there. Clay From paul at pfdubois.com Thu Apr 12 12:45:37 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Thu, 12 Apr 2001 09:45:37 -0700 Subject: [Numpy-discussion] RandArray initialization and docs In-Reply-To: <3AD5C607.11425048@sarnoff.com> Message-ID: -----Original Message----- From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Clay Spence Sent: Thursday, April 12, 2001 8:13 AM To: numpy-discussion Subject: [Numpy-discussion] RandArray initialization and docs 2) The example in the documentation on negative strides in slices is incorrect, or old. It says: >>> a = reshape(arrayrange(9),(3,3)) >>> print a[2:-1, 0] [6 3 0] That's not the result I get. I think two colons were wanted there. --- Corrected in my sources, thank you. The change will migrate into the next release of the manual. From paul at pfdubois.com Fri Apr 13 13:23:37 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Fri, 13 Apr 2001 10:23:37 -0700 Subject: [Numpy-discussion] bugs Message-ID: I am approaching a point where I will cut 19.1. I have reduced the number of bugs in the bug list to six. Please examine this list and see if there is one you could volunteer to fix. Developers, please make fixes directly. Users, please post patches rather than sending email. There are no outstanding patches. From rrdn60 at email.sps.mot.com Fri Apr 13 15:22:58 2001 From: rrdn60 at email.sps.mot.com (Norman Shelley (rrdn60)) Date: Fri, 13 Apr 2001 12:22:58 -0700 Subject: [Numpy-discussion] ?POOMA and Boost? Message-ID: <3AD75212.BC141BF1@email.sps.mot.com> o How would a Python version of POOMA compare/contrast to Numpy? POOMA (Parallel Object-Oriented Methods and Applications) a C++ high performance simulation infrastructure package http://www.acl.lanl.gov/pooma/ Would boost add anything advantages to the current Numpy methodology? http://www.boost.org/ Thanks, Norman Shelley From focke at slac.stanford.edu Fri Apr 13 15:31:05 2001 From: focke at slac.stanford.edu (Warren Focke) Date: Fri, 13 Apr 2001 12:31:05 -0700 (PDT) Subject: [Numpy-discussion] bugs In-Reply-To: Message-ID: 224100 was fixed (by a patch that was incorrectly labeled as being for 124100), but now it's broken again. I'll re-fix it. Warren Focke On Fri, 13 Apr 2001, Paul F. Dubois wrote: > I am approaching a point where I will cut 19.1. I have reduced the number of > bugs in the bug list to six. Please examine this list and see if there is > one you could volunteer to fix. Developers, please make fixes directly. > Users, please post patches rather than sending email. From tjlahey at sympatico.ca Sun Apr 15 22:27:35 2001 From: tjlahey at sympatico.ca (Tim Lahey) Date: Sun, 15 Apr 2001 22:27:35 -0400 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? Message-ID: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> All, I've been trying to get the Numeric-19.0.0 working on Python 2.1b2 under OS X. I've successfully install python and have success with most of the modules, but I have problems with Numeric. I can't get it to even load. The following is what I get when I import Numeric. Python 2.1b2 (#1, 04/09/01, 22:37:35) [GCC Apple DevKit-based CPP 6.0alpha] on darwin1 Type "copyright", "credits" or "license" for more information. >>> import Numeric dyld: python multiple definitions of symbol _PyArray_API /usr/local/lib/python2.1/site-packages/Numeric/multiarray.so definition of _PyArray_API /usr/local/lib/python2.1/site-packages/Numeric/umath.so definition of _PyArray_API At this point, I get returned to the command line (python exits). It appears that the dynamic linker mechanism under OS X doesn't like symbols with the same name. Anyone have a way around this ? Thanks, Tim Lahey tjlahey at sympatico.ca From tchur at optushome.com.au Sun Apr 15 23:08:30 2001 From: tchur at optushome.com.au (Tim Churches) Date: Mon, 16 Apr 2001 13:08:30 +1000 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> Message-ID: <3ADA622E.50414D15@optushome.com.au> Tim Lahey wrote: > I've been trying to get the Numeric-19.0.0 working on Python 2.1b2 under > OS X. If anyone can get it to work, some impressions of the performance available on a G4-based Mac would be welcome. They are reputedly a lot faster than a Pentium 4 and are much cheaper than an Alpha box, at least they are here in Australia. Which begs the question: are there any Numpy benchmarks available to compare Numpy on different platforms, or to compare Numpy with its alternatives on the same platform (Numpy would have to be proven a lot slower for me to change!). Tim C Sydney, Australia From turner at blueskystudios.com Tue Apr 17 11:17:15 2001 From: turner at blueskystudios.com (John A. Turner) Date: Tue, 17 Apr 2001 11:17:15 -0400 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: <3ADA622E.50414D15@optushome.com.au> References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <3ADA622E.50414D15@optushome.com.au> Message-ID: <15068.24187.269848.649078@denmark.blueskystudios.com> >>>>> "TC" == Tim Churches : TC> If anyone can get it to work, some impressions of the performance TC> available on a G4-based Mac would be welcome. They are reputedly a lot TC> faster than a Pentium 4 and are much cheaper than an Alpha box, at least TC> they are here in Australia. I'd be interested in Athlon performance as well... -- John A. Turner, Ph.D. Senior Research Associate Blue Sky Studios, 44 S. Broadway, White Plains, NY 10601 http://www.blueskystudios.com/ (914) 259-6319 From hinsen at cnrs-orleans.fr Tue Apr 17 12:44:58 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Tue, 17 Apr 2001 18:44:58 +0200 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> (message from Tim Lahey on Sun, 15 Apr 2001 22:27:35 -0400) References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> Message-ID: <200104171644.SAA10598@chinon.cnrs-orleans.fr> > dyld: python multiple definitions of symbol _PyArray_API > /usr/local/lib/python2.1/site-packages/Numeric/multiarray.so definition > of _PyArray_API > /usr/local/lib/python2.1/site-packages/Numeric/umath.so definition of > _PyArray_API > > At this point, I get returned to the command line (python exits). It > appears that the dynamic linker mechanism under OS X doesn't like > symbols with the same name. Anyone have a way around this ? You'd have to declare PyArray_API static in each module, but that won't be easy as some modules consist of more than one C source file. A more complicated solution would be to construct different names for this variable in different modules using preprocessor tricks in Numeric/arrayobject.h. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From tavis at calrudd.com Tue Apr 17 15:17:00 2001 From: tavis at calrudd.com (Tavis Rudd) Date: Tue, 17 Apr 2001 12:17:00 -0700 Subject: [Numpy-discussion] more on MA not pickling Message-ID: <01041712170000.08477@lucy> Hi, I posted something about this a few weeks ago, but got distracted before I had a chance to look into it further ... Revisions 1.5 and up of activeattr.py in the MA package cause a fatal error when pickling is attempted. The pickle and cPickle modules don't allow unbound instance methods to be pickled and the ActiveAttributes mixin is storing attribute handlers, such as ActiveAttribute.basic_get, as unbound instance methods. Revision 1.4 works fine if basic_get is modified so that an AttributeError is raised instead of a KeyError when an attribute is not found. This bug was introduced in an attempt to allow child classes of MA to be able to modify activeattributes. I suggest reverting back to rev 1.4 of activeattr with a modified basic_get method and forgetting about allowing child classes to do this. Cheers Tavis From johann at physics.berkeley.edu Tue Apr 17 15:11:53 2001 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 17 Apr 2001 12:11:53 -0700 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: Konrad Hinsen's message of "Tue, 17 Apr 2001 18:44:58 +0200" References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> Message-ID: Konrad Hinsen writes: > You'd have to declare PyArray_API static in each module, but that > won't be easy as some modules consist of more than one C source file. All I did was insert a #define NO_IMPORT_ARRAY before the #include "arrayobject.h" in umathmodule.c I repeated this for all the Packages, and it seems to work just fine. --Johann -- Johann Hibschman johann at physics.berkeley.edu From dubois1 at llnl.gov Tue Apr 17 15:20:16 2001 From: dubois1 at llnl.gov (Paul F. Dubois) Date: Tue, 17 Apr 2001 12:20:16 -0700 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> Message-ID: <01041712213402.11576@almanac> On Tue, 17 Apr 2001, Johann Hibschman wrote: > Konrad Hinsen writes: > > > You'd have to declare PyArray_API static in each module, but that > > won't be easy as some modules consist of more than one C source file. > > > All I did was insert a > > #define NO_IMPORT_ARRAY > > before the > #include "arrayobject.h" > > in umathmodule.c > > I repeated this for all the Packages, and it seems to work just fine. > > --Johann > > -- > Johann Hibschman johann at physics.berkeley.edu > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion at lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/numpy-discussion Such a change breaks other platforms... From johann at physics.berkeley.edu Tue Apr 17 15:44:12 2001 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 17 Apr 2001 12:44:12 -0700 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: "Paul F. Dubois"'s message of "Tue, 17 Apr 2001 12:20:16 -0700" References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> <01041712213402.11576@almanac> Message-ID: Paul F Dubois writes: > On Tue, 17 Apr 2001, Johann Hibschman wrote: >> >> All I did was insert a >> >> #define NO_IMPORT_ARRAY >> before the >> #include "arrayobject.h" >> in umathmodule.c > Such a change breaks other platforms... Could you give a quick explanation why? I thought the whole point of the "extern" specifier was to flag that this variable was defined elsewhere. Otherwise, doesn't it imply that the API pointer is defined in each file that includes arrayobject.h? i.e. shouldn't headers declare "extern double x" for everything except the file that actually defines x? I should go back and read my copy of K&R... --Johann -- Johann Hibschman johann at physics.berkeley.edu From KRodgers at ryanaero.com Tue Apr 17 16:07:30 2001 From: KRodgers at ryanaero.com (Rodgers, Kevin) Date: Tue, 17 Apr 2001 13:07:30 -0700 Subject: [Numpy-discussion] PyArray_API, NO_IMPORT, and NO_IMPORT_ARRAY Message-ID: <0D8C1A50C283D311ABB800508B612E5301FA8897@xcgca065.ryanaero.com> I'm working on a project where I'm embedding Python and NumPy (on Win32). For various reasons, I need to have all of my source files as C++, even though I'm not using any C++ features (just using it as a "better C"). When Visual C++ goes to link, I get the following error: Linking... vtuav_sim_wrap.obj : error LNK2005: _PyArray_API already defined in vtuav_sim.obj vtuav_sim_wrap.obj : warning LNK4006: _PyArray_API already defined in vtuav_sim.obj; second definition ignored Creating library Release/vtuav_simc.lib and object Release/vtuav_simc.exp Release/vtuav_simc.dll : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. The error is caused by the following lines in arrayobject.h: /* C API address pointer */ #if defined(NO_IMPORT) || defined(NO_IMPORT_ARRAY) extern void **PyArray_API; #else void **PyArray_API; #define NO_PYARRAY_API #endif Because I'm including the arrayobject.h header in two different source code modules, and neither NO_IMPORT or NO_IMPORT_ARRAY are defined, the "else" clause gets executed, which causes the "multiply defined symbol" error. This also appears to be the root cause of the problems currently being discussed on the list about MacOS X. So, how can this problem be fixed? I must confess that I don't understand the code in arrayobject.h that uses PyArray_API. Any ideas? Thanks in advance . . . -- Kevin Rodgers Northrop Grumman Ryan Aeronautical krodgers at ryanaero.com "This one goes up to eleven." -- Nigel Tufnel From pete at shinners.org Tue Apr 17 16:22:45 2001 From: pete at shinners.org (Pete Shinners) Date: Tue, 17 Apr 2001 13:22:45 -0700 Subject: [Numpy-discussion] Win32 19.0.0 for Python-2.1 References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> <01041712213402.11576@almanac> Message-ID: <008901c0c77c$2a9ba750$f43f93cd@visionart.com> I've built a compiled Numeric-19.0.0 for Python2.1 on Win32. This should be exactly the same as the other version i built for Python-2.0, just built with a different python version. I've put the file up here, hopefully it can soon be moved into the Numeric sourceforge project. http://pygame.seul.org/ftp/contrib/Numeric-19.0.0-Python-2.1.zip From tchur at optushome.com.au Tue Apr 17 17:04:28 2001 From: tchur at optushome.com.au (Tim Churches) Date: Wed, 18 Apr 2001 07:04:28 +1000 Subject: [Numpy-discussion] more on MA not pickling References: <01041712170000.08477@lucy> Message-ID: <3ADCAFDC.E24D8294@optushome.com.au> Tavis Rudd wrote: > > Hi, > I posted something about this a few weeks ago, but got > distracted before I had a chance to look into it further > ... > Revisions 1.5 and up of activeattr.py in the MA package > cause a fatal error when pickling is attempted. The pickle > and cPickle modules don't allow unbound instance methods to > be pickled and the ActiveAttributes mixin is storing > attribute handlers, such as ActiveAttribute.basic_get, as > unbound instance methods. > > Revision 1.4 works fine if basic_get is modified so that > an AttributeError is raised instead of a KeyError when an > attribute is not found. > > This bug was introduced in an attempt to allow child > classes of MA to be able to modify activeattributes. I > suggest reverting back to rev 1.4 of activeattr with a > modified basic_get method and forgetting about allowing > child classes to do this. Can I add my voice to Tavis' suggestion? The ability to cPickle MA arrays is absolutely essential. In the health sciences, where some data are **always** missing, MA is a godsend, but it needs to be able to be made a persistent godsend. Cheers, Tim C From tavis at calrudd.com Tue Apr 17 17:28:46 2001 From: tavis at calrudd.com (Tavis Rudd) Date: Tue, 17 Apr 2001 14:28:46 -0700 Subject: [Numpy-discussion] more on MA not pickling In-Reply-To: <01041712160801.11576@almanac> References: <01041712170000.08477@lucy> <01041712160801.11576@almanac> Message-ID: <01041714284601.08477@lucy> > Unfortunately, *my* application does this. (:->. damn, I was hoping you wouldn't say that ;-) > Maybe MA needs to define some special methods to make > this work, so that the objects are pickled without these > attributes and they are restored after being unpickled? do you mean __getstate__ and __setstate__? > There may be another solution but it will take more > effort to develop. I've got a vague idea for another solution that uses the .im_func attribute of methods. I'll toy with it this afternoon and see if I can get it working. Tavis From paul at pfdubois.com Tue Apr 17 20:03:00 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Tue, 17 Apr 2001 17:03:00 -0700 Subject: [Numpy-discussion] Python 2.1 / Numeric-19.1.0 / kinds In-Reply-To: <008901c0c77c$2a9ba750$f43f93cd@visionart.com> Message-ID: I haven't been able to get into the SourceForge ftp site all day, it has maxed out its users. I suspect the Python has become too popular...? Anyway, Pete's zip isn't there yet. Pete, could you tell me privately the method you use for making the zips? I have trouble getting the paths right. I have what will probably be 19.1.0 in CVS now. I have added a package, kinds, which is a reference implementation of PEP 0424 for your exploration. It does not install by default on Unix; you have to edit setup_all.py to make it do that. I plan to add a floating 32-bit scalar type to this module before completion. Here is the current text of the PEP: PEP: 242 Title: Numeric Kinds Version: $Revision: 1.1 $ Author: paul at pfdubois.com (Paul F. Dubois) Status: Draft Type: Standards Track Created: 17-Mar-2001 Python-Version: 2.2 Post-History: Abstract This proposal gives the user optional control over the precision and range of numeric computations so that a computation can be written once and run anywhere with at least the desired precision and range. It is backward compatible with existing code. The meaning of decimal literals is clarified. Rationale Currently it is impossible in every language except Fortran 90 to write a program in a portable way that uses floating point and gets roughly the same answer regardless of platform -- or refuses to compile if that is not possible. Python currently has only one floating point type, equal to a C double in the C implementation. No type exists corresponding to single or quad floats. It would complicate the language to try to introduce such types directly and their subsequent use would not be portable. This proposal is similar to the Fortran 90 "kind" solution, adapted to the Python environment. With this facility an entire calculation can be switched from one level of precision to another by changing a single line. If the desired precision does not exist on a particular machine, the program will fail rather than get the wrong answer. Since coding in this style would involve an early call to the routine that will fail, this is the next best thing to not compiling. Supported Kinds of Ints and Floats Complex numbers are treated separately below, since Python can be built without them. Each Python compiler may define as many "kinds" of integer and floating point numbers as it likes, except that it must support at least two kinds of integer corresponding to the existing int and long, and must support at least one kind of floating point number, equivalent to the present float. The range and precision of the these required kinds are processor dependent, as at present, except for the "long integer" kind, which can hold an arbitrary integer. The built-in functions int(), long(), and float() convert inputs to these default kinds as they do at present. (Note that a Unicode string is actually a different "kind" of string and that a sufficiently knowledgeable person might be able to expand this PEP to cover that case.) Within each type (integer, floating) the compiler supports a linearly-ordered set of kinds, with the ordering determined by the ability to hold numbers of an increased range and/or precision. Kind Objects Two new standard functions are defined in a module named "kinds". They return callable objects called kind objects. Each int or floating kind object f has the signature result = f(x), and each complex kind object has the signature result = f(x, y=0.). int_kind(n) For an integer argument n >= 1, return a callable object whose result is an integer kind that will hold an integer number in the open interval (-10**n,10**n). The kind object accepts arguments that are integers including longs. If n == 0, returns the kind object corresponding to the Python literal 0. float_kind(nd, n) For nd >= 0 and n >= 1, return a callable object whose result is a floating point kind that will hold a floating-point number with at least nd digits of precision and a base-10 exponent in the closed interval [-n, n]. The kind object accepts arguments that are integer or float. If nd and n are both zero, returns the kind object corresponding to the Python literal 0.0. The compiler will return a kind object corresponding to the least of its available set of kinds for that type that has the desired properties. If no kind with the desired qualities exists in a given implementation an OverflowError exception is thrown. A kind function converts its argument to the target kind, but if the result does not fit in the target kind's range, an OverflowError exception is thrown. Besides their callable behavior, kind objects have attributes giving the traits of the kind in question. 1. name is the name of the kind. The standard kinds are called int, long, double. 2. typecode is a single-letter string that would be appropriate for use with Numeric or module array to form an array of this kind. The standard types' typecodes are 'i', 'O', 'd' respectively. 3. Integer kinds have these additional attributes: MAX, equal to the maximum permissible integer of this kind, or None for the long kind. MIN, equal to the most negative permissible integer of this kind, or None for the long kind. 4. Float kinds have these additional attributes whose properties are equal to the corresponding value for the corresponding C type in the standard header file "float.h". MAX, MIN, DIG, MANT_DIG, EPSILON, MAX_EXP, MAX_10_EXP, MIN_EXP, MIN_10_EXP, RADIX, ROUNDS (== FLT_RADIX, FLT_ROUNDS in float.h) These values are of type integer except for MAX, MIN, and EPSILON, which are of the Python floating type to which the kind corresponds. Attributes of Module kinds int_kinds is a list of the available integer kinds, sorted from lowest to highest kind. By definition, int_kinds[-1] is the long kind. float_kinds is a list of the available floating point kinds, sorted from lowest to highest kind. default_int_kind is the kind object corresponding to the Python literal 0 default_long_kind is the kind object corresponding to the Python literal 0L default_float_kind is the kind object corresponding to the Python literal 0.0 Complex Numbers If supported, omplex numbers have real and imaginary parts that are floating-point numbers with the same kind. A Python compiler must support a complex analog of each floating point kind it supports, if it supports complex numbers at all. If complex numbers are supported, the following are available in module kinds: complex_kind(nd, n) Return a callable object whose result is a complex kind that will hold a complex number each of whose components (.real, .imag) is of kind float_kind(nd, n). The kind object will accept one argument that is of any integer, real, or complex kind, or two arguments, each integer or real. complex_kinds is a list of the available complex kinds, sorted from lowest to highest kind. default_complex_kind = is the kind object corresponding to the Python literal 0.0j. The name of this kind is doublecomplex, and its typecode is 'D'. Complex kind objects have these addition attributes: floatkind is the kind object of the corresponding float type. Examples In module myprecision.py: import kinds tinyint = kinds.int_kind(1) single = kinds.float_kind(6, 90) double = kinds.float_kind(15, 300) csingle = kinds.complex_kind(6, 90) In the rest of my code: from myprecision import tinyint, single, double, csingle n = tinyint(3) x = double(1.e20) z = 1.2 # builtin float gets you the default float kind, properties unknown w = x * float(x) # but in the following case we know w has kind "double". w = x * double(z) u = csingle(x + z * 1.0j) u2 = csingle(x+z, 1.0) Note how that entire code can then be changed to a higher precision by changing the arguments in myprecision.py. Comment: note that you aren't promised that single != double; but you are promised that double(1.e20) will hold a number with 15 decimal digits of precision and a range up to 10**300 or that the float_kind call will fail. Open Issues No open issues have been raised at this time. Copyright This document has been placed in the public domain. From ransom at cfa.harvard.edu Tue Apr 17 20:55:28 2001 From: ransom at cfa.harvard.edu (Scott Ransom) Date: Tue, 17 Apr 2001 20:55:28 -0400 Subject: [Numpy-discussion] Cephes Docs References: Message-ID: <3ADCE600.7F9C9DEC@cfa.harvard.edu> Hi Everyone, I've had the following done for awhile and hadn't thought to release it for general use. It is the standard Cephesmodule 1.3 that Travis Oliphant has had available for some time at http://pylab.sourceforge.net with the addition of docstrings for all the functions. I modified the original documentation a bit and simply converted it to docstrings. Simply substitute the new cephesmodule.c file with the one in the Cephes distro and compile as per usual. The docstrings have been a huge beneift for me, as I find the cephes function names a bit cryptic... You can find the file here: http://cfa160.harvard.edu/~ransom/cephesmodule.c Hope it will be useful for some of you as well. Scott -- Scott M. Ransom Address: Harvard-Smithsonian CfA Phone: (617) 495-4142 60 Garden St. MS 10 email: ransom at cfa.harvard.edu Cambridge, MA 02138 GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 From cgw at alum.mit.edu Tue Apr 17 22:26:55 2001 From: cgw at alum.mit.edu (Charles G Waldman) Date: Tue, 17 Apr 2001 21:26:55 -0500 Subject: [Numpy-discussion] Cephes Docs In-Reply-To: <3ADCE600.7F9C9DEC@cfa.harvard.edu> References: <3ADCE600.7F9C9DEC@cfa.harvard.edu> Message-ID: <15068.64367.720966.656266@cgw-sirius.dyndns.org> Scott Ransom writes: > I've had the following done for awhile and hadn't thought to release it > for general use. It is the standard Cephesmodule 1.3 that Travis > Oliphant has had available for some time at http://pylab.sourceforge.net > with the addition of docstrings for all the functions. I modified the > original documentation a bit and simply converted it to docstrings. This message brought me a strange sense of deja vu. A year ago I did the same thing - I submitted a patch which allowed ufuncs to have docstrings, for exactly this reason - the function names in Cephes being a bit cryptic. I also wrote a silly little script to generate the Cephes docstrings from the HTML doc. Please see: http://lists.sourceforge.net/archives/numpy-discussion/2000-March/000091.html From victor at idaccr.org Tue Apr 17 23:07:27 2001 From: victor at idaccr.org (Victor S. Miller) Date: 17 Apr 2001 23:07:27 -0400 Subject: [Numpy-discussion] Sparse Arrays Message-ID: I found by looking up through Google that Travis O. has written a package called SparsePy for manipulating sparse arrays. However, when I tried to download it I was asked for a userid and password. Is this not yet publicly available? Are there any other packages for this that are available? -- Victor S. Miller | " ... Meanwhile, those of us who can compute can hardly victor at idaccr.org | be expected to keep writing papers saying 'I can do the CCR, Princeton, NJ | following useless calculation in 2 seconds', and indeed 08540 USA | what editor would publish them?" -- Oliver Atkin From hinsen at cnrs-orleans.fr Wed Apr 18 08:55:15 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Wed, 18 Apr 2001 14:55:15 +0200 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: (message from Johann Hibschman on 17 Apr 2001 12:11:53 -0700) References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> Message-ID: <200104181255.OAA11927@chinon.cnrs-orleans.fr> > All I did was insert a > > #define NO_IMPORT_ARRAY That works only if all symbols are globally visible, which is not true on most platforms. Does anyone know how shared libraries work in detail under MacOS X? Many systems allow the main executable (Python in our case) to choose what symbols are globally visible. Making changes at this level looks like the best solution to me, if possible. A simple solution would be to change line 262 in Numeric/arrayobject.h from void **PyArray_API; to static void **PyArray_API; This would break all client modules that consist of more than one source code file and make array-related calls in more than the main file. We have no such modules in the current NumPy, but there might of course be third-party modules out there that are affected. Another solution would be to add #define PyArray_API PyArray_API_umath in module umath just before including arrayobject.h, and add similar lines to other client modules. But this would require a modification to all client modules, including third-party modules, to make them work under MacOS. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From hinsen at cnrs-orleans.fr Wed Apr 18 09:29:20 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Wed, 18 Apr 2001 15:29:20 +0200 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: (message from Johann Hibschman on 17 Apr 2001 12:44:12 -0700) References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> <01041712213402.11576@almanac> Message-ID: <200104181329.PAA25173@chinon.cnrs-orleans.fr> > Could you give a quick explanation why? I thought the whole point of > the "extern" specifier was to flag that this variable was defined > elsewhere. Right, but with most platforms' shared library systems, this means "in another source file that is part of the same shared library", not "in another shared library" or "in the main executable". > Otherwise, doesn't it imply that the API pointer is > defined in each file that includes arrayobject.h? > > i.e. shouldn't headers declare "extern double x" for everything except > the file that actually defines x? If a dynamically loaded module consists of more than one source file, then all but one of them (the one which calls import_array()) must define NO_IMPORT_ARRAY before including arrayobject.h. This is also the answer to Kevin Rodgers' question. However, it seems to me that the current arrangement in NumPy has another serious drawback: it should be impossible to link NumPy statically with the Python interpreter, due to multiply defined symbols. And I am rather sure that this was possible many versions ago, since I used NumPy on a Cray T3E, which does not have shared libraries. I checked my own extension modules that export a C API, and they all declare the API pointer static. This is also what the C API export section in the "Extending & Embedding" manual recommends. (OK, I admit that I wrote that section, so that is not a coincidence!) So perhaps the best solution is to make this static. Client modules that consist of more than one source code file with PyArray... calls must then call import_array() once in every such file, or equivalently pass on the PyArray_API pointer explicitly between the files. That sounds quite acceptable to me. BTW, extension modules with more than one source file create a risk of portability problems in any case, as the symbols shared between the files must necessarily be global. On platforms such as MacOS, or with static linking, this means they are global to the interpreter and all extension modules, with a resulting risk of name clashes. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From mary at iitk.ac.in Wed Apr 18 16:36:36 2001 From: mary at iitk.ac.in (T.Meyarivan) Date: Wed, 18 Apr 2001 20:36:36 +0000 (/etc/localtime) Subject: [Numpy-discussion] Bug (?) in numpy 19.0 under win32 Message-ID: Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. IDLE 0.8 -- press F1 for help >>> from Numeric import * >>> from LinearAlgebra import * >>> a = array([[1,0],[0,1]]) >>> print a, type(a) [[1 0] [0 1]] >>> eigenvectors(a) Traceback (most recent call last): File "", line 1, in ? eigenvectors(a) File "c:\program files\python21\numeric\LinearAlgebra.py", line 151, in eigenvectors dummy, 1, vr, n, work, lwork, 0) LapackError: Expected an array for parameter a in lapack_dge.dgeev >>> the above test works fine under unix environment using the same version of python and numpy From managan at llnl.gov Wed Apr 18 15:57:18 2001 From: managan at llnl.gov (Rob Managan) Date: Wed, 18 Apr 2001 12:57:18 -0700 Subject: [Numpy-discussion] Re: Numeric on OS X - Anyone get it to work ? Message-ID: > Konrad Hinsen wrote > > Could you give a quick explanation why? I thought the whole point of >> the "extern" specifier was to flag that this variable was defined >> elsewhere. > >Right, but with most platforms' shared library systems, this means >"in another source file that is part of the same shared library", >not "in another shared library" or "in the main executable". > >> Otherwise, doesn't it imply that the API pointer is >> defined in each file that includes arrayobject.h? >> >> i.e. shouldn't headers declare "extern double x" for everything except >> the file that actually defines x? > >If a dynamically loaded module consists of more than one source file, >then all but one of them (the one which calls import_array()) must >define NO_IMPORT_ARRAY before including arrayobject.h. This is also >the answer to Kevin Rodgers' question. > > >However, it seems to me that the current arrangement in NumPy has >another serious drawback: it should be impossible to link NumPy >statically with the Python interpreter, due to multiply defined >symbols. And I am rather sure that this was possible many versions >ago, since I used NumPy on a Cray T3E, which does not have shared >libraries. > >I checked my own extension modules that export a C API, and they all >declare the API pointer static. This is also what the C API export >section in the "Extending & Embedding" manual recommends. (OK, I admit >that I wrote that section, so that is not a coincidence!) > > >So perhaps the best solution is to make this static. Client modules >that consist of more than one source code file with PyArray... calls >must then call import_array() once in every such file, or equivalently >pass on the PyArray_API pointer explicitly between the files. That >sounds quite acceptable to me. > In my experience porting other libraries to the Mac I find that most Unix boxes are not at all upset by what CodeWarrior calls multiple definitions. The answer in that case was in details that are not specified in the C standard. Section 4.8 of "A Reference Manual" by Harbison and Steele goes into the details of how external names are handled. Most UNIX compilers use the mixed Common Model. In this case you can define a global any number of times and if there is no initializer present they are all merged into one much like a Fortran Common block. My point is that what I consider lazy coding practice (not using externs where needed) is tolerated by many C compilers. I am not competent to comment on the impact of shared libraries on all this. -- *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan LLNL ph: 925-423-0903 P.O. Box 808, L-095 FAX: 925-422-3389 Livermore, CA 94551-0808 From S.I.Reynolds at cs.bham.ac.uk Thu Apr 19 08:06:46 2001 From: S.I.Reynolds at cs.bham.ac.uk (Stuart I Reynolds) Date: Thu, 19 Apr 2001 13:06:46 +0100 (BST) Subject: [Numpy-discussion] Can't assign sequence to PyObject array Message-ID: Is there a standard workaround to allow you to assign a sequence to a a single cell in PyObject array? from Numeric import * # Create a 2*5 array a = array([range(5),range(5)], PyObject) a[0,0] = 4 #OK - assigns an int to element 0,0 a[0,3] = {} #OK - assigns a dict # but, trying to assign an array to element 1,4 # (or any sequence) a[1,4] = array(range(10), Float) The last assignment causes, ValueError: array too large for destination error Doh!! Presumably its trying to treat this as an assignment to a slice. Is this a bug? Clearly it shouldn't be treated as a slice assignment since a[1,4] can only refer to an atomic element in the (2D) array, not a sequence. Cheers, Stuart From paul at pfdubois.com Mon Apr 23 12:29:13 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Mon, 23 Apr 2001 09:29:13 -0700 Subject: [Numpy-discussion] [Annouce] Numeric Python 20.0.0b2 Message-ID: Numpy has been restructured slightly to enable use of distutils to build: Source .tar.gz Source .zip Windows installer (a real installer, not just a zip you unzip) RPM Source RPM Individual Windows installers for optional packages You can get these from http://sourceforge.net/projects/numpy. Changes are: Version 20.0 Redo setup.py so that binary windows installers for Numeric, FFT, MA, etc. can be made automatically. Packages LALITE and RANLIB merged back to top level. Adjustment for BLAS in setup.py. Documentation of Numeric module made more compatible with pydoc. argmin/argmax/argsort/sort errors with axis specs fixed (bug #233805) -- also made them capable of handling args that can be converted to arrays by adding an array(a, copy=0) at the start. Fixes sum, product, cumsum, cumproduct, alltrue, sometrue to deal with zero shape and to take arguments that can be converted to arrays. MA: See changes.txt file in MA for bug fixes and improvements. New option for average to return sum of weights. Fix bug in putmask so that it handles targets of type object. Because of reference counting issues this is done in Python, not C, and would not be more efficient than doing your own loop, but we include it for completeness. In Packages add draft implementation for PEP 0242, Numerical Kinds. Add PyArray_CopyArray to the API (Thanks to Dave Grote). Add defines for cygwin. In arrayobject.h, add static declaration to importing API pointer. May solve OS X problems. Fix bug in FFT packages, added new test. (Thanks to Warren Focke) -- Numerical Python -- a fast array facility for Python. From paul at pfdubois.com Mon Apr 23 13:24:13 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Mon, 23 Apr 2001 10:24:13 -0700 Subject: [Numpy-discussion] Installers for Numeric Message-ID: Dear Nummies, If you picked up the source installer for 20.0.0b2 in the first hour after I released it, it will die when building "kinds". Since you probably don't care, everything else will have been done by then. I have fixed both the .tar.gz and .zip source distributions now. This egregious error gives me the chance to say that I haven't the slightest idea whether the rpm and source rpm work. I just made 'em with Distutils. You rpm freaks out there will have to check it out and if it needs fixing, fix it. But we get so many people asking for those and for the Windows installers that I thought it worth a shot. Distutils burbled along pleasantly while making them, anyway. I did try the Windows installers and although they seem to work the "uninstall" didn't work for me. I have no clue if that is because that command isn't expected to work yet or not. Well informed, aren't I? Can you do better? Please do. == Paul From thomas.heller at ion-tof.com Mon Apr 23 13:50:29 2001 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Mon, 23 Apr 2001 19:50:29 +0200 Subject: [Numpy-discussion] Re: [Distutils] Installers for Numeric References: Message-ID: <081901c0cc1d$e2f4b620$e000a8c0@thomasnotebook> > I did try the Windows installers and although they seem to work the > "uninstall" didn't work for me. I have no clue if that is because that > command isn't expected to work yet or not. This command _is_expected to work (and it did indeed for me). Which problems did you have? Thomas From dubois at users.sourceforge.net Mon Apr 23 13:52:05 2001 From: dubois at users.sourceforge.net (Paul F. Dubois) Date: Mon, 23 Apr 2001 10:52:05 -0700 Subject: [Numpy-discussion] RE: [Distutils] Installers for Numeric In-Reply-To: <081901c0cc1d$e2f4b620$e000a8c0@thomasnotebook> Message-ID: Eeek. It does work for me. I just wasn't doing it right. Being a stupid Unix hacker I was trying to execute a file in Python 2.1 that said RemoveMA-8.6.exe. I should have realized that would not remove MA-8.6. (:-> Indeed, if I do the normal Windows Add/Remove programs, no problem. I do suggest renaming the file, IWouldRemoveMA-8.6IfYouKnewHow.notexe -----Original Message----- From: distutils-sig-admin at python.org [mailto:distutils-sig-admin at python.org]On Behalf Of Thomas Heller Sent: Monday, April 23, 2001 10:50 AM To: Paul F. Dubois; Numpy-Discussion at Lists. Sourceforge. Net Cc: Distutils-Sig at Python.Org Subject: Re: [Distutils] Installers for Numeric > I did try the Windows installers and although they seem to work the > "uninstall" didn't work for me. I have no clue if that is because that > command isn't expected to work yet or not. This command _is_expected to work (and it did indeed for me). Which problems did you have? Thomas _______________________________________________ Distutils-SIG maillist - Distutils-SIG at python.org http://mail.python.org/mailman/listinfo/distutils-sig From thomas.heller at ion-tof.com Mon Apr 23 14:14:04 2001 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Mon, 23 Apr 2001 20:14:04 +0200 Subject: [Numpy-discussion] Re: [Distutils] Installers for Numeric References: Message-ID: <087f01c0cc21$2e5d56f0$e000a8c0@thomasnotebook> > Eeek. It does work for me. I just wasn't doing it right. Being a stupid Unix > hacker I was trying to execute a file in Python 2.1 that said > RemoveMA-8.6.exe. I should have realized that would not remove MA-8.6. (:-> > It's not that easy on windows: The days where you would simply start a program to do something are long gone ;-). I assume you got a message-box, saying something like 'This program is normally run by windows', which seems not to be very good. Probably it should say: 'To remove the MA-8.6 package, please use Control Panel->Add/Remove Programs' or something like that. Thomas > Indeed, if I do the normal Windows Add/Remove programs, no problem. > > I do suggest renaming the file, > IWouldRemoveMA-8.6IfYouKnewHow.notexe From pete at visionart.com Mon Apr 23 21:13:37 2001 From: pete at visionart.com (Pete Shinners) Date: Mon, 23 Apr 2001 18:13:37 -0700 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 References: Message-ID: <00b801c0cc5b$ca6068a0$f43f93cd@visionart.com> > Numpy has been restructured slightly to enable use of distutils to build: wow, you really did turn things around. anyways, sounds great with the option to build all those distributions automatically (guess i'm out of a job there) :] now i'm really keyed to getting something similar for my own project. how are you building the .RPM, i didn't see a spec file anywhere? i was under the impression distutils still needed a SPEC file to do a proper RPM? anyways, i just threw a patch into the sourceforge patch manager. the code compiles and runs great on python2.0 so i thought it would be worthwhile to let the "setup.py" script also work with that version of python. i also cleaned up a couple compiler warnings. (and in the case of blas_lite.c, just turned them off with some pragma) wow, version 20. Numeric must be the highest version numbered project on sourceforge :] From paul at pfdubois.com Tue Apr 24 09:44:50 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Tue, 24 Apr 2001 06:44:50 -0700 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: <00b801c0cc5b$ca6068a0$f43f93cd@visionart.com> Message-ID: Pete wrote: wow, version 20. Numeric must be the highest version numbered project on sourceforge :] My philosophy is to change the major version number if you do ANYTHING that might require changes in client code. In this case I changed things so that if someone had their own way of building (such as a static build) they might need to change their Makefile. I suppose I overdo it but version numbers are free. I had a project that used an automatic system to up the version number every time we made a build. We got to Basis 499 but then we made the next one 5.00 and stopped that system. Basis is now at a leisurely 12.0 after 16 years. _______________________________________________ Numpy-discussion mailing list Numpy-discussion at lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/numpy-discussion From hinsen at cnrs-orleans.fr Tue Apr 24 11:17:55 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Tue, 24 Apr 2001 17:17:55 +0200 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: <00b801c0cc5b$ca6068a0$f43f93cd@visionart.com> (pete@visionart.com) References: <00b801c0cc5b$ca6068a0$f43f93cd@visionart.com> Message-ID: <200104241517.RAA01628@chinon.cnrs-orleans.fr> > now i'm really keyed to getting something similar for my own project. > how are you building the .RPM, i didn't see a spec file anywhere? i was > under the impression distutils still needed a SPEC file to do a proper > RPM? No, it creates one itself from the MANIFEST file plus some optional data given to the setup procedure. It takes some effort to get it to work, but presumably only once, so it looks like worth the effort. I did it for ScientificPython and I am quite happy with the result. However, I am not quite happy with other aspects of Distutils. I tried it on my Molecular Modelling Toolkit as well, but users will kill me if I use this in an official release. Some of the code just needs to be compiled with the highest optimization level, and there is no way I can do that with Distutils. I wonder if that could become a problem for NumPy as well - I wouldn't be surprised if the LAPACK, FFTPACK etc. code needed maximum optimization as well for good results. Did anyone do comparisons? Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From phrxy at csv.warwick.ac.uk Tue Apr 24 14:23:37 2001 From: phrxy at csv.warwick.ac.uk (John J. Lee) Date: Tue, 24 Apr 2001 19:23:37 +0100 (BST) Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: <200104241517.RAA01628@chinon.cnrs-orleans.fr> Message-ID: On Tue, 24 Apr 2001, Konrad Hinsen wrote: [...] > if I use this in an official release. Some of the code just needs to > be compiled with the highest optimization level, and there is no way I > can do that with Distutils. [...] But you can if you're willing to hack things a little bit, surely? Possibly even without hacking -- IIRC there are some things that are supposed to be subclassed in there, aren't there? I don't remember the details now, but I think that subclassing the compiler class will do it, or possibly customize_compiler()...? Neither are the proper ways, if any exist, I'm sure. From the point of view of saving time, of course, this isn't ideal. John From tjlahey at sympatico.ca Wed Apr 25 12:33:45 2001 From: tjlahey at sympatico.ca (Tim Lahey) Date: Wed, 25 Apr 2001 12:33:45 -0400 Subject: [Numpy-discussion] Numeric 20.0.0b2 on OS X Message-ID: <20010425163558.VOLM17629.tomts6-srv.bellnexxia.net@localhost> All, It appears that Paul's changes to Numeric now allow the Numeric modules to at least be imported under Mac OS X. I'll be testing the code further in the next week or so. Thanks Paul! Cheers, Tim Lahey From hinsen at cnrs-orleans.fr Wed Apr 25 14:09:36 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Wed, 25 Apr 2001 20:09:36 +0200 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: (phrxy@csv.warwick.ac.uk) References: Message-ID: <200104251809.UAA03259@chinon.cnrs-orleans.fr> > On Tue, 24 Apr 2001, Konrad Hinsen wrote: > [...] > > if I use this in an official release. Some of the code just needs to > > be compiled with the highest optimization level, and there is no way I > > can do that with Distutils. > [...] > > But you can if you're willing to hack things a little bit, surely? > Possibly even without hacking -- IIRC there are some things that are It would be quite serious hacking. Distutils just calls the compiler exactly as it was called for compiling the Python interpreter. To change the optimization level, I'd have to parse the command to extract any optimization options, remove them, and put my own instead. I can't imagine anything more platform-dependent. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From jack at oratrix.nl Wed Apr 25 18:04:13 2001 From: jack at oratrix.nl (Jack Jansen) Date: Thu, 26 Apr 2001 00:04:13 +0200 Subject: [Numpy-discussion] Tagging the CVS repository Message-ID: <20010425220418.F1DA4E845F@oratrix.oratrix.nl> I'd like to request that the CVS repository be tagged when a distribution is made. I'm building the MacPython 2.1 distribution (which includes numeric) and I was forced to include Numeric 20.0.0b2, because there wasn't a tag that allowed me to check out 19.0 or another stable release... -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen at oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | ++++ see http://www.xs4all.nl/~tank/ ++++ From phrxy at csv.warwick.ac.uk Wed Apr 25 21:54:11 2001 From: phrxy at csv.warwick.ac.uk (John J. Lee) Date: Thu, 26 Apr 2001 02:54:11 +0100 (BST) Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: <200104251809.UAA03259@chinon.cnrs-orleans.fr> Message-ID: On Wed, 25 Apr 2001, Konrad Hinsen wrote: [...] > It would be quite serious hacking. Distutils just calls the compiler > exactly as it was called for compiling the Python interpreter. To change > the optimization level, I'd have to parse the command to extract > any optimization options, remove them, and put my own instead. I can't > imagine anything more platform-dependent. [...] Okay, you have higher standards than me. :) I was imagining just sticking in an '-O' somewhere, or similar. John From hinsen at cnrs-orleans.fr Thu Apr 26 11:55:59 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Thu, 26 Apr 2001 17:55:59 +0200 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: (phrxy@csv.warwick.ac.uk) References: Message-ID: <200104261555.RAA06994@chinon.cnrs-orleans.fr> > Okay, you have higher standards than me. :) I was imagining just > sticking in an '-O' somewhere, or similar. For Linux, for example, I need to replace -O2 by -O3, and only for some files, as others don't work with O3 optimization. Not so simple. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From S.I.Reynolds at cs.bham.ac.uk Sat Apr 28 09:59:46 2001 From: S.I.Reynolds at cs.bham.ac.uk (Stuart I Reynolds) Date: Sat, 28 Apr 2001 14:59:46 +0100 (BST) Subject: [Numpy-discussion] Can't assign sequence to PyObject array In-Reply-To: <001801c0c93b$5df27c80$0200a8c0@petebox> Message-ID: Actually your example works for me too. Looks like only it only works for 1D arrays, >>> a1 = array([range(5), range(5)]).astype('O') >>> a1 array([[0 , 1 , 2 , 3 , 4 ], [0 , 1 , 2 , 3 , 4 ]],'O') >>> a2 = arange(6) >>> a2 array([0, 1, 2, 3, 4, 5]) >>> a1[1,1] = a2 Traceback (most recent call last): File "", line 1, in ? ValueError: array too large for destination >>> a1 = arange(5).astype('O') >>> a1[1] = a2 >>> a1 array([0 , [0 1 2 3 4 5] , 2 , 3 , 4 ],'O') Hmm. This looks like a bug then. I'll submit a bug report. Cheers, Stuart On Thu, 19 Apr 2001, Pete Shinners wrote: > shoot, sorry then, i just tested it and it seemed happy, let me > try again here... > > >>> a1 = arange(5).astype('O') > >>> a2 = arange(5,9) > >>> a1 > array([0 , 1 , 2 , 3 , 4 ],'O') > >>> a2 > array([5, 6, 7, 8]) From tchur at optushome.com.au Sat Apr 28 21:11:29 2001 From: tchur at optushome.com.au (Tim Churches) Date: Sun, 29 Apr 2001 11:11:29 +1000 Subject: [Numpy-discussion] Numpy and the Pentium 4 References: Message-ID: <3AEB6A41.29907A57@optushome.com.au> Does anyone have any experience running Numpy under Linux on a Pentium 4 (P4) system? P4 boxes appear to have some attractions: a 1.7 GHz model is now available, they reputedly have a 400 MHz CPU-to-RAM bus, the Intel 850 chipset used with them supports ECC and the cost of ECC RDRAM needed has fallen to the point that 1 Gbyte of RAM is now quite affordable. It's the high CPU-to-RAM bandwidth which suggests that P4 systems might offer a gain in performance when used with Numpy to manipulate large arrays which is disproprtionate to their higher clock speeds, compared to Pentium 3 systems, which are limited to a 133 MHz CPU-to-RAM bus. Is this born out in practice? Ideally we would like an Alpha box, but they just cost too much from Compaq and I don't think Microway or other alternative Alpha box manufacturers are represented here in Australia. Our problem domain involves a mix of manipulating very large integer arrays and then floating point calculations on smaller arrays, so FP speed is probably not of paramount importance, but memory bandwidth and clock speed probably is (perhaps, maybe, possibly). Tim C Sydney, Australia From Roy.Dragseth at cc.uit.no Sun Apr 29 14:50:39 2001 From: Roy.Dragseth at cc.uit.no (Roy.Dragseth at cc.uit.no) Date: 29 Apr 2001 20:50:39 +0200 Subject: [Numpy-discussion] Numpy and the Pentium 4 In-Reply-To: <3AEB6A41.29907A57@optushome.com.au> References: <3AEB6A41.29907A57@optushome.com.au> Message-ID: Hi, this might not be what you asked for, but... There is a benchmark report comparing 1.7GHz P4 and 1.3 GHz Athlon on http://www.tech-report.com/reviews/2001q2/pentium4-1.7/index.x?pg=1 Mostly gaming and windows stuff, but also a scientific benchmark included (implementing the Hartree-Fock algorithm for those with knowlegde in quantum physics). The Athlon still has an egde even on the scientific benchmark. On the other hand, the stream benchmark numbers for the P4 is some of the most impressive I've seen. http://www.cs.virginia.edu/stream/ So if your application is like an old vector code you might be better off with a P4, but the memory price is insane... Regards, r. -- The Computer Center, University of Troms?, N-9037 TROMS?, Norway. phone:+47 77 64 41 07, fax:+47 77 64 41 00 Roy Dragseth, High Perfomance Computing System Administrator Direct call: +47 77 64 62 56. email: royd at cc.uit.no From tchur at optushome.com.au Sun Apr 29 17:00:14 2001 From: tchur at optushome.com.au (Tim Churches) Date: Mon, 30 Apr 2001 07:00:14 +1000 Subject: [Numpy-discussion] Numpy and the Pentium 4 References: <3AEB6A41.29907A57@optushome.com.au> Message-ID: <3AEC80DE.FE562291@optushome.com.au> Roy.Dragseth at cc.uit.no wrote: > > Hi, this might not be what you asked for, but... > > There is a benchmark report comparing 1.7GHz P4 and 1.3 GHz Athlon on > > http://www.tech-report.com/reviews/2001q2/pentium4-1.7/index.x?pg=1 > > Mostly gaming and windows stuff, but also a scientific benchmark > included (implementing the Hartree-Fock algorithm for those with > knowlegde in quantum physics). The Athlon still has an egde even on > the scientific benchmark. > > On the other hand, the stream benchmark numbers for the P4 is some of > the most impressive I've seen. > > http://www.cs.virginia.edu/stream/ > > So if your application is like an old vector code you might be better > off with a P4, but the memory price is insane... Many thanks. I suspect that the stream benchmarks are quite relevant to our code. Maybe there is no cause for Alpha-envy after all... The costs of RDRAM for the P4 seems to have fallen dramatically in the last few months. And Intel just cut the cost of the P4 itself. Cheers, Tim C From chrishbarker at home.net Mon Apr 30 12:55:10 2001 From: chrishbarker at home.net (Chris Barker) Date: Mon, 30 Apr 2001 09:55:10 -0700 Subject: [Numpy-discussion] Numpy and the Pentium 4 References: <3AEB6A41.29907A57@optushome.com.au> Message-ID: <3AED98EE.6DA71D81@home.net> Tim Churches wrote: >Our problem domain involves a mix of manipulating > very large integer arrays and then floating point calculations on > smaller arrays, so FP speed is probably not of paramount importance, > but memory bandwidth and clock speed probably is (perhaps, maybe, > possibly). Have you checked out the PPC G4 option? Apple certainly like to advertise how fast it can be, which is ussually deceptive, but, in fact the one place iot does shine is large integer manipulations (in the Apple literature: "some photoshop applications"). I havn't done any speed comparisons, but we have found it to pretty fast when using the optimised BLAS from Absoft. Mac OS is pretty patthetic for this kind of application but PPC linux or OS-X should do the trick for you. IT might be worth a little investigating. By the way, just how much does that 400 Mhz memory cost now? -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From tchur at optushome.com.au Mon Apr 30 17:14:57 2001 From: tchur at optushome.com.au (Tim Churches) Date: Tue, 01 May 2001 07:14:57 +1000 Subject: [Numpy-discussion] Numpy and the Pentium 4 References: <3AEB6A41.29907A57@optushome.com.au> <3AED98EE.6DA71D81@home.net> Message-ID: <3AEDD5D1.18655E88@optushome.com.au> Chris Barker wrote: > > Tim Churches wrote: > >Our problem domain involves a mix of manipulating > > very large integer arrays and then floating point calculations on > > smaller arrays, so FP speed is probably not of paramount importance, > > but memory bandwidth and clock speed probably is (perhaps, maybe, > > possibly). > > Have you checked out the PPC G4 option? Apple certainly like to > advertise how fast it can be, which is ussually deceptive, but, in fact > the one place iot does shine is large integer manipulations (in the > Apple literature: "some photoshop applications"). I havn't done any > speed comparisons, but we have found it to pretty fast when using the > optimised BLAS from Absoft. > > Mac OS is pretty patthetic for this kind of application but PPC linux or > OS-X should do the trick for you. IT might be worth a little > investigating. Yes, I had the same thought but it appears that the speed of the CPU-to-main-RAM bus in the G4s leaves a lot to be desired, but the CPUs do have a largish local cache which enables lots of speed on problems with high locality. The other problem is that they don't come standard with SCSI discs and our local Apple dealer seemed unsure what to do when it came to SCSI. He had never heard of PPC Linux. Also, our local IT support people just about tolerate us running Linux on Intel hardware connected to "their" network, but the thought of throwing Apple OSs into the mix would give them conniptions, I suspect. > > By the way, just how much does that 400 Mhz memory cost now? I think the memory is only 100MHz but it is "quad-clocked" and "double ported" or somesuch. Anyway, Dell Australia are quoting about AUD$2800 for "4 x 256MB PC800 ECC RAMBUS RIMM" - that's about US$1400. Seems cheap to me, for somewhat specialised memory. Compaq were quoting nearly three times as much for the same memory modules for their equivalent workstation. Cheers, Tim C Sydney, Australia From paul at pfdubois.com Sun Apr 1 23:24:24 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Sun, 1 Apr 2001 20:24:24 -0700 Subject: [Numpy-discussion] arg matrix max question In-Reply-To: <002c01c0d29e$865b9af0$cfefb418@cc911046a> Message-ID: >>> x array([[ 0, 1, 2, 3, 4, 5], [ 6, 7, 8, 9, 10, 11], [ 12, 13, 14, 15, 1000, 17], [ 18, 19, 20, 21, 22, 23]]) >>> n = argmax(ravel(x)) >>> divmod(n, x.shape[1]) (2, 4) >>> x[2,4] 1000 >>> divmod is a builtin -- the rest are from Numeric. -----Original Message----- From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Eric Hagemann Sent: Tuesday, May 01, 2001 5:26 PM To: Numpy-discussion at lists.sourceforge.net Subject: [Numpy-discussion] arg matrix max question I need to find the location of the maximum value in a two dimensional Numeric array The best I have come up with uses a couple of calls to argmax and then cross checking the results I know there must be a better way and that I am not the only one who needs to do such a thing Anybody got a code snippet to share ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From Karl.Bellve at umassmed.edu Tue Apr 3 11:20:09 2001 From: Karl.Bellve at umassmed.edu (Karl Bellve) Date: Tue, 03 Apr 2001 11:20:09 -0400 Subject: [Numpy-discussion] Web Server Message-ID: <3AC9EA29.2D0E381B@umassmed.edu> When you go to www.numpy.org, it tries to redirect you to www.numpy.org/numeric/ which it can't find... -- Cheers, Karl Bellve, Ph.D. ICQ # 13956200 Biomedical Imaging Group TLCA# 7938 University of Massachusetts Email: Karl.Bellve at umassmed.edu Phone: (508) 856-6514 Fax: (508) 856-1840 PGP Public key: finger kdb at molmed.umassmed.edu From Karl.Bellve at umassmed.edu Tue Apr 3 11:30:45 2001 From: Karl.Bellve at umassmed.edu (Karl Bellve) Date: Tue, 03 Apr 2001 11:30:45 -0400 Subject: [Numpy-discussion] Using Numpy inside an application... Message-ID: <3AC9ECA5.F6DF58AC@umassmed.edu> Since I can't search the web site, here is a question... I am using the following calls inside my C++ app: import_array(); a=PyRun_SimpleString("from image_module import *"); // my module for wrapping a C++ class a=PyRun_SimpleString("image=imagemanager()\n"); // load a new instance of the class into Python a=PyRun_SimpleString("a=image.GetImage(0)"); // assign image 0 to a Basically, GetImage() returns a numpy Array Object for image 0, properly initialized by PyArray_FromDimsAndData(). I can't return all the images because they might not be sequential in memory (off loaded to the filesystem). "a" appears to be an list of numbers. I am not sure if Python knows it is a PyArrayObject. This is where I am getting into trouble. I can't do something like a=PyRun_SimpleString("a = a + 100"); I get an error "Value Error: Function not Supported". I am trying to figure out what namespace did "import_array()" import Numeric into. Also, I am using _numpy_d.pyd that I compiled under Windows NT and MSVC 6.0. -- Cheers, Karl Bellve, Ph.D. ICQ # 13956200 Biomedical Imaging Group TLCA# 7938 University of Massachusetts Email: Karl.Bellve at umassmed.edu Phone: (508) 856-6514 Fax: (508) 856-1840 PGP Public key: finger kdb at molmed.umassmed.edu From dubois1 at llnl.gov Tue Apr 3 11:32:09 2001 From: dubois1 at llnl.gov (Paul F. Dubois) Date: Tue, 3 Apr 2001 08:32:09 -0700 Subject: [Numpy-discussion] redirection? Message-ID: <01040308343800.21243@almanac> Since I made that typo I have people going to pfdubois.com/numeric when I actually made it /numpy. I can create a numerc -- but I think it would be nicer if I did the automatic redirection trick. So what does one do to get a browser to switch to a different site? From Karl.Bellve at umassmed.edu Tue Apr 3 11:45:35 2001 From: Karl.Bellve at umassmed.edu (Karl Bellve) Date: Tue, 03 Apr 2001 11:45:35 -0400 Subject: [Numpy-discussion] redirection? References: <01040308343800.21243@almanac> Message-ID: <3AC9F01F.A96306AD@umassmed.edu> Here is a template html page. Change the appropiate content/urls and put this in www.python.org/numeric/ You are being redirected This page was been moved. If you aren't redirected automatically, please click here. "Paul F. Dubois" wrote: > > Since I made that typo I have people going to pfdubois.com/numeric when I > actually made it /numpy. I can create a numerc -- but I think it would be nicer > if I did the automatic redirection trick. So what does one do to get a browser > to switch to a different site? > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion at lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Cheers, Karl Bellve, Ph.D. ICQ # 13956200 Biomedical Imaging Group TLCA# 7938 University of Massachusetts Email: Karl.Bellve at umassmed.edu Phone: (508) 856-6514 Fax: (508) 856-1840 PGP Public key: finger kdb at molmed.umassmed.edu From mdrumheller at yahoo.com Tue Apr 3 11:50:48 2001 From: mdrumheller at yahoo.com (Michael Drumheller) Date: Tue, 3 Apr 2001 08:50:48 -0700 (PDT) Subject: [Numpy-discussion] numpy newbie question Message-ID: <20010403155048.190.qmail@web12108.mail.yahoo.com> Hi, I am pretty new to numpy and am using it for image processing. (Also, I am not 100% sure that this is the appropriate email address for this question--feel free to redirect me.) My problem is that I would like to be able to dive down into C and write my own filters etc., but I do not want to have to surmount the somewhat daunting Python/C-extension learning curve if that is at all possible. I am wondering if anybody has "packaged" this ability anywhere, sort of like Perl's Inline.pm. Thanks, Mike Drumheller ===== Michael Drumheller 2735 NE 87th Street, Seattle, Washington 98115 206/523-7865 drumheller at alum.mit.edu __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ From jsaenz at wm.lc.ehu.es Tue Apr 3 11:59:48 2001 From: jsaenz at wm.lc.ehu.es (Jon Saenz) Date: Tue, 3 Apr 2001 17:59:48 +0200 (MET DST) Subject: [Numpy-discussion] numpy newbie question In-Reply-To: <20010403155048.190.qmail@web12108.mail.yahoo.com> Message-ID: Try SWIG (http://www.swig.org), to see whether it supports your needs. Jon Saenz. | Tfno: +34 946012470 Depto. Fisica Aplicada II | Fax: +34 944648500 Facultad de Ciencias. \\ Universidad del Pais Vasco \\ Apdo. 644 \\ 48080 - Bilbao \\ SPAIN On Tue, 3 Apr 2001, Michael Drumheller wrote: > Hi, > I am pretty new to numpy and am using it for > image processing. (Also, I am not 100% sure > that this is the appropriate email address for > this question--feel free to redirect me.) > My problem is that I would like to be able > to dive down into C and write my own filters etc., > but I do not want to have to surmount the > somewhat daunting Python/C-extension learning curve if > that is at all possible. I am wondering if > anybody has "packaged" this ability anywhere, > sort of like Perl's Inline.pm. > Thanks, > Mike Drumheller > > ===== > Michael Drumheller > 2735 NE 87th Street, Seattle, Washington 98115 > 206/523-7865 drumheller at alum..mit.edu > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion at lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/numpy-discussion > From siopis at astro.ufl.edu Tue Apr 3 11:09:31 2001 From: siopis at astro.ufl.edu (Christos Siopis ) Date: Tue, 3 Apr 2001 18:09:31 +0300 (EEST) Subject: [Numpy-discussion] Documentation typos Message-ID: I was reading some sections of the latest NumPy tutorial (the one currently listed as http://pfdubois.com/numpy/numdoc.pdf ) and spotted these typos, listed below in case you want to fix them. Page numbers refer to the actual page numbers printed on the page (not the PDF document's numbers). - p.14: "A very useful features of arrays..." (should be "feature"). - p.15, top-of-page NumPy example: arrays are shown printed before the corresponding "print" command (see "print a" and "print b"). - p.17: in the "Advanced Users" section: the explanation of what these sections are for should perhaps be included in the previous page's "Advanced Users" section, since that one is the first such occurrence in the tutorial. - p.19, near the end: Above "identity": "The first example BELOW satisfies... while the second array ...": there is only one example "below", the buggy example. The first, correct example is probably the one given previously on the same page. Christos From Karl.Bellve at umassmed.edu Tue Apr 3 13:35:50 2001 From: Karl.Bellve at umassmed.edu (Karl Bellve) Date: Tue, 03 Apr 2001 13:35:50 -0400 Subject: [Numpy-discussion] Using Numpy inside an application... References: <3AC9ECA5.F6DF58AC@umassmed.edu> Message-ID: <3ACA09F6.5953CCE6@umassmed.edu> Karl Bellve wrote: > > Since I can't search the web site, here is a question... > > > "a" appears to be an list of numbers. I am not sure if Python knows it > is a PyArrayObject. This is where I am getting into trouble. I can't do > something like a=PyRun_SimpleString("a = a + 100"); I get an error > "Value Error: Function not Supported". > > I corrected a few things. First, I wasn't importing Numeric but just import_array (thanks to Pete Shinners). Although I am getting DLL collisions and relocations, it still works. I am able to do the following now: a=a+100. I need to figure out why I am getting the DLL collisions... -- Cheers, Karl Bellve From paul at pfdubois.com Tue Apr 3 18:56:11 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Tue, 3 Apr 2001 15:56:11 -0700 Subject: [Numpy-discussion] Documentation typos In-Reply-To: Message-ID: Changes in my master copy, will appear next release. Thanks very much. The last point was interesting as due to rich comparisons the buggy example no longer had an exception, but it didn't work "right" either. I expanded the example to explain. -----Original Message----- From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Christos Siopis Sent: Tuesday, April 03, 2001 8:10 AM To: numpy-discussion at lists.sourceforge.net Subject: [Numpy-discussion] Documentation typos I was reading some sections of the latest NumPy tutorial (the one currently listed as http://pfdubois.com/numpy/numdoc.pdf ) and spotted these typos, listed below in case you want to fix them. Page numbers refer to the actual page numbers printed on the page (not the PDF document's numbers). - p.14: "A very useful features of arrays..." (should be "feature"). - p.15, top-of-page NumPy example: arrays are shown printed before the corresponding "print" command (see "print a" and "print b"). - p.17: in the "Advanced Users" section: the explanation of what these sections are for should perhaps be included in the previous page's "Advanced Users" section, since that one is the first such occurrence in the tutorial. - p.19, near the end: Above "identity": "The first example BELOW satisfies... while the second array ...": there is only one example "below", the buggy example. The first, correct example is probably the one given previously on the same page. Christos _______________________________________________ Numpy-discussion mailing list Numpy-discussion at lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/numpy-discussion From dubois at users.sourceforge.net Tue Apr 3 19:05:34 2001 From: dubois at users.sourceforge.net (Paul F. Dubois) Date: Tue, 3 Apr 2001 16:05:34 -0700 Subject: [Numpy-discussion] redirection? In-Reply-To: <3AC9F01F.A96306AD@umassmed.edu> Message-ID: It works! Thanks for coming to my aid. -----Original Message----- From: Karl Bellve [mailto:Karl.Bellve at umassmed.edu] Sent: Tuesday, April 03, 2001 8:46 AM To: Paul F. Dubois; Numpy Subject: Re: [Numpy-discussion] redirection? Here is a template html page. Change the appropiate content/urls and put this in www.python.org/numeric/ You are being redirected This page was been moved. If you aren't redirected automatically, please click here. "Paul F. Dubois" wrote: > > Since I made that typo I have people going to pfdubois.com/numeric when I > actually made it /numpy. I can create a numerc -- but I think it would be nicer > if I did the automatic redirection trick. So what does one do to get a browser > to switch to a different site? > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion at lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Cheers, Karl Bellve, Ph.D. ICQ # 13956200 Biomedical Imaging Group TLCA# 7938 University of Massachusetts Email: Karl.Bellve at umassmed.edu Phone: (508) 856-6514 Fax: (508) 856-1840 PGP Public key: finger kdb at molmed.umassmed.edu From ransom at cfa.harvard.edu Tue Apr 3 21:05:13 2001 From: ransom at cfa.harvard.edu (Scott Ransom) Date: Tue, 03 Apr 2001 21:05:13 -0400 Subject: [Numpy-discussion] curious FFFT timing References: <006801c0d434$9e7d3ed0$cfefb418@cc911046a> Message-ID: <3ACA7349.421BAD50@cfa.harvard.edu> Hi Eric, > Any one want to speculate on the timing difference for the 4095 vice > 4096 long transforms ? > Since 4095 is not a power of two I would have expected a greater time > difference (DFT vice FFT) You are correct in that 4095 is not a power of two, but is is the product of only small prime factors: 3 * 3 * 5 * 7 * 13 = 4095 Since the FFT code implements a N*log_2(N) algorithm for numbers that contain only small prime factors, the difference in times is rather small. FFTs that have lengths that are powers-of-two tend to be more efficient in general (since the decimation routines are cleaner for this case). If you test with 4097 (17 * 241) it will be quite a bit slower I'd guess... Scott -- Scott M. Ransom Address: Harvard-Smithsonian CfA Phone: (617) 495-4142 60 Garden St. MS 10 email: ransom at cfa.harvard.edu Cambridge, MA 02138 GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 From hinsen at cnrs-orleans.fr Wed Apr 4 10:14:48 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Wed, 4 Apr 2001 16:14:48 +0200 Subject: [Numpy-discussion] Citing NumPy Message-ID: <200104041414.QAA26362@chinon.cnrs-orleans.fr> I am just working on an article describing a program which makes heavy use of NumPy, so I should cite some reference to it. Did anyone do this before? What is the most appropriate reference? I think URLs are acceptable these days, but it should be a rather stable one. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From pete at shinners.org Thu Apr 5 03:09:15 2001 From: pete at shinners.org (Pete Shinners) Date: Thu, 5 Apr 2001 00:09:15 -0700 Subject: [Numpy-discussion] Broken Win32 Package for 19.0 References: <200104041414.QAA26362@chinon.cnrs-orleans.fr> Message-ID: <00f401c0bd9f$54ba0220$0200a8c0@petebox> hey folks. i'm the guy who put the win32 package for Numeric-19.0 for Python-2.0 together. turns out the package is missing one small and important file, the Numeric.pth file. i've just found out about this and created a new archive that actually works. hopefully this can replace the current file available for download on the sourceforge pages. http://pygame.seul.org/ftp/contrib/Numeric-19.0.0b-Python-2.0.zip sorry about the foul-up, hopefully no one got stuck on it. i only just received an email about the problem tonight. From paul at pfdubois.com Thu Apr 5 11:33:09 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Thu, 5 Apr 2001 08:33:09 -0700 Subject: [Numpy-discussion] Broken Win32 Package for 19.0 In-Reply-To: <00f401c0bd9f$54ba0220$0200a8c0@petebox> Message-ID: Done. Erroneous file removed. -----Original Message----- From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Pete Shinners Sent: Thursday, April 05, 2001 12:09 AM To: numpy-discussion at lists.sourceforge.net Subject: [Numpy-discussion] Broken Win32 Package for 19.0 hey folks. i'm the guy who put the win32 package for Numeric-19.0 for Python-2.0 together. turns out the package is missing one small and important file, the Numeric.pth file. i've just found out about this and created a new archive that actually works. hopefully this can replace the current file available for download on the sourceforge pages. http://pygame.seul.org/ftp/contrib/Numeric-19.0.0b-Python-2.0.zip sorry about the foul-up, hopefully no one got stuck on it. i only just received an email about the problem tonight. _______________________________________________ Numpy-discussion mailing list Numpy-discussion at lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/numpy-discussion From tchur at optushome.com.au Sun Apr 8 17:32:09 2001 From: tchur at optushome.com.au (Tim Churches) Date: Mon, 09 Apr 2001 07:32:09 +1000 Subject: [Numpy-discussion] Optimisation of a Numpy set intersection function Message-ID: <3AD0D8D9.774F26D1@optushome.com.au> I have been trying to optimise a simple set intersection function for a Numpy-based application on which I am working. The function needs to find the common elements (i.e the intersection) of two or more Numpy rank-1 arrays of integers passed to it as arguments - call them array A, array B etc. My first attempt used searchsorted() to see where in array A each element of array B would fit and then check if the element in array A at that position equalled the element in array B - if it did, then that element was part of the intersection: def intersect(A,B): c = searchsorted(A,B) d = compress(less(c,len(A)),B) return compress(equal(take(A,compress(less(c,len(A)),c)),d),d) This works OK but it requires the arrays to be stored in sorted order (which is what we did) or to be sorted by the function (not shown). I should add that the arrays passed to the function may have up to a few million elements each. Ole Nielsen at ANU (Australian National University), who gave a paper on data mining using Python at IPC9, suggested an improvement, shown below. Provided the arrays are pre-sorted, Ole's function is about 40% faster than my attempt, and about the same speed if the arrays aren't pre-sorted. However, Ole's function can be generalised to find the intersection of more than two arrays at a time. Most of the time is spent sorting the arrays, and this increases as N.log(N) as the total size of the concatenated arrays (N) increases (I checked this empirically). def intersect(Arraylist): C = sort(concatenate(Arraylist)) D = subtract(C[0:-n], C[n:]) #or # D = convolve(C,[n,-n]) return compress(equal(D,0),C) #or # return take(C,nonzero(equal(D,0))) Paul Dubois suggested the following elegant alternative: def intersect(x,y): return compress(sum(equal(subtract.outer(x,y),0),1),x) Unfortunately, perhaps due to the overhead of creating the rank-2 array to hold the results of the subtract.outer() method call, it turns out to be slower than Ole's function, as well as using huge tracts of memory. My questions for the list, are: a) can anyone suggest any further optimisation of Ole's function, or some alternative? b) how much do you think would be gained by re-implementing this function in C using the Numpy C API? If such an effort would be worthwhile, are there any things we should consider while tackling this task? Regards, Tim Churches Sydney, Australia From Robert.Denham at dnr.qld.gov.au Sun Apr 8 19:06:34 2001 From: Robert.Denham at dnr.qld.gov.au (Robert.Denham at dnr.qld.gov.au) Date: Mon, 9 Apr 2001 09:06:34 +1000 Subject: [Numpy-discussion] Nieghbourhood functions Message-ID: I am looking for efficient ways to code neighbourhood functions. For example a neighbourhod add for an element in an array will simply be the sum of the neighbours: 1 0 2 3 x 3 , then x becomes 7 (first order neighbour), 11 (2nd order) etc. 1 1 0 I would be interested in efficient ways of doing this for a whole array, something like a_nsum = neighbour_sum(a, order=1), where each element in a_nsum is the sum of the corresponding element in a. There must be some work done on neighbourhood functions for arrays, so I would be grateful for some pointers. Thanks, Robert Denham ************************************************************************ The information in this e-mail together with any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any form of review, disclosure, modification, distribution and/or publication of this e-mail message is prohibited. If you have received this message in error, you are asked to inform the sender as quickly as possible and delete this message and any copies of this message from your computer and/or your computer system network. ************************************************************************ From ransom at cfa.harvard.edu Sun Apr 8 21:46:45 2001 From: ransom at cfa.harvard.edu (Scott Ransom) Date: Sun, 08 Apr 2001 21:46:45 -0400 Subject: [Numpy-discussion] Nieghbourhood functions References: Message-ID: <3AD11485.183D7D57@cfa.harvard.edu> Hi Robert, Isn't this just a convolution? For your first order case you are convolving the array with a kernel that looks like: 0 1 0 1 0 1 0 1 0 and for second order: 1 1 1 1 0 1 1 1 1 If this is what you are looking for, there is a convolve function built in to Numeric but it is for rank-1 arrays only. You can use 2D FFTs for a 2D case -- although the efficiency won't be the greatest unless you can use the FFT of the kernel array and/or the data array over and over again (since in general a convolution by FFTs takes 3 FFTs -- 1 for the data, 1 for the kernel, and 1 inverse one after you have multiplied the first two together). It would work well for higher order cases...(but beware of the wrapping that goes on accross the boundaries!) For lower order cases or when you can't re-use the FFTs, you'll probably want a brute force technique -- which I'll leave for someone else... Scott Robert.Denham at dnr.qld.gov.au wrote: > > I am looking for efficient ways to code neighbourhood functions. For > example a neighbourhod add for an element in an array will simply be the sum > of the neighbours: > > 1 0 2 > 3 x 3 , then x becomes 7 (first order neighbour), 11 (2nd order) etc. > 1 1 0 > > I would be interested in efficient ways of doing this for a whole array, > something like a_nsum = neighbour_sum(a, order=1), where each element in > a_nsum is the sum of the corresponding element in a. -- Scott M. Ransom Address: Harvard-Smithsonian CfA Phone: (617) 495-4142 60 Garden St. MS 10 email: ransom at cfa.harvard.edu Cambridge, MA 02138 GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 From cgw at alum.mit.edu Sun Apr 8 23:36:42 2001 From: cgw at alum.mit.edu (Charles G Waldman) Date: Sun, 8 Apr 2001 22:36:42 -0500 (CDT) Subject: [Numpy-discussion] Nieghbourhood functions In-Reply-To: <3AD11485.183D7D57@cfa.harvard.edu> References: <3AD11485.183D7D57@cfa.harvard.edu> Message-ID: <15057.11850.960826.430382@cgw-sirius.dyndns.org> > Robert.Denham at dnr.qld.gov.au wrote: > > > > I am looking for efficient ways to code neighbourhood functions. For > > example a neighbourhod add for an element in an array will simply be the sum > > of the neighbours: > > > > 1 0 2 > > 3 x 3 , then x becomes 7 (first order neighbour), 11 (2nd order) etc. > > 1 1 0 > > > > I would be interested in efficient ways of doing this for a whole array, > > something like a_nsum = neighbour_sum(a, order=1), where each element in > > a_nsum is the sum of the corresponding element in a. As Scott Ransom already mentioned, these "neighborhood functions" are usually referred to as convolutions and are widely used in signal/image processing. For large convolution kernels, the most efficient implementation is to use Fourier methods, since a convolution in the spatial domain maps to a multiplication in the Fourier domain. However for small kernels this is inefficient because the time spent doing the forward and inverse FFT's dwarfs the time that it would take to just do the convolution. There is a convolve function built into Numeric but it only is implemented for 1-d arrays. It would be nice if this were generalized... when somebody gets the time. In the meanwhile - here are two more comments which may help. If your kernel is separable (i.e. a rank-one matrix, or equivalently, the outer product of a column and a row vector) then the 2-d convolution is equivalent to doing 2 1-d convolutions in sequence. For your "first order neighborhood function" the kernel is 0 1 0 1 0 1 0 1 0 which is not separable. But for the "second order" case, the kernel is 1 1 1 1 0 1 1 1 1 which is *almost* separable if you made that middle 0 into a 1. But if you were to convolve with the kernel 1 1 1 1 1 1 1 1 1 then subtract off the value of the original array, then you'd have what you were looking for. And convolving with this kernel is essentially the same as convolving with the 1-d kernel [1 1 1], then transposing, then convolving with [1 1 1] again, and transposing a second time. This scales up to larger separable kernels. I'm not sure how efficient this winds up being - transposing large arrays can be slow, if the arrays are too large to sit in physical memory - the access pattern of a transpose is hell on virtual memory. Finally, I would suggest that you look at the file Demo/life.py in the Numeric Python distribution - in particular the functions shift_up, shift_down, shift_left, and shift_right. Using these you could write: def first_order(arr): return shift_left(arr) + shift_right(arr) + shift_up(arr) + shift_down(arr) which is nice and terse and understandable, but unfortunately not very memory-efficient. If speed and memory usage are both critical, your best bet is probably to write the functions in C and use SWIG to create Python bindings. Charles G. Waldman Object Environments cgw at objenv.com From turner at blueskystudios.com Mon Apr 9 12:57:53 2001 From: turner at blueskystudios.com (John A. Turner) Date: Mon, 9 Apr 2001 12:57:53 -0400 Subject: [Numpy-discussion] redirection? In-Reply-To: References: <3AC9F01F.A96306AD@umassmed.edu> Message-ID: <15057.59921.747661.656823@denmark.blueskystudios.com> >>>>> "PFD" == Paul F Dubois : PFD> It works! Thanks for coming to my aid. however, that didn't seem to help the http://www.numpy.org/ redirection, as reported here: >>>>> "KB" == Karl Bellve : KB> When you go to www.numpy.org, it tries to redirect you to KB> www.numpy.org/numeric/ which it can't find... I've fixed it so it now redirects to http://pfdubois.com/numpy, and seems to be working sorry for the delay in updating -- John A. Turner, Ph.D. Senior Research Associate Blue Sky Studios, 44 S. Broadway, White Plains, NY 10601 http://www.blueskystudios.com/ (914) 259-6319 From tariq at envisional.com Mon Apr 9 19:13:01 2001 From: tariq at envisional.com (Tariq Rashid) Date: Tue, 10 Apr 2001 00:13:01 +0100 Subject: [Numpy-discussion] wavelets Message-ID: <001001c0c14a$a0f7a9e0$394a063e@badass> I'm about to start work on a wavelets module for python... don't know how far i want to go yet.... is there an existsing project? i couldn't find one! tariq From cspence at sarnoff.com Thu Apr 12 11:13:11 2001 From: cspence at sarnoff.com (Clay Spence) Date: Thu, 12 Apr 2001 11:13:11 -0400 Subject: [Numpy-discussion] RandArray initialization and docs Message-ID: <3AD5C607.11425048@sarnoff.com> Hi, I have occasionally dabbled with numpy in the past, but I'm starting to use it more heavily now. I have two (minor, I think) question/comments: 1) RandomArray seems to be initialized from the time. At least when I repeatedly execute a script that uses RandomArray.uniform, the first number generated changes very little from one invocation to another. For example, with the following file: --------- # testRA.py from RandomArray import * print uniform(-1.0, 1.0) --------- I get: -------- cholla 192% python testRA.py 0.434084415436 cholla 193% python testRA.py 0.433970689774 cholla 194% python testRA.py 0.433856964111 cholla 195% python testRA.py 0.433781266212 -------- Is that really desirable behavior? It is easily fixed in my script; I just generate one random number first and throw it away. (I'm running on a sparc under solaris 2.6.) 2) The example in the documentation on negative strides in slices is incorrect, or old. It says: >>> a = reshape(arrayrange(9),(3,3)) >>> print a[2:-1, 0] [6 3 0] That's not the result I get. I think two colons were wanted there. Clay From paul at pfdubois.com Thu Apr 12 12:45:37 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Thu, 12 Apr 2001 09:45:37 -0700 Subject: [Numpy-discussion] RandArray initialization and docs In-Reply-To: <3AD5C607.11425048@sarnoff.com> Message-ID: -----Original Message----- From: numpy-discussion-admin at lists.sourceforge.net [mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Clay Spence Sent: Thursday, April 12, 2001 8:13 AM To: numpy-discussion Subject: [Numpy-discussion] RandArray initialization and docs 2) The example in the documentation on negative strides in slices is incorrect, or old. It says: >>> a = reshape(arrayrange(9),(3,3)) >>> print a[2:-1, 0] [6 3 0] That's not the result I get. I think two colons were wanted there. --- Corrected in my sources, thank you. The change will migrate into the next release of the manual. From paul at pfdubois.com Fri Apr 13 13:23:37 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Fri, 13 Apr 2001 10:23:37 -0700 Subject: [Numpy-discussion] bugs Message-ID: I am approaching a point where I will cut 19.1. I have reduced the number of bugs in the bug list to six. Please examine this list and see if there is one you could volunteer to fix. Developers, please make fixes directly. Users, please post patches rather than sending email. There are no outstanding patches. From rrdn60 at email.sps.mot.com Fri Apr 13 15:22:58 2001 From: rrdn60 at email.sps.mot.com (Norman Shelley (rrdn60)) Date: Fri, 13 Apr 2001 12:22:58 -0700 Subject: [Numpy-discussion] ?POOMA and Boost? Message-ID: <3AD75212.BC141BF1@email.sps.mot.com> o How would a Python version of POOMA compare/contrast to Numpy? POOMA (Parallel Object-Oriented Methods and Applications) a C++ high performance simulation infrastructure package http://www.acl.lanl.gov/pooma/ Would boost add anything advantages to the current Numpy methodology? http://www.boost.org/ Thanks, Norman Shelley From focke at slac.stanford.edu Fri Apr 13 15:31:05 2001 From: focke at slac.stanford.edu (Warren Focke) Date: Fri, 13 Apr 2001 12:31:05 -0700 (PDT) Subject: [Numpy-discussion] bugs In-Reply-To: Message-ID: 224100 was fixed (by a patch that was incorrectly labeled as being for 124100), but now it's broken again. I'll re-fix it. Warren Focke On Fri, 13 Apr 2001, Paul F. Dubois wrote: > I am approaching a point where I will cut 19.1. I have reduced the number of > bugs in the bug list to six. Please examine this list and see if there is > one you could volunteer to fix. Developers, please make fixes directly. > Users, please post patches rather than sending email. From tjlahey at sympatico.ca Sun Apr 15 22:27:35 2001 From: tjlahey at sympatico.ca (Tim Lahey) Date: Sun, 15 Apr 2001 22:27:35 -0400 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? Message-ID: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> All, I've been trying to get the Numeric-19.0.0 working on Python 2.1b2 under OS X. I've successfully install python and have success with most of the modules, but I have problems with Numeric. I can't get it to even load. The following is what I get when I import Numeric. Python 2.1b2 (#1, 04/09/01, 22:37:35) [GCC Apple DevKit-based CPP 6.0alpha] on darwin1 Type "copyright", "credits" or "license" for more information. >>> import Numeric dyld: python multiple definitions of symbol _PyArray_API /usr/local/lib/python2.1/site-packages/Numeric/multiarray.so definition of _PyArray_API /usr/local/lib/python2.1/site-packages/Numeric/umath.so definition of _PyArray_API At this point, I get returned to the command line (python exits). It appears that the dynamic linker mechanism under OS X doesn't like symbols with the same name. Anyone have a way around this ? Thanks, Tim Lahey tjlahey at sympatico.ca From tchur at optushome.com.au Sun Apr 15 23:08:30 2001 From: tchur at optushome.com.au (Tim Churches) Date: Mon, 16 Apr 2001 13:08:30 +1000 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> Message-ID: <3ADA622E.50414D15@optushome.com.au> Tim Lahey wrote: > I've been trying to get the Numeric-19.0.0 working on Python 2.1b2 under > OS X. If anyone can get it to work, some impressions of the performance available on a G4-based Mac would be welcome. They are reputedly a lot faster than a Pentium 4 and are much cheaper than an Alpha box, at least they are here in Australia. Which begs the question: are there any Numpy benchmarks available to compare Numpy on different platforms, or to compare Numpy with its alternatives on the same platform (Numpy would have to be proven a lot slower for me to change!). Tim C Sydney, Australia From turner at blueskystudios.com Tue Apr 17 11:17:15 2001 From: turner at blueskystudios.com (John A. Turner) Date: Tue, 17 Apr 2001 11:17:15 -0400 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: <3ADA622E.50414D15@optushome.com.au> References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <3ADA622E.50414D15@optushome.com.au> Message-ID: <15068.24187.269848.649078@denmark.blueskystudios.com> >>>>> "TC" == Tim Churches : TC> If anyone can get it to work, some impressions of the performance TC> available on a G4-based Mac would be welcome. They are reputedly a lot TC> faster than a Pentium 4 and are much cheaper than an Alpha box, at least TC> they are here in Australia. I'd be interested in Athlon performance as well... -- John A. Turner, Ph.D. Senior Research Associate Blue Sky Studios, 44 S. Broadway, White Plains, NY 10601 http://www.blueskystudios.com/ (914) 259-6319 From hinsen at cnrs-orleans.fr Tue Apr 17 12:44:58 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Tue, 17 Apr 2001 18:44:58 +0200 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> (message from Tim Lahey on Sun, 15 Apr 2001 22:27:35 -0400) References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> Message-ID: <200104171644.SAA10598@chinon.cnrs-orleans.fr> > dyld: python multiple definitions of symbol _PyArray_API > /usr/local/lib/python2.1/site-packages/Numeric/multiarray.so definition > of _PyArray_API > /usr/local/lib/python2.1/site-packages/Numeric/umath.so definition of > _PyArray_API > > At this point, I get returned to the command line (python exits). It > appears that the dynamic linker mechanism under OS X doesn't like > symbols with the same name. Anyone have a way around this ? You'd have to declare PyArray_API static in each module, but that won't be easy as some modules consist of more than one C source file. A more complicated solution would be to construct different names for this variable in different modules using preprocessor tricks in Numeric/arrayobject.h. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From tavis at calrudd.com Tue Apr 17 15:17:00 2001 From: tavis at calrudd.com (Tavis Rudd) Date: Tue, 17 Apr 2001 12:17:00 -0700 Subject: [Numpy-discussion] more on MA not pickling Message-ID: <01041712170000.08477@lucy> Hi, I posted something about this a few weeks ago, but got distracted before I had a chance to look into it further ... Revisions 1.5 and up of activeattr.py in the MA package cause a fatal error when pickling is attempted. The pickle and cPickle modules don't allow unbound instance methods to be pickled and the ActiveAttributes mixin is storing attribute handlers, such as ActiveAttribute.basic_get, as unbound instance methods. Revision 1.4 works fine if basic_get is modified so that an AttributeError is raised instead of a KeyError when an attribute is not found. This bug was introduced in an attempt to allow child classes of MA to be able to modify activeattributes. I suggest reverting back to rev 1.4 of activeattr with a modified basic_get method and forgetting about allowing child classes to do this. Cheers Tavis From johann at physics.berkeley.edu Tue Apr 17 15:11:53 2001 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 17 Apr 2001 12:11:53 -0700 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: Konrad Hinsen's message of "Tue, 17 Apr 2001 18:44:58 +0200" References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> Message-ID: Konrad Hinsen writes: > You'd have to declare PyArray_API static in each module, but that > won't be easy as some modules consist of more than one C source file. All I did was insert a #define NO_IMPORT_ARRAY before the #include "arrayobject.h" in umathmodule.c I repeated this for all the Packages, and it seems to work just fine. --Johann -- Johann Hibschman johann at physics.berkeley.edu From dubois1 at llnl.gov Tue Apr 17 15:20:16 2001 From: dubois1 at llnl.gov (Paul F. Dubois) Date: Tue, 17 Apr 2001 12:20:16 -0700 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> Message-ID: <01041712213402.11576@almanac> On Tue, 17 Apr 2001, Johann Hibschman wrote: > Konrad Hinsen writes: > > > You'd have to declare PyArray_API static in each module, but that > > won't be easy as some modules consist of more than one C source file. > > > All I did was insert a > > #define NO_IMPORT_ARRAY > > before the > #include "arrayobject.h" > > in umathmodule.c > > I repeated this for all the Packages, and it seems to work just fine. > > --Johann > > -- > Johann Hibschman johann at physics.berkeley.edu > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion at lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/numpy-discussion Such a change breaks other platforms... From johann at physics.berkeley.edu Tue Apr 17 15:44:12 2001 From: johann at physics.berkeley.edu (Johann Hibschman) Date: 17 Apr 2001 12:44:12 -0700 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: "Paul F. Dubois"'s message of "Tue, 17 Apr 2001 12:20:16 -0700" References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> <01041712213402.11576@almanac> Message-ID: Paul F Dubois writes: > On Tue, 17 Apr 2001, Johann Hibschman wrote: >> >> All I did was insert a >> >> #define NO_IMPORT_ARRAY >> before the >> #include "arrayobject.h" >> in umathmodule.c > Such a change breaks other platforms... Could you give a quick explanation why? I thought the whole point of the "extern" specifier was to flag that this variable was defined elsewhere. Otherwise, doesn't it imply that the API pointer is defined in each file that includes arrayobject.h? i.e. shouldn't headers declare "extern double x" for everything except the file that actually defines x? I should go back and read my copy of K&R... --Johann -- Johann Hibschman johann at physics.berkeley.edu From KRodgers at ryanaero.com Tue Apr 17 16:07:30 2001 From: KRodgers at ryanaero.com (Rodgers, Kevin) Date: Tue, 17 Apr 2001 13:07:30 -0700 Subject: [Numpy-discussion] PyArray_API, NO_IMPORT, and NO_IMPORT_ARRAY Message-ID: <0D8C1A50C283D311ABB800508B612E5301FA8897@xcgca065.ryanaero.com> I'm working on a project where I'm embedding Python and NumPy (on Win32). For various reasons, I need to have all of my source files as C++, even though I'm not using any C++ features (just using it as a "better C"). When Visual C++ goes to link, I get the following error: Linking... vtuav_sim_wrap.obj : error LNK2005: _PyArray_API already defined in vtuav_sim.obj vtuav_sim_wrap.obj : warning LNK4006: _PyArray_API already defined in vtuav_sim.obj; second definition ignored Creating library Release/vtuav_simc.lib and object Release/vtuav_simc.exp Release/vtuav_simc.dll : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. The error is caused by the following lines in arrayobject.h: /* C API address pointer */ #if defined(NO_IMPORT) || defined(NO_IMPORT_ARRAY) extern void **PyArray_API; #else void **PyArray_API; #define NO_PYARRAY_API #endif Because I'm including the arrayobject.h header in two different source code modules, and neither NO_IMPORT or NO_IMPORT_ARRAY are defined, the "else" clause gets executed, which causes the "multiply defined symbol" error. This also appears to be the root cause of the problems currently being discussed on the list about MacOS X. So, how can this problem be fixed? I must confess that I don't understand the code in arrayobject.h that uses PyArray_API. Any ideas? Thanks in advance . . . -- Kevin Rodgers Northrop Grumman Ryan Aeronautical krodgers at ryanaero.com "This one goes up to eleven." -- Nigel Tufnel From pete at shinners.org Tue Apr 17 16:22:45 2001 From: pete at shinners.org (Pete Shinners) Date: Tue, 17 Apr 2001 13:22:45 -0700 Subject: [Numpy-discussion] Win32 19.0.0 for Python-2.1 References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> <01041712213402.11576@almanac> Message-ID: <008901c0c77c$2a9ba750$f43f93cd@visionart.com> I've built a compiled Numeric-19.0.0 for Python2.1 on Win32. This should be exactly the same as the other version i built for Python-2.0, just built with a different python version. I've put the file up here, hopefully it can soon be moved into the Numeric sourceforge project. http://pygame.seul.org/ftp/contrib/Numeric-19.0.0-Python-2.1.zip From tchur at optushome.com.au Tue Apr 17 17:04:28 2001 From: tchur at optushome.com.au (Tim Churches) Date: Wed, 18 Apr 2001 07:04:28 +1000 Subject: [Numpy-discussion] more on MA not pickling References: <01041712170000.08477@lucy> Message-ID: <3ADCAFDC.E24D8294@optushome.com.au> Tavis Rudd wrote: > > Hi, > I posted something about this a few weeks ago, but got > distracted before I had a chance to look into it further > ... > Revisions 1.5 and up of activeattr.py in the MA package > cause a fatal error when pickling is attempted. The pickle > and cPickle modules don't allow unbound instance methods to > be pickled and the ActiveAttributes mixin is storing > attribute handlers, such as ActiveAttribute.basic_get, as > unbound instance methods. > > Revision 1.4 works fine if basic_get is modified so that > an AttributeError is raised instead of a KeyError when an > attribute is not found. > > This bug was introduced in an attempt to allow child > classes of MA to be able to modify activeattributes. I > suggest reverting back to rev 1.4 of activeattr with a > modified basic_get method and forgetting about allowing > child classes to do this. Can I add my voice to Tavis' suggestion? The ability to cPickle MA arrays is absolutely essential. In the health sciences, where some data are **always** missing, MA is a godsend, but it needs to be able to be made a persistent godsend. Cheers, Tim C From tavis at calrudd.com Tue Apr 17 17:28:46 2001 From: tavis at calrudd.com (Tavis Rudd) Date: Tue, 17 Apr 2001 14:28:46 -0700 Subject: [Numpy-discussion] more on MA not pickling In-Reply-To: <01041712160801.11576@almanac> References: <01041712170000.08477@lucy> <01041712160801.11576@almanac> Message-ID: <01041714284601.08477@lucy> > Unfortunately, *my* application does this. (:->. damn, I was hoping you wouldn't say that ;-) > Maybe MA needs to define some special methods to make > this work, so that the objects are pickled without these > attributes and they are restored after being unpickled? do you mean __getstate__ and __setstate__? > There may be another solution but it will take more > effort to develop. I've got a vague idea for another solution that uses the .im_func attribute of methods. I'll toy with it this afternoon and see if I can get it working. Tavis From paul at pfdubois.com Tue Apr 17 20:03:00 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Tue, 17 Apr 2001 17:03:00 -0700 Subject: [Numpy-discussion] Python 2.1 / Numeric-19.1.0 / kinds In-Reply-To: <008901c0c77c$2a9ba750$f43f93cd@visionart.com> Message-ID: I haven't been able to get into the SourceForge ftp site all day, it has maxed out its users. I suspect the Python has become too popular...? Anyway, Pete's zip isn't there yet. Pete, could you tell me privately the method you use for making the zips? I have trouble getting the paths right. I have what will probably be 19.1.0 in CVS now. I have added a package, kinds, which is a reference implementation of PEP 0424 for your exploration. It does not install by default on Unix; you have to edit setup_all.py to make it do that. I plan to add a floating 32-bit scalar type to this module before completion. Here is the current text of the PEP: PEP: 242 Title: Numeric Kinds Version: $Revision: 1.1 $ Author: paul at pfdubois.com (Paul F. Dubois) Status: Draft Type: Standards Track Created: 17-Mar-2001 Python-Version: 2.2 Post-History: Abstract This proposal gives the user optional control over the precision and range of numeric computations so that a computation can be written once and run anywhere with at least the desired precision and range. It is backward compatible with existing code. The meaning of decimal literals is clarified. Rationale Currently it is impossible in every language except Fortran 90 to write a program in a portable way that uses floating point and gets roughly the same answer regardless of platform -- or refuses to compile if that is not possible. Python currently has only one floating point type, equal to a C double in the C implementation. No type exists corresponding to single or quad floats. It would complicate the language to try to introduce such types directly and their subsequent use would not be portable. This proposal is similar to the Fortran 90 "kind" solution, adapted to the Python environment. With this facility an entire calculation can be switched from one level of precision to another by changing a single line. If the desired precision does not exist on a particular machine, the program will fail rather than get the wrong answer. Since coding in this style would involve an early call to the routine that will fail, this is the next best thing to not compiling. Supported Kinds of Ints and Floats Complex numbers are treated separately below, since Python can be built without them. Each Python compiler may define as many "kinds" of integer and floating point numbers as it likes, except that it must support at least two kinds of integer corresponding to the existing int and long, and must support at least one kind of floating point number, equivalent to the present float. The range and precision of the these required kinds are processor dependent, as at present, except for the "long integer" kind, which can hold an arbitrary integer. The built-in functions int(), long(), and float() convert inputs to these default kinds as they do at present. (Note that a Unicode string is actually a different "kind" of string and that a sufficiently knowledgeable person might be able to expand this PEP to cover that case.) Within each type (integer, floating) the compiler supports a linearly-ordered set of kinds, with the ordering determined by the ability to hold numbers of an increased range and/or precision. Kind Objects Two new standard functions are defined in a module named "kinds". They return callable objects called kind objects. Each int or floating kind object f has the signature result = f(x), and each complex kind object has the signature result = f(x, y=0.). int_kind(n) For an integer argument n >= 1, return a callable object whose result is an integer kind that will hold an integer number in the open interval (-10**n,10**n). The kind object accepts arguments that are integers including longs. If n == 0, returns the kind object corresponding to the Python literal 0. float_kind(nd, n) For nd >= 0 and n >= 1, return a callable object whose result is a floating point kind that will hold a floating-point number with at least nd digits of precision and a base-10 exponent in the closed interval [-n, n]. The kind object accepts arguments that are integer or float. If nd and n are both zero, returns the kind object corresponding to the Python literal 0.0. The compiler will return a kind object corresponding to the least of its available set of kinds for that type that has the desired properties. If no kind with the desired qualities exists in a given implementation an OverflowError exception is thrown. A kind function converts its argument to the target kind, but if the result does not fit in the target kind's range, an OverflowError exception is thrown. Besides their callable behavior, kind objects have attributes giving the traits of the kind in question. 1. name is the name of the kind. The standard kinds are called int, long, double. 2. typecode is a single-letter string that would be appropriate for use with Numeric or module array to form an array of this kind. The standard types' typecodes are 'i', 'O', 'd' respectively. 3. Integer kinds have these additional attributes: MAX, equal to the maximum permissible integer of this kind, or None for the long kind. MIN, equal to the most negative permissible integer of this kind, or None for the long kind. 4. Float kinds have these additional attributes whose properties are equal to the corresponding value for the corresponding C type in the standard header file "float.h". MAX, MIN, DIG, MANT_DIG, EPSILON, MAX_EXP, MAX_10_EXP, MIN_EXP, MIN_10_EXP, RADIX, ROUNDS (== FLT_RADIX, FLT_ROUNDS in float.h) These values are of type integer except for MAX, MIN, and EPSILON, which are of the Python floating type to which the kind corresponds. Attributes of Module kinds int_kinds is a list of the available integer kinds, sorted from lowest to highest kind. By definition, int_kinds[-1] is the long kind. float_kinds is a list of the available floating point kinds, sorted from lowest to highest kind. default_int_kind is the kind object corresponding to the Python literal 0 default_long_kind is the kind object corresponding to the Python literal 0L default_float_kind is the kind object corresponding to the Python literal 0.0 Complex Numbers If supported, omplex numbers have real and imaginary parts that are floating-point numbers with the same kind. A Python compiler must support a complex analog of each floating point kind it supports, if it supports complex numbers at all. If complex numbers are supported, the following are available in module kinds: complex_kind(nd, n) Return a callable object whose result is a complex kind that will hold a complex number each of whose components (.real, .imag) is of kind float_kind(nd, n). The kind object will accept one argument that is of any integer, real, or complex kind, or two arguments, each integer or real. complex_kinds is a list of the available complex kinds, sorted from lowest to highest kind. default_complex_kind = is the kind object corresponding to the Python literal 0.0j. The name of this kind is doublecomplex, and its typecode is 'D'. Complex kind objects have these addition attributes: floatkind is the kind object of the corresponding float type. Examples In module myprecision.py: import kinds tinyint = kinds.int_kind(1) single = kinds.float_kind(6, 90) double = kinds.float_kind(15, 300) csingle = kinds.complex_kind(6, 90) In the rest of my code: from myprecision import tinyint, single, double, csingle n = tinyint(3) x = double(1.e20) z = 1.2 # builtin float gets you the default float kind, properties unknown w = x * float(x) # but in the following case we know w has kind "double". w = x * double(z) u = csingle(x + z * 1.0j) u2 = csingle(x+z, 1.0) Note how that entire code can then be changed to a higher precision by changing the arguments in myprecision.py. Comment: note that you aren't promised that single != double; but you are promised that double(1.e20) will hold a number with 15 decimal digits of precision and a range up to 10**300 or that the float_kind call will fail. Open Issues No open issues have been raised at this time. Copyright This document has been placed in the public domain. From ransom at cfa.harvard.edu Tue Apr 17 20:55:28 2001 From: ransom at cfa.harvard.edu (Scott Ransom) Date: Tue, 17 Apr 2001 20:55:28 -0400 Subject: [Numpy-discussion] Cephes Docs References: Message-ID: <3ADCE600.7F9C9DEC@cfa.harvard.edu> Hi Everyone, I've had the following done for awhile and hadn't thought to release it for general use. It is the standard Cephesmodule 1.3 that Travis Oliphant has had available for some time at http://pylab.sourceforge.net with the addition of docstrings for all the functions. I modified the original documentation a bit and simply converted it to docstrings. Simply substitute the new cephesmodule.c file with the one in the Cephes distro and compile as per usual. The docstrings have been a huge beneift for me, as I find the cephes function names a bit cryptic... You can find the file here: http://cfa160.harvard.edu/~ransom/cephesmodule.c Hope it will be useful for some of you as well. Scott -- Scott M. Ransom Address: Harvard-Smithsonian CfA Phone: (617) 495-4142 60 Garden St. MS 10 email: ransom at cfa.harvard.edu Cambridge, MA 02138 GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 From cgw at alum.mit.edu Tue Apr 17 22:26:55 2001 From: cgw at alum.mit.edu (Charles G Waldman) Date: Tue, 17 Apr 2001 21:26:55 -0500 Subject: [Numpy-discussion] Cephes Docs In-Reply-To: <3ADCE600.7F9C9DEC@cfa.harvard.edu> References: <3ADCE600.7F9C9DEC@cfa.harvard.edu> Message-ID: <15068.64367.720966.656266@cgw-sirius.dyndns.org> Scott Ransom writes: > I've had the following done for awhile and hadn't thought to release it > for general use. It is the standard Cephesmodule 1.3 that Travis > Oliphant has had available for some time at http://pylab.sourceforge.net > with the addition of docstrings for all the functions. I modified the > original documentation a bit and simply converted it to docstrings. This message brought me a strange sense of deja vu. A year ago I did the same thing - I submitted a patch which allowed ufuncs to have docstrings, for exactly this reason - the function names in Cephes being a bit cryptic. I also wrote a silly little script to generate the Cephes docstrings from the HTML doc. Please see: http://lists.sourceforge.net/archives/numpy-discussion/2000-March/000091.html From victor at idaccr.org Tue Apr 17 23:07:27 2001 From: victor at idaccr.org (Victor S. Miller) Date: 17 Apr 2001 23:07:27 -0400 Subject: [Numpy-discussion] Sparse Arrays Message-ID: I found by looking up through Google that Travis O. has written a package called SparsePy for manipulating sparse arrays. However, when I tried to download it I was asked for a userid and password. Is this not yet publicly available? Are there any other packages for this that are available? -- Victor S. Miller | " ... Meanwhile, those of us who can compute can hardly victor at idaccr.org | be expected to keep writing papers saying 'I can do the CCR, Princeton, NJ | following useless calculation in 2 seconds', and indeed 08540 USA | what editor would publish them?" -- Oliver Atkin From hinsen at cnrs-orleans.fr Wed Apr 18 08:55:15 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Wed, 18 Apr 2001 14:55:15 +0200 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: (message from Johann Hibschman on 17 Apr 2001 12:11:53 -0700) References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> Message-ID: <200104181255.OAA11927@chinon.cnrs-orleans.fr> > All I did was insert a > > #define NO_IMPORT_ARRAY That works only if all symbols are globally visible, which is not true on most platforms. Does anyone know how shared libraries work in detail under MacOS X? Many systems allow the main executable (Python in our case) to choose what symbols are globally visible. Making changes at this level looks like the best solution to me, if possible. A simple solution would be to change line 262 in Numeric/arrayobject.h from void **PyArray_API; to static void **PyArray_API; This would break all client modules that consist of more than one source code file and make array-related calls in more than the main file. We have no such modules in the current NumPy, but there might of course be third-party modules out there that are affected. Another solution would be to add #define PyArray_API PyArray_API_umath in module umath just before including arrayobject.h, and add similar lines to other client modules. But this would require a modification to all client modules, including third-party modules, to make them work under MacOS. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From hinsen at cnrs-orleans.fr Wed Apr 18 09:29:20 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Wed, 18 Apr 2001 15:29:20 +0200 Subject: [Numpy-discussion] Numeric on OS X - Anyone get it to work ? In-Reply-To: (message from Johann Hibschman on 17 Apr 2001 12:44:12 -0700) References: <20010416022938.ZEUM6564.tomts8-srv.bellnexxia.net@localhost> <200104171644.SAA10598@chinon.cnrs-orleans.fr> <01041712213402.11576@almanac> Message-ID: <200104181329.PAA25173@chinon.cnrs-orleans.fr> > Could you give a quick explanation why? I thought the whole point of > the "extern" specifier was to flag that this variable was defined > elsewhere. Right, but with most platforms' shared library systems, this means "in another source file that is part of the same shared library", not "in another shared library" or "in the main executable". > Otherwise, doesn't it imply that the API pointer is > defined in each file that includes arrayobject.h? > > i.e. shouldn't headers declare "extern double x" for everything except > the file that actually defines x? If a dynamically loaded module consists of more than one source file, then all but one of them (the one which calls import_array()) must define NO_IMPORT_ARRAY before including arrayobject.h. This is also the answer to Kevin Rodgers' question. However, it seems to me that the current arrangement in NumPy has another serious drawback: it should be impossible to link NumPy statically with the Python interpreter, due to multiply defined symbols. And I am rather sure that this was possible many versions ago, since I used NumPy on a Cray T3E, which does not have shared libraries. I checked my own extension modules that export a C API, and they all declare the API pointer static. This is also what the C API export section in the "Extending & Embedding" manual recommends. (OK, I admit that I wrote that section, so that is not a coincidence!) So perhaps the best solution is to make this static. Client modules that consist of more than one source code file with PyArray... calls must then call import_array() once in every such file, or equivalently pass on the PyArray_API pointer explicitly between the files. That sounds quite acceptable to me. BTW, extension modules with more than one source file create a risk of portability problems in any case, as the symbols shared between the files must necessarily be global. On platforms such as MacOS, or with static linking, this means they are global to the interpreter and all extension modules, with a resulting risk of name clashes. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From mary at iitk.ac.in Wed Apr 18 16:36:36 2001 From: mary at iitk.ac.in (T.Meyarivan) Date: Wed, 18 Apr 2001 20:36:36 +0000 (/etc/localtime) Subject: [Numpy-discussion] Bug (?) in numpy 19.0 under win32 Message-ID: Python 2.1 (#15, Apr 16 2001, 18:25:49) [MSC 32 bit (Intel)] on win32 Type "copyright", "credits" or "license" for more information. IDLE 0.8 -- press F1 for help >>> from Numeric import * >>> from LinearAlgebra import * >>> a = array([[1,0],[0,1]]) >>> print a, type(a) [[1 0] [0 1]] >>> eigenvectors(a) Traceback (most recent call last): File "", line 1, in ? eigenvectors(a) File "c:\program files\python21\numeric\LinearAlgebra.py", line 151, in eigenvectors dummy, 1, vr, n, work, lwork, 0) LapackError: Expected an array for parameter a in lapack_dge.dgeev >>> the above test works fine under unix environment using the same version of python and numpy From managan at llnl.gov Wed Apr 18 15:57:18 2001 From: managan at llnl.gov (Rob Managan) Date: Wed, 18 Apr 2001 12:57:18 -0700 Subject: [Numpy-discussion] Re: Numeric on OS X - Anyone get it to work ? Message-ID: > Konrad Hinsen wrote > > Could you give a quick explanation why? I thought the whole point of >> the "extern" specifier was to flag that this variable was defined >> elsewhere. > >Right, but with most platforms' shared library systems, this means >"in another source file that is part of the same shared library", >not "in another shared library" or "in the main executable". > >> Otherwise, doesn't it imply that the API pointer is >> defined in each file that includes arrayobject.h? >> >> i.e. shouldn't headers declare "extern double x" for everything except >> the file that actually defines x? > >If a dynamically loaded module consists of more than one source file, >then all but one of them (the one which calls import_array()) must >define NO_IMPORT_ARRAY before including arrayobject.h. This is also >the answer to Kevin Rodgers' question. > > >However, it seems to me that the current arrangement in NumPy has >another serious drawback: it should be impossible to link NumPy >statically with the Python interpreter, due to multiply defined >symbols. And I am rather sure that this was possible many versions >ago, since I used NumPy on a Cray T3E, which does not have shared >libraries. > >I checked my own extension modules that export a C API, and they all >declare the API pointer static. This is also what the C API export >section in the "Extending & Embedding" manual recommends. (OK, I admit >that I wrote that section, so that is not a coincidence!) > > >So perhaps the best solution is to make this static. Client modules >that consist of more than one source code file with PyArray... calls >must then call import_array() once in every such file, or equivalently >pass on the PyArray_API pointer explicitly between the files. That >sounds quite acceptable to me. > In my experience porting other libraries to the Mac I find that most Unix boxes are not at all upset by what CodeWarrior calls multiple definitions. The answer in that case was in details that are not specified in the C standard. Section 4.8 of "A Reference Manual" by Harbison and Steele goes into the details of how external names are handled. Most UNIX compilers use the mixed Common Model. In this case you can define a global any number of times and if there is no initializer present they are all merged into one much like a Fortran Common block. My point is that what I consider lazy coding practice (not using externs where needed) is tolerated by many C compilers. I am not competent to comment on the impact of shared libraries on all this. -- *-*-*-*-*-*-*-*-*-*-**-*-*-*-*-*-*-*-*-*-*- Rob Managan LLNL ph: 925-423-0903 P.O. Box 808, L-095 FAX: 925-422-3389 Livermore, CA 94551-0808 From S.I.Reynolds at cs.bham.ac.uk Thu Apr 19 08:06:46 2001 From: S.I.Reynolds at cs.bham.ac.uk (Stuart I Reynolds) Date: Thu, 19 Apr 2001 13:06:46 +0100 (BST) Subject: [Numpy-discussion] Can't assign sequence to PyObject array Message-ID: Is there a standard workaround to allow you to assign a sequence to a a single cell in PyObject array? from Numeric import * # Create a 2*5 array a = array([range(5),range(5)], PyObject) a[0,0] = 4 #OK - assigns an int to element 0,0 a[0,3] = {} #OK - assigns a dict # but, trying to assign an array to element 1,4 # (or any sequence) a[1,4] = array(range(10), Float) The last assignment causes, ValueError: array too large for destination error Doh!! Presumably its trying to treat this as an assignment to a slice. Is this a bug? Clearly it shouldn't be treated as a slice assignment since a[1,4] can only refer to an atomic element in the (2D) array, not a sequence. Cheers, Stuart From paul at pfdubois.com Mon Apr 23 12:29:13 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Mon, 23 Apr 2001 09:29:13 -0700 Subject: [Numpy-discussion] [Annouce] Numeric Python 20.0.0b2 Message-ID: Numpy has been restructured slightly to enable use of distutils to build: Source .tar.gz Source .zip Windows installer (a real installer, not just a zip you unzip) RPM Source RPM Individual Windows installers for optional packages You can get these from http://sourceforge.net/projects/numpy. Changes are: Version 20.0 Redo setup.py so that binary windows installers for Numeric, FFT, MA, etc. can be made automatically. Packages LALITE and RANLIB merged back to top level. Adjustment for BLAS in setup.py. Documentation of Numeric module made more compatible with pydoc. argmin/argmax/argsort/sort errors with axis specs fixed (bug #233805) -- also made them capable of handling args that can be converted to arrays by adding an array(a, copy=0) at the start. Fixes sum, product, cumsum, cumproduct, alltrue, sometrue to deal with zero shape and to take arguments that can be converted to arrays. MA: See changes.txt file in MA for bug fixes and improvements. New option for average to return sum of weights. Fix bug in putmask so that it handles targets of type object. Because of reference counting issues this is done in Python, not C, and would not be more efficient than doing your own loop, but we include it for completeness. In Packages add draft implementation for PEP 0242, Numerical Kinds. Add PyArray_CopyArray to the API (Thanks to Dave Grote). Add defines for cygwin. In arrayobject.h, add static declaration to importing API pointer. May solve OS X problems. Fix bug in FFT packages, added new test. (Thanks to Warren Focke) -- Numerical Python -- a fast array facility for Python. From paul at pfdubois.com Mon Apr 23 13:24:13 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Mon, 23 Apr 2001 10:24:13 -0700 Subject: [Numpy-discussion] Installers for Numeric Message-ID: Dear Nummies, If you picked up the source installer for 20.0.0b2 in the first hour after I released it, it will die when building "kinds". Since you probably don't care, everything else will have been done by then. I have fixed both the .tar.gz and .zip source distributions now. This egregious error gives me the chance to say that I haven't the slightest idea whether the rpm and source rpm work. I just made 'em with Distutils. You rpm freaks out there will have to check it out and if it needs fixing, fix it. But we get so many people asking for those and for the Windows installers that I thought it worth a shot. Distutils burbled along pleasantly while making them, anyway. I did try the Windows installers and although they seem to work the "uninstall" didn't work for me. I have no clue if that is because that command isn't expected to work yet or not. Well informed, aren't I? Can you do better? Please do. == Paul From thomas.heller at ion-tof.com Mon Apr 23 13:50:29 2001 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Mon, 23 Apr 2001 19:50:29 +0200 Subject: [Numpy-discussion] Re: [Distutils] Installers for Numeric References: Message-ID: <081901c0cc1d$e2f4b620$e000a8c0@thomasnotebook> > I did try the Windows installers and although they seem to work the > "uninstall" didn't work for me. I have no clue if that is because that > command isn't expected to work yet or not. This command _is_expected to work (and it did indeed for me). Which problems did you have? Thomas From dubois at users.sourceforge.net Mon Apr 23 13:52:05 2001 From: dubois at users.sourceforge.net (Paul F. Dubois) Date: Mon, 23 Apr 2001 10:52:05 -0700 Subject: [Numpy-discussion] RE: [Distutils] Installers for Numeric In-Reply-To: <081901c0cc1d$e2f4b620$e000a8c0@thomasnotebook> Message-ID: Eeek. It does work for me. I just wasn't doing it right. Being a stupid Unix hacker I was trying to execute a file in Python 2.1 that said RemoveMA-8.6.exe. I should have realized that would not remove MA-8.6. (:-> Indeed, if I do the normal Windows Add/Remove programs, no problem. I do suggest renaming the file, IWouldRemoveMA-8.6IfYouKnewHow.notexe -----Original Message----- From: distutils-sig-admin at python.org [mailto:distutils-sig-admin at python.org]On Behalf Of Thomas Heller Sent: Monday, April 23, 2001 10:50 AM To: Paul F. Dubois; Numpy-Discussion at Lists. Sourceforge. Net Cc: Distutils-Sig at Python.Org Subject: Re: [Distutils] Installers for Numeric > I did try the Windows installers and although they seem to work the > "uninstall" didn't work for me. I have no clue if that is because that > command isn't expected to work yet or not. This command _is_expected to work (and it did indeed for me). Which problems did you have? Thomas _______________________________________________ Distutils-SIG maillist - Distutils-SIG at python.org http://mail.python.org/mailman/listinfo/distutils-sig From thomas.heller at ion-tof.com Mon Apr 23 14:14:04 2001 From: thomas.heller at ion-tof.com (Thomas Heller) Date: Mon, 23 Apr 2001 20:14:04 +0200 Subject: [Numpy-discussion] Re: [Distutils] Installers for Numeric References: Message-ID: <087f01c0cc21$2e5d56f0$e000a8c0@thomasnotebook> > Eeek. It does work for me. I just wasn't doing it right. Being a stupid Unix > hacker I was trying to execute a file in Python 2.1 that said > RemoveMA-8.6.exe. I should have realized that would not remove MA-8.6. (:-> > It's not that easy on windows: The days where you would simply start a program to do something are long gone ;-). I assume you got a message-box, saying something like 'This program is normally run by windows', which seems not to be very good. Probably it should say: 'To remove the MA-8.6 package, please use Control Panel->Add/Remove Programs' or something like that. Thomas > Indeed, if I do the normal Windows Add/Remove programs, no problem. > > I do suggest renaming the file, > IWouldRemoveMA-8.6IfYouKnewHow.notexe From pete at visionart.com Mon Apr 23 21:13:37 2001 From: pete at visionart.com (Pete Shinners) Date: Mon, 23 Apr 2001 18:13:37 -0700 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 References: Message-ID: <00b801c0cc5b$ca6068a0$f43f93cd@visionart.com> > Numpy has been restructured slightly to enable use of distutils to build: wow, you really did turn things around. anyways, sounds great with the option to build all those distributions automatically (guess i'm out of a job there) :] now i'm really keyed to getting something similar for my own project. how are you building the .RPM, i didn't see a spec file anywhere? i was under the impression distutils still needed a SPEC file to do a proper RPM? anyways, i just threw a patch into the sourceforge patch manager. the code compiles and runs great on python2.0 so i thought it would be worthwhile to let the "setup.py" script also work with that version of python. i also cleaned up a couple compiler warnings. (and in the case of blas_lite.c, just turned them off with some pragma) wow, version 20. Numeric must be the highest version numbered project on sourceforge :] From paul at pfdubois.com Tue Apr 24 09:44:50 2001 From: paul at pfdubois.com (Paul F. Dubois) Date: Tue, 24 Apr 2001 06:44:50 -0700 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: <00b801c0cc5b$ca6068a0$f43f93cd@visionart.com> Message-ID: Pete wrote: wow, version 20. Numeric must be the highest version numbered project on sourceforge :] My philosophy is to change the major version number if you do ANYTHING that might require changes in client code. In this case I changed things so that if someone had their own way of building (such as a static build) they might need to change their Makefile. I suppose I overdo it but version numbers are free. I had a project that used an automatic system to up the version number every time we made a build. We got to Basis 499 but then we made the next one 5.00 and stopped that system. Basis is now at a leisurely 12.0 after 16 years. _______________________________________________ Numpy-discussion mailing list Numpy-discussion at lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/numpy-discussion From hinsen at cnrs-orleans.fr Tue Apr 24 11:17:55 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Tue, 24 Apr 2001 17:17:55 +0200 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: <00b801c0cc5b$ca6068a0$f43f93cd@visionart.com> (pete@visionart.com) References: <00b801c0cc5b$ca6068a0$f43f93cd@visionart.com> Message-ID: <200104241517.RAA01628@chinon.cnrs-orleans.fr> > now i'm really keyed to getting something similar for my own project. > how are you building the .RPM, i didn't see a spec file anywhere? i was > under the impression distutils still needed a SPEC file to do a proper > RPM? No, it creates one itself from the MANIFEST file plus some optional data given to the setup procedure. It takes some effort to get it to work, but presumably only once, so it looks like worth the effort. I did it for ScientificPython and I am quite happy with the result. However, I am not quite happy with other aspects of Distutils. I tried it on my Molecular Modelling Toolkit as well, but users will kill me if I use this in an official release. Some of the code just needs to be compiled with the highest optimization level, and there is no way I can do that with Distutils. I wonder if that could become a problem for NumPy as well - I wouldn't be surprised if the LAPACK, FFTPACK etc. code needed maximum optimization as well for good results. Did anyone do comparisons? Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From phrxy at csv.warwick.ac.uk Tue Apr 24 14:23:37 2001 From: phrxy at csv.warwick.ac.uk (John J. Lee) Date: Tue, 24 Apr 2001 19:23:37 +0100 (BST) Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: <200104241517.RAA01628@chinon.cnrs-orleans.fr> Message-ID: On Tue, 24 Apr 2001, Konrad Hinsen wrote: [...] > if I use this in an official release. Some of the code just needs to > be compiled with the highest optimization level, and there is no way I > can do that with Distutils. [...] But you can if you're willing to hack things a little bit, surely? Possibly even without hacking -- IIRC there are some things that are supposed to be subclassed in there, aren't there? I don't remember the details now, but I think that subclassing the compiler class will do it, or possibly customize_compiler()...? Neither are the proper ways, if any exist, I'm sure. From the point of view of saving time, of course, this isn't ideal. John From tjlahey at sympatico.ca Wed Apr 25 12:33:45 2001 From: tjlahey at sympatico.ca (Tim Lahey) Date: Wed, 25 Apr 2001 12:33:45 -0400 Subject: [Numpy-discussion] Numeric 20.0.0b2 on OS X Message-ID: <20010425163558.VOLM17629.tomts6-srv.bellnexxia.net@localhost> All, It appears that Paul's changes to Numeric now allow the Numeric modules to at least be imported under Mac OS X. I'll be testing the code further in the next week or so. Thanks Paul! Cheers, Tim Lahey From hinsen at cnrs-orleans.fr Wed Apr 25 14:09:36 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Wed, 25 Apr 2001 20:09:36 +0200 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: (phrxy@csv.warwick.ac.uk) References: Message-ID: <200104251809.UAA03259@chinon.cnrs-orleans.fr> > On Tue, 24 Apr 2001, Konrad Hinsen wrote: > [...] > > if I use this in an official release. Some of the code just needs to > > be compiled with the highest optimization level, and there is no way I > > can do that with Distutils. > [...] > > But you can if you're willing to hack things a little bit, surely? > Possibly even without hacking -- IIRC there are some things that are It would be quite serious hacking. Distutils just calls the compiler exactly as it was called for compiling the Python interpreter. To change the optimization level, I'd have to parse the command to extract any optimization options, remove them, and put my own instead. I can't imagine anything more platform-dependent. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From jack at oratrix.nl Wed Apr 25 18:04:13 2001 From: jack at oratrix.nl (Jack Jansen) Date: Thu, 26 Apr 2001 00:04:13 +0200 Subject: [Numpy-discussion] Tagging the CVS repository Message-ID: <20010425220418.F1DA4E845F@oratrix.oratrix.nl> I'd like to request that the CVS repository be tagged when a distribution is made. I'm building the MacPython 2.1 distribution (which includes numeric) and I was forced to include Numeric 20.0.0b2, because there wasn't a tag that allowed me to check out 19.0 or another stable release... -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen at oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | ++++ see http://www.xs4all.nl/~tank/ ++++ From phrxy at csv.warwick.ac.uk Wed Apr 25 21:54:11 2001 From: phrxy at csv.warwick.ac.uk (John J. Lee) Date: Thu, 26 Apr 2001 02:54:11 +0100 (BST) Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: <200104251809.UAA03259@chinon.cnrs-orleans.fr> Message-ID: On Wed, 25 Apr 2001, Konrad Hinsen wrote: [...] > It would be quite serious hacking. Distutils just calls the compiler > exactly as it was called for compiling the Python interpreter. To change > the optimization level, I'd have to parse the command to extract > any optimization options, remove them, and put my own instead. I can't > imagine anything more platform-dependent. [...] Okay, you have higher standards than me. :) I was imagining just sticking in an '-O' somewhere, or similar. John From hinsen at cnrs-orleans.fr Thu Apr 26 11:55:59 2001 From: hinsen at cnrs-orleans.fr (Konrad Hinsen) Date: Thu, 26 Apr 2001 17:55:59 +0200 Subject: [Numpy-discussion] Re: [Annouce] Numeric Python 20.0.0b2 In-Reply-To: (phrxy@csv.warwick.ac.uk) References: Message-ID: <200104261555.RAA06994@chinon.cnrs-orleans.fr> > Okay, you have higher standards than me. :) I was imagining just > sticking in an '-O' somewhere, or similar. For Linux, for example, I need to replace -O2 by -O3, and only for some files, as others don't work with O3 optimization. Not so simple. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen at cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From S.I.Reynolds at cs.bham.ac.uk Sat Apr 28 09:59:46 2001 From: S.I.Reynolds at cs.bham.ac.uk (Stuart I Reynolds) Date: Sat, 28 Apr 2001 14:59:46 +0100 (BST) Subject: [Numpy-discussion] Can't assign sequence to PyObject array In-Reply-To: <001801c0c93b$5df27c80$0200a8c0@petebox> Message-ID: Actually your example works for me too. Looks like only it only works for 1D arrays, >>> a1 = array([range(5), range(5)]).astype('O') >>> a1 array([[0 , 1 , 2 , 3 , 4 ], [0 , 1 , 2 , 3 , 4 ]],'O') >>> a2 = arange(6) >>> a2 array([0, 1, 2, 3, 4, 5]) >>> a1[1,1] = a2 Traceback (most recent call last): File "", line 1, in ? ValueError: array too large for destination >>> a1 = arange(5).astype('O') >>> a1[1] = a2 >>> a1 array([0 , [0 1 2 3 4 5] , 2 , 3 , 4 ],'O') Hmm. This looks like a bug then. I'll submit a bug report. Cheers, Stuart On Thu, 19 Apr 2001, Pete Shinners wrote: > shoot, sorry then, i just tested it and it seemed happy, let me > try again here... > > >>> a1 = arange(5).astype('O') > >>> a2 = arange(5,9) > >>> a1 > array([0 , 1 , 2 , 3 , 4 ],'O') > >>> a2 > array([5, 6, 7, 8]) From tchur at optushome.com.au Sat Apr 28 21:11:29 2001 From: tchur at optushome.com.au (Tim Churches) Date: Sun, 29 Apr 2001 11:11:29 +1000 Subject: [Numpy-discussion] Numpy and the Pentium 4 References: Message-ID: <3AEB6A41.29907A57@optushome.com.au> Does anyone have any experience running Numpy under Linux on a Pentium 4 (P4) system? P4 boxes appear to have some attractions: a 1.7 GHz model is now available, they reputedly have a 400 MHz CPU-to-RAM bus, the Intel 850 chipset used with them supports ECC and the cost of ECC RDRAM needed has fallen to the point that 1 Gbyte of RAM is now quite affordable. It's the high CPU-to-RAM bandwidth which suggests that P4 systems might offer a gain in performance when used with Numpy to manipulate large arrays which is disproprtionate to their higher clock speeds, compared to Pentium 3 systems, which are limited to a 133 MHz CPU-to-RAM bus. Is this born out in practice? Ideally we would like an Alpha box, but they just cost too much from Compaq and I don't think Microway or other alternative Alpha box manufacturers are represented here in Australia. Our problem domain involves a mix of manipulating very large integer arrays and then floating point calculations on smaller arrays, so FP speed is probably not of paramount importance, but memory bandwidth and clock speed probably is (perhaps, maybe, possibly). Tim C Sydney, Australia From Roy.Dragseth at cc.uit.no Sun Apr 29 14:50:39 2001 From: Roy.Dragseth at cc.uit.no (Roy.Dragseth at cc.uit.no) Date: 29 Apr 2001 20:50:39 +0200 Subject: [Numpy-discussion] Numpy and the Pentium 4 In-Reply-To: <3AEB6A41.29907A57@optushome.com.au> References: <3AEB6A41.29907A57@optushome.com.au> Message-ID: Hi, this might not be what you asked for, but... There is a benchmark report comparing 1.7GHz P4 and 1.3 GHz Athlon on http://www.tech-report.com/reviews/2001q2/pentium4-1.7/index.x?pg=1 Mostly gaming and windows stuff, but also a scientific benchmark included (implementing the Hartree-Fock algorithm for those with knowlegde in quantum physics). The Athlon still has an egde even on the scientific benchmark. On the other hand, the stream benchmark numbers for the P4 is some of the most impressive I've seen. http://www.cs.virginia.edu/stream/ So if your application is like an old vector code you might be better off with a P4, but the memory price is insane... Regards, r. -- The Computer Center, University of Troms?, N-9037 TROMS?, Norway. phone:+47 77 64 41 07, fax:+47 77 64 41 00 Roy Dragseth, High Perfomance Computing System Administrator Direct call: +47 77 64 62 56. email: royd at cc.uit.no From tchur at optushome.com.au Sun Apr 29 17:00:14 2001 From: tchur at optushome.com.au (Tim Churches) Date: Mon, 30 Apr 2001 07:00:14 +1000 Subject: [Numpy-discussion] Numpy and the Pentium 4 References: <3AEB6A41.29907A57@optushome.com.au> Message-ID: <3AEC80DE.FE562291@optushome.com.au> Roy.Dragseth at cc.uit.no wrote: > > Hi, this might not be what you asked for, but... > > There is a benchmark report comparing 1.7GHz P4 and 1.3 GHz Athlon on > > http://www.tech-report.com/reviews/2001q2/pentium4-1.7/index.x?pg=1 > > Mostly gaming and windows stuff, but also a scientific benchmark > included (implementing the Hartree-Fock algorithm for those with > knowlegde in quantum physics). The Athlon still has an egde even on > the scientific benchmark. > > On the other hand, the stream benchmark numbers for the P4 is some of > the most impressive I've seen. > > http://www.cs.virginia.edu/stream/ > > So if your application is like an old vector code you might be better > off with a P4, but the memory price is insane... Many thanks. I suspect that the stream benchmarks are quite relevant to our code. Maybe there is no cause for Alpha-envy after all... The costs of RDRAM for the P4 seems to have fallen dramatically in the last few months. And Intel just cut the cost of the P4 itself. Cheers, Tim C From chrishbarker at home.net Mon Apr 30 12:55:10 2001 From: chrishbarker at home.net (Chris Barker) Date: Mon, 30 Apr 2001 09:55:10 -0700 Subject: [Numpy-discussion] Numpy and the Pentium 4 References: <3AEB6A41.29907A57@optushome.com.au> Message-ID: <3AED98EE.6DA71D81@home.net> Tim Churches wrote: >Our problem domain involves a mix of manipulating > very large integer arrays and then floating point calculations on > smaller arrays, so FP speed is probably not of paramount importance, > but memory bandwidth and clock speed probably is (perhaps, maybe, > possibly). Have you checked out the PPC G4 option? Apple certainly like to advertise how fast it can be, which is ussually deceptive, but, in fact the one place iot does shine is large integer manipulations (in the Apple literature: "some photoshop applications"). I havn't done any speed comparisons, but we have found it to pretty fast when using the optimised BLAS from Absoft. Mac OS is pretty patthetic for this kind of application but PPC linux or OS-X should do the trick for you. IT might be worth a little investigating. By the way, just how much does that 400 Mhz memory cost now? -Chris -- Christopher Barker, Ph.D. ChrisHBarker at home.net --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ From tchur at optushome.com.au Mon Apr 30 17:14:57 2001 From: tchur at optushome.com.au (Tim Churches) Date: Tue, 01 May 2001 07:14:57 +1000 Subject: [Numpy-discussion] Numpy and the Pentium 4 References: <3AEB6A41.29907A57@optushome.com.au> <3AED98EE.6DA71D81@home.net> Message-ID: <3AEDD5D1.18655E88@optushome.com.au> Chris Barker wrote: > > Tim Churches wrote: > >Our problem domain involves a mix of manipulating > > very large integer arrays and then floating point calculations on > > smaller arrays, so FP speed is probably not of paramount importance, > > but memory bandwidth and clock speed probably is (perhaps, maybe, > > possibly). > > Have you checked out the PPC G4 option? Apple certainly like to > advertise how fast it can be, which is ussually deceptive, but, in fact > the one place iot does shine is large integer manipulations (in the > Apple literature: "some photoshop applications"). I havn't done any > speed comparisons, but we have found it to pretty fast when using the > optimised BLAS from Absoft. > > Mac OS is pretty patthetic for this kind of application but PPC linux or > OS-X should do the trick for you. IT might be worth a little > investigating. Yes, I had the same thought but it appears that the speed of the CPU-to-main-RAM bus in the G4s leaves a lot to be desired, but the CPUs do have a largish local cache which enables lots of speed on problems with high locality. The other problem is that they don't come standard with SCSI discs and our local Apple dealer seemed unsure what to do when it came to SCSI. He had never heard of PPC Linux. Also, our local IT support people just about tolerate us running Linux on Intel hardware connected to "their" network, but the thought of throwing Apple OSs into the mix would give them conniptions, I suspect. > > By the way, just how much does that 400 Mhz memory cost now? I think the memory is only 100MHz but it is "quad-clocked" and "double ported" or somesuch. Anyway, Dell Australia are quoting about AUD$2800 for "4 x 256MB PC800 ECC RAMBUS RIMM" - that's about US$1400. Seems cheap to me, for somewhat specialised memory. Compaq were quoting nearly three times as much for the same memory modules for their equivalent workstation. Cheers, Tim C Sydney, Australia