You can subscribe to this list here.
2000 |
Jan
(8) |
Feb
(49) |
Mar
(48) |
Apr
(28) |
May
(37) |
Jun
(28) |
Jul
(16) |
Aug
(16) |
Sep
(44) |
Oct
(61) |
Nov
(31) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(56) |
Feb
(54) |
Mar
(41) |
Apr
(71) |
May
(48) |
Jun
(32) |
Jul
(53) |
Aug
(91) |
Sep
(56) |
Oct
(33) |
Nov
(81) |
Dec
(54) |
2002 |
Jan
(72) |
Feb
(37) |
Mar
(126) |
Apr
(62) |
May
(34) |
Jun
(124) |
Jul
(36) |
Aug
(34) |
Sep
(60) |
Oct
(37) |
Nov
(23) |
Dec
(104) |
2003 |
Jan
(110) |
Feb
(73) |
Mar
(42) |
Apr
(8) |
May
(76) |
Jun
(14) |
Jul
(52) |
Aug
(26) |
Sep
(108) |
Oct
(82) |
Nov
(89) |
Dec
(94) |
2004 |
Jan
(117) |
Feb
(86) |
Mar
(75) |
Apr
(55) |
May
(75) |
Jun
(160) |
Jul
(152) |
Aug
(86) |
Sep
(75) |
Oct
(134) |
Nov
(62) |
Dec
(60) |
2005 |
Jan
(187) |
Feb
(318) |
Mar
(296) |
Apr
(205) |
May
(84) |
Jun
(63) |
Jul
(122) |
Aug
(59) |
Sep
(66) |
Oct
(148) |
Nov
(120) |
Dec
(70) |
2006 |
Jan
(460) |
Feb
(683) |
Mar
(589) |
Apr
(559) |
May
(445) |
Jun
(712) |
Jul
(815) |
Aug
(663) |
Sep
(559) |
Oct
(930) |
Nov
(373) |
Dec
|
From: Paul F. D. <du...@ll...> - 2001-06-05 18:16:26
|
Travis: Works for me ....using either dump or dumps, load or loads I used Numeric 20.1.0b1 / Python 2.1 / RedHat 6.2 On Tue, 05 Jun 2001, Tavis Rudd wrote: > Hi, > I've been having difficultly pickling arrays with the > type PyObject using Numeric. I haven't tried it with > MA but I assume the same problem exists. >=20 > This script works > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > from cPickle import dump, load > from Numeric import array, PyObject >=20 > def pickleIt(obj, fileName): > fp =3D open(fileName, 'w') > dump(obj, fp) > fp.close >=20 > def loadIt(fileName): > fp =3D open(fileName, 'r') > obj =3D load(fp) > fp.close() > return obj >=20 > a =3D array(['abc', 'def', 'ghi'], PyObject) > pickleIt(a, 'test.pickle') >=20 > This script segfaults > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > # ... same imports and func defs as above > b =3D loadIt() > print b >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > I first noticed this when trying to pickle arrays constructed > from lists of mx.DateTime objects. >=20 > Numeric 19.1.0 > Python 2.1 final > Linux 2.2.18 >=20 > Is this a reproduceable bug or something unique to my=20 > setup? > Tavis >=20 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > http://lists.sourceforge.net/lists/listinfo/numpy-discussion |
From: Tavis R. <ta...@ca...> - 2001-06-05 17:29:37
|
Hi, I've been having difficultly pickling arrays with the type PyObject using Numeric. I haven't tried it with MA but I assume the same problem exists. This script works ===================================== from cPickle import dump, load from Numeric import array, PyObject def pickleIt(obj, fileName): fp = open(fileName, 'w') dump(obj, fp) fp.close def loadIt(fileName): fp = open(fileName, 'r') obj = load(fp) fp.close() return obj a = array(['abc', 'def', 'ghi'], PyObject) pickleIt(a, 'test.pickle') This script segfaults ==================================== # ... same imports and func defs as above b = loadIt() print b ==================================== I first noticed this when trying to pickle arrays constructed from lists of mx.DateTime objects. Numeric 19.1.0 Python 2.1 final Linux 2.2.18 Is this a reproduceable bug or something unique to my setup? Tavis |
From: Chris B. <chr...@ho...> - 2001-06-01 22:04:35
|
"Paul F. Dubois" wrote: > The doc source is not available. I try to keep it up to date. If you would > tell me the section I overlooked I will fix it. That would be: Special Topics: Comparisons > As to logical and and or, they are not available for overload in the rich > comparisons schema. That's a Python decision. I figured as much. I just took a look at PEP 207: Rich Comparisons, and interestingly enough, the orignal version by David Asher addressed this issue (at least in terms of chaining comparisons, such as a > b >c). In the final PEP, I foound this: 5 In the current proposal, when A<B returns an array of elementwise comparisons, this outcome is considered non-Boolean, and its interpretation as Boolean by the shortcut operators raises an exception. David Ascher's proposal tries to deal with this; I don't think this is worth the additional complexity in the code generator. Instead of A<B<C, you can write (A<B)&(B<C). I'm curious about the statement "I don't think this is worth the additional complexity". It seems like being able to override the boolean operators would be VERY useful, and it seems odd how quickly this was glossed over. It is extremely common to combine a boolean operator with a a comparison. Is it time for a "rich boolean operators" PEP, or was this really rejected for good reason? By the way, it doesn't seem to raise an exception for me, but it does give a wrong (uninuitive anyway)answer: >>> a = array([1,2,3]) >>> b = array([3,2,1]) >>> c = array([3,3,3]) >>> a < b < c array([0, 1, 1]) Also, does (A<B)&(B<C) always work? Is this a reliable solution? What do the bitwise operators do with Numeric arrays? I guess the final question here is: Is it time for a "rich boolean operators" PEP, or was this really rejected for good reason? -- Christopher Barker, Ph.D. Chr...@ho... --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ |
From: Chris B. <chr...@ho...> - 2001-06-01 20:45:29
|
Hi all, I just got done installing Python 2.1 and NumPy 20 on Linux (which was far more work that it should have been) just so that I could get rich comparisons. I then got a version of the PDF doc, dated march30, 2001, and it is out of date with regard to rich comparisons. This brings up two questions. 1) Is the doc in CVS or something somewhere so that others (me) could contribute to it? 2) Is there a rich comparisons way to do "and" and "or"? It's great that: logical_and(greater(a,b),less(a,c)) can now be: logical_and(a > b, a < c) but of course, what I would really like is: (a > b) and (a < c) Are there any nice ways to do this?? -Chris -- Christopher Barker, Ph.D. Chr...@ho... --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ |
From: Jean-Bernard A. <jb...@ph...> - 2001-05-31 23:09:07
|
Hey Numpy people! This a PS from my previous message. I just tried the underflow with complex : >>> Numeric.array([2.9e-131])**3 Traceback (most recent call last): File "<stdin>", line 1, in ? OverflowError: math range error >>> 2.9e-131**3 0.0 >>> Numeric.array([2.9e-131+0j])**3 array([ 0.+0.j]) Now I have a quick solution for my problem, but I have the impression that this is a bug, at least I don't understand the underlying logic. If somebody can explain it to me? Jean-Bernard |
From: Jean-Bernard A. <jb...@ph...> - 2001-05-31 23:00:02
|
Hey Numpy people! Do anyone know how to disable underflow exception errors in Numeric? I have a lot of these in my code. It is now a very important problem in my calculations. The only solution I see is to make a for loop and make the arithmetic in python instead of Numeric. Thanks for your help, Jean-Bernard Python 2.0 (#9, Feb 2 2001, 12:17:02) [GCC 2.95.2 19991024 (release)] on linux2 Type "copyright", "credits" or "license" for more information. Hello from .pythonrc.py >>> import Numeric >>> Numeric.__version__ '17.2.0' >>> Numeric.array([2.9e-131])**3 Traceback (most recent call last): File "<stdin>", line 1, in ? OverflowError: math range error >>> 2.9e-131**3 0.0 |
From: Edward C. J. <edc...@er...> - 2001-05-31 17:38:22
|
I use Numeric 20.0.0, Python 2.1, and RedHat 7.1 on a PC. Here is a small Python program: import Numeric a = Numeric.zeros((2,2), 'b') print a[0,0], type(a[0,0]) print a[0][0], type(a[0][0]) a = Numeric.zeros((2,2), 'i') print a[0,0], type(a[0,0]) print a[0][0], type(a[0][0]) a = Numeric.zeros((2,2), 'f') print a[0,0], type(a[0,0]) print a[0][0], type(a[0][0]) The output is: 0 <type 'array'> 0 <type 'int'> 0 <type 'array'> 0 <type 'int'> 0.0 <type 'array'> 0.0 <type 'float'> This can't be correct. "a[0,0]" and "a[0][0]" should have the same type. A quick check of my old Python code shows that this problem may have appeared since Numeric version 17. Thanks, Ed Jones |
From: <kar...@ut...> - 2001-05-31 05:11:05
|
I am having a problem to download the numpyio.py file. Does any one knows whereand how to get it? Thanks. |
From: Perry G. <pe...@st...> - 2001-05-29 15:18:33
|
> Mark Esplin wrote: > > > > What is the plan for the future development of Numerical Python? For > > example, will additional special functions be included in numpy, or is > > NumPy to be a building block for other applications? I guess the big > > question is "Will Numerical Python become a complete computing > > environment like Matlab or IDL?" > > > > There is an interesting series of article on Numerical Python by Eric > > Hagemann on O'Reilly network (www.oreillynet.com) where Eric Hagemann > > is using NumPy with other python modules as a computing environment > > more than as a software development framework. > > > > I think NumPy could become a lot like the development of linux. Linux > > strictly speaking is only the operating system kernel. However, a > > linux system has come to includes a whole set of packages that work > > together to make up a whole system. > > See PEP 209: Multi-dimensional Arrays > > http://python.sourceforge.net/peps/pep-0209.html > > -- > Paul Barrett, PhD Space Telescope Science Institute > We at STScI have been working on a new implementation of Numeric. We are far enough along to release an incomplete version for evaluation by the Numeric (the current version) developers in about 2 weeks. The existing PEP (209) doesn't address all the details of the implementation and there are some differences from the PEP, but it does give a general idea of what our goals are. We have been more concerned at this point in implementation than keeping the PEP up to date. The PEP will be revised when we release a preliminary version. The preliminary version will be 0) Called something else. Probably numarray. 1) Not completely backwards compatible with the existing Numeric. (I don't have time to detail the differences, but they will be listed when we make it availble). 2) Incomplete. It will be missing functionality, especially with regard to structural operations (choose, where, nonzero, put, take, compress...). It will have most types (excepting complex) and most standard Ufuncs. We do not expect this version will be usuable for most projects because of this. We are looking for feedback on the interface and design approach rather than advertising it as a usuable version. We also are interested in collaborators in implementing the rest of the functionality. It probably will be moved to sourceforge soon after. 3) Slower for smaller arrays. We expect that performance for large arrays (>100,000 elements) should be fairly respectable, but since most of the original implementation is in Python, the overhead for smaller arrays is substantially increased over the existing Numeric. While we did benchmarking for determining what design approaches were efficient enough, we have eschewed benchmarks until we have completed all the important functionality (soon). At that point we will begin to work on optimization to improve the performance. I'll stop here, but you should be hearing more about it in the near future. Perry Greenfield Space Telescope Science Institute Science Software Group |
From: Paul F. D. <pa...@pf...> - 2001-05-28 19:39:30
|
A previous report of this doc error had caused me to fix it in my copy but it hadn't made it up to the web yet. The section has been redone to make it clearer, I hope. I am in the process of doing the update now. The documentation source is not available to you. Conventional use of fromfunction is like this: >>> from Numeric import * >>> def f (x, y): return x**2 + y**2 >>> a=fromfunction(f, (3,2)) >>> a array([[0, 1], [1, 2], [4, 5]]) For your use, you need a "helper" function. Suppose g is your function. >>> def g(x): return x[0] + x[1]**2 >>> def helper (x, y): return g([x,y]) >>> from Numeric import * >>> a = fromfunction(helper, (3,3)) >>> a array([[0, 1, 4], [1, 2, 5], [2, 3, 6]]) Of course, you can use a lambda to avoid explicity creating the helper. >>> fromfunction(lambda x,y:g([x,y]), (3,3)) array([[0, 1, 4], [1, 2, 5], [2, 3, 6]]) >>> -----Original Message----- From: num...@li... [mailto:num...@li...]On Behalf Of Kevin Turner Sent: Sunday, May 27, 2001 9:28 PM To: num...@li... Subject: [Numpy-discussion] fromfunction documentation Quoting from numdoc.pdf, dated March 31, 2001, in section "Creating an array from a function: fromfunction()" > The implementation of fromfunction consists of: > > def fromfunction(function, dimensions): > return apply(function, tuple(indices(dimensions))) > > which means that the function function is called for each element in > the sequence indices(dimensions) [...] This is wholly incorrect. apply() does not call a function for each element in the sequence, apply calls a function exactly *once*, using the elements of the sequence for arguments. Also, that same section of the documentation refers to "the first example below [...] works" and "the second array [...] fails", but there is only one example, which apparently is the failing one (as it's named "buggy"). Having a *working* example would be nice. =) Perhaps this is a formatting glitch in the documentation processor, but I couldn't find the documentation's source format. and then... there's always the possibility that I'm barking up the wrong tree. What I'm trying to achieve is this: I've got a function which, given a vector describing a point in n-dimensional space, returns a value for that point. I want a matrix of the shape I specify, filled these values, with the array indicies as coordinates for the points. Is that too much to ask? ;) Thanks, - Kevin Turner [using Python version 2.0, PyNum 19.0.0] -- Kevin Turner <aca...@us...> | OpenPGP encryption welcome here http://www.purl.org/wiki/python/KevinTurner _______________________________________________ Numpy-discussion mailing list Num...@li... http://lists.sourceforge.net/lists/listinfo/numpy-discussion |
From: Kevin T. <aca...@us...> - 2001-05-28 04:42:52
|
On Sun, May 27, 2001 at 09:28:08PM -0700, Kevin Turner wrote: > and then... there's always the possibility that I'm barking up the > wrong tree. What I'm trying to achieve is this: I've got a function > which, given a vector describing a point in n-dimensional space, returns > a value for that point. I want a matrix of the shape I specify, filled > these values, with the array indicies as coordinates for the points. err, I meant "multiarray", not "matrix" > > Is that too much to ask? ;) > > Thanks, |
From: Kevin T. <aca...@us...> - 2001-05-28 04:28:16
|
Quoting from numdoc.pdf, dated March 31, 2001, in section "Creating an array from a function: fromfunction()" > The implementation of fromfunction consists of: > > def fromfunction(function, dimensions): > return apply(function, tuple(indices(dimensions))) > > which means that the function function is called for each element in > the sequence indices(dimensions) [...] This is wholly incorrect. apply() does not call a function for each element in the sequence, apply calls a function exactly *once*, using the elements of the sequence for arguments. Also, that same section of the documentation refers to "the first example below [...] works" and "the second array [...] fails", but there is only one example, which apparently is the failing one (as it's named "buggy"). Having a *working* example would be nice. =) Perhaps this is a formatting glitch in the documentation processor, but I couldn't find the documentation's source format. and then... there's always the possibility that I'm barking up the wrong tree. What I'm trying to achieve is this: I've got a function which, given a vector describing a point in n-dimensional space, returns a value for that point. I want a matrix of the shape I specify, filled these values, with the array indicies as coordinates for the points. Is that too much to ask? ;) Thanks, - Kevin Turner [using Python version 2.0, PyNum 19.0.0] -- Kevin Turner <aca...@us...> | OpenPGP encryption welcome here http://www.purl.org/wiki/python/KevinTurner |
From: Paul B. <Ba...@st...> - 2001-05-25 19:22:30
|
Mark Esplin wrote: > > What is the plan for the future development of Numerical Python? For > example, will additional special functions be included in numpy, or is > NumPy to be a building block for other applications? I guess the big > question is "Will Numerical Python become a complete computing > environment like Matlab or IDL?" > > There is an interesting series of article on Numerical Python by Eric > Hagemann on O'Reilly network (www.oreillynet.com) where Eric Hagemann > is using NumPy with other python modules as a computing environment > more than as a software development framework. > > I think NumPy could become a lot like the development of linux. Linux > strictly speaking is only the operating system kernel. However, a > linux system has come to includes a whole set of packages that work > together to make up a whole system. See PEP 209: Multi-dimensional Arrays http://python.sourceforge.net/peps/pep-0209.html -- Paul Barrett, PhD Space Telescope Science Institute Phone: 410-338-4475 ESS/Science Software Group FAX: 410-338-4767 Baltimore, MD 21218 |
From: Mark E. <mar...@ya...> - 2001-05-25 16:07:27
|
What is the plan for the future development of Numerical Python? For example, will additional special functions be included in numpy, or is NumPy to be a building block for other applications? I guess the big question is "Will Numerical Python become a complete computing environment like Matlab or IDL?" There is an interesting series of article on Numerical Python by Eric Hagemann on O'Reilly network (www.oreillynet.com) where Eric Hagemann is using NumPy with other python modules as a computing environment more than as a software development framework. I think NumPy could become a lot like the development of linux. Linux strictly speaking is only the operating system kernel. However, a linux system has come to includes a whole set of packages that work together to make up a whole system. -Mark Esplin _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
From: Les S. <sch...@op...> - 2001-05-25 14:25:45
|
Scientific_netcdf: ----------------- I have placed a link to a package of DLLs for Scientific module on my web site: http://folks.astrian.net/godzilla included are the netcdf DLL and lib file, a pointer to the Unidata site where MS VC++ Project files are available (i used them to build this DLL), and the scientific_netcdf.pyd. I tested the package using netcdf_demo.py from the Scientific Example's directory. The project files on the Unidata site are for version 3.5, wheras mine are for beta8 of the same version. if the latest one's on their site cause you grief, i'll update mine for their latest version and post to the site. Visual Python: ------------- For people interested in using Visual Python under Windows and Python 2.1, i have also placed the cvisual.dll file on my page. PIL: --- Sometime this weekend i should have the PIL packages on my page updated as well. I have it working for Python 2.1, just need to bundle it up. les schaffer |
From: Mark E. <mar...@ya...> - 2001-05-24 13:39:52
|
The Gaussian hypergeometric function 2F1 is included with other special functions in the cephes-1.3 package. See http://pylab.sourceforge.net I haven't used the hypergeometric function, but the Bessel functions work well with Numerical Python. -Mark Esplin ---------- Forwarded Message ---------- Subject: [Numpy-discussion] Seeking hypergeometric 2F1 algorithm Date: Wed, 23 May 2001 10:57:56 -1000 From: "Herbert L. Roitblat" <roi...@ha...> To: <num...@so...> Does anyone have an agorithm for computing the Gaussian hypergeometric function 2F1 ? I understand that in principle it should be easy (sum of a series), but I think that there is a more efficient way to calculate it. My algorithmic skills are not up to it. Thanks, Herb _______________________________________________ Numpy-discussion mailing list Num...@li... http://lists.sourceforge.net/lists/listinfo/numpy-discussion ------------------------------------------------------- _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
From: Herbert L. R. <roi...@ha...> - 2001-05-23 20:59:34
|
Does anyone have an agorithm for computing the Gaussian hypergeometric function 2F1 ? I understand that in principle it should be easy (sum of a series), but I think that there is a more efficient way to calculate it. My algorithmic skills are not up to it. Thanks, Herb |
From: Les S. <sch...@op...> - 2001-05-23 20:52:51
|
> Excellent news! E-mail is fine but I'm sure that others are > interested in the netcdf module and the netcdf .dll as well. Perhaps > posting to your web site would be better? i will put a package up on my site by twm. the URL will be: http://folks.astrian.net/godzilla there's no isue with me distributing the betcdf dll is there??? les schaffer |
From: Prem R. <pr...@en...> - 2001-05-23 15:32:44
|
Hi, I am trying to install NumPY on my Windows 2000 machine. Could you please list out the procedure I have to follow to complete the installation. Prem. ____________________________________________________________ Prem Rachakonda ____________________________________________________________ Mailing Address: Work Address: 700 Woodland Ave., #E4 Teradyne Connection Systems, Lexington, Kentucky-40508 44 Simon St., Mail Stop#006, PH:859-323-2880 Nashua, NewHampshire - 03060 Work Phone No : 603-879-3442 |
From: Grant C. <gru...@ya...> - 2001-05-22 22:53:59
|
> i have the scientific_netcdf module compiled for > python 2.1. i can > email to you or can put a small zip file up on my > web site. > > you need the netcdf dll. i built that too, if > needed. Excellent news! E-mail is fine but I'm sure that others are interested in the netcdf module and the netcdf .dll as well. Perhaps posting to your web site would be better? Regardless, thank you very much. Grant Callis __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ |
From: Les S. <sch...@op...> - 2001-05-22 19:36:14
|
> The only other binary extension I use often is ScientificPython, > especially the netcdf portion. I'm not really a computer person so > compiling myself is a scary option. Any help? i have the scientific_netcdf module compiled for python 2.1. i can email to you or can put a small zip file up on my web site. you need the netcdf dll. i built that too, if needed. havent tried compiling the MPI stuff yet. les schaffer |
From: Grant C. <gru...@ya...> - 2001-05-22 17:13:47
|
Does have an updated Win32 binary of Konrad Hinsen's ScientificPython? I've been using Robert Kern's version, but it's only good up to Python 1.5.2. Now that the main modules I use have been compiled for Python 2.1 (dislin & mxTools) I have upgraded. The only other binary extension I use often is ScientificPython, especially the netcdf portion. I'm not really a computer person so compiling myself is a scary option. Any help? Thank you, Grant Callis __________________________________________________ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/ |
From: Paul F. D. <pa...@pf...> - 2001-05-21 21:01:55
|
The Program for Climate Model Diagnosis and Intercomparison is pleased to announce the release of Version 3.0.0 of Climate Data Analysis Tools, an open-source set of Python modules and tools for accessing, manipulating, and plotting scientific data in general and climate data sets in particular. The tools make extensive use of Numerical Python and its optional Masked Arrays (MA) package and are designed to interoperate with them. The CDAT website is http://cdat.sf.net, and the SourceForge project page is http://sf.net/projects/cdat. Version 3.0.0 is available for Linux and Solaris. Binary distributions are available for RedHat 6.2, RedHat 7.1, SuSe 7.1, and Solaris 5.6. The user must have NetCDF and Tcl/Tk installed before using CDAT. -- Paul Dubois PCMDI Lawrence Livermore National Laboratory |
From: Chris B. <chr...@ho...> - 2001-05-21 16:40:24
|
Warren Focke wrote: > ] >>> 2 <= arange(8) > ] array([0, 0, 1, 1, 1, 1, 1, 1]) > > but, as noted in the rich comparison PEP, they don't chain: > x <= y and y < z > > and we don't get to overload "and" :-(. Clearly that would be nice. Why wasn't "and" allowed to be overloaded when the rest of rich comparisons was allowed? > (x <= y) & (y < z) > > seems like it might be a semi-reasonable substitute, and is shorter and > appeals more to my preferring-operators-over-functions eyes, than > > Numeric.logical_and(x <= y, y < z) It looks fine to me as well. > - Do our comparisons really and truly ALWAYS return 1 or 0, even with Infs > and Nans and whatnot? Good question. There was a lot of discussion here recently about what level of support NumPy should give to NaNs an Inf. Personally, I'd like to see a well integrated support for it, which would include comparisons (though bitwise could still be a problem). Of course, I have neither the time nor the knowledge to do it, so I'll just have to wait... There has also been talk of a "logical" array type. Is that going to happen? If so, it would be the obvious choice to be returned from a comparison and we could make sure the bitwise & and | work with it. I notice that currently (I'm running 2.0, so ignore me if this has changed) comparisons return an array of python Integers which seems a massive waste of space. > - It's potentially misleading for readers of the code. well, yes, unless we really do have a 1 bit logical array type. -Chris -- Christopher Barker, Ph.D. Chr...@ho... --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ |
From: Warren F. <fo...@SL...> - 2001-05-18 22:35:28
|
Howdy all, We've got these spiffy comparisons now (thanks Travis et al.!): ] >>> 2 <= arange(8) ] array([0, 0, 1, 1, 1, 1, 1, 1]) but, as noted in the rich comparison PEP, they don't chain: ] >>> 2 <= arange(8) < 6 ] array([1, 1, 1, 1, 1, 1, 0, 0]) since x <= y < z is equivalent to x <= y and y < z and we don't get to overload "and" :-(. But we did overload "&" long ago, and bitwise_and is equivalent to logical_and if the arguments are only 1 or 0, which is what our comparisons return (I think?). So (x <= y) & (y < z) seems like it might be a semi-reasonable substitute, and is shorter and appeals more to my preferring-operators-over-functions eyes, than Numeric.logical_and(x <= y, y < z) (which still beats the ^%$#&^(*&*^ out of Numeric.logical_and(Numeric.less_equal(x, y), Numeric.less(y, z)) ). But I'm a bit squeamish about it. Cons that I see are: - Do our comparisons really and truly ALWAYS return 1 or 0, even with Infs and Nans and whatnot? - It's potentially misleading for readers of the code. - It just seems kinda wrong, even if it does look better. So, what think you? bitwise, bytefoolish-ly y'rs, Warren Focke |