Re: [Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Travis Oliphant
Bill Baxter wrote: > On 10/13/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > >> For this sort of thing, I >> would just make a new module to pull together the function I want and >> use that instead. It's then easy to explain that this new module bbeconf >> (Bill Baxter's Excellent Collection Of

Re: [Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Bill Baxter
On 10/13/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > For this sort of thing, I > would just make a new module to pull together the function I want and > use that instead. It's then easy to explain that this new module bbeconf > (Bill Baxter's Excellent Collection Of Numeric Functions) is actually

Re: [Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Tim Hochberg
Bill Baxter wrote: > > I think efficiency is not a very good argument for the default > behavior here, because -- lets face it -- if efficient execution was > high on your priority list, you wouldn't be using python. I care very much about efficiency where it matters, which is only in a tiny fra

Re: [Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Tim Hochberg
Bill Baxter wrote: > On 10/12/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > >> On Thu, Oct 12, 2006 at 08:58:21AM -0500, Greg Willden wrote: >> >>> On 10/11/06, Bill Baxter <[EMAIL PROTECTED]> wrote: >>> >> I tried to explain the argument at >> >> http://www.scipy.org/Negative

Re: [Numpy-discussion] Problem buliding rc2 on OS X 10.3.9/Python2.5

2006-10-12 Thread Jay Parlar
I hate bumping my own messages, but does no one have any insight into this? On 10/9/06, Jay Parlar <[EMAIL PROTECTED]> wrote: > In the process of finally switching over to Python 2.5, and am trying > to build numpy. Unfortunately, it dies during the build: > > Jay-Computer:~/Desktop/numpy-1.0rc2

Re: [Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Bill Baxter
On 10/13/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On 10/12/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > On 10/12/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > > > On Thu, Oct 12, 2006 at 08:58:21AM -0500, Greg Willden wrote: > > > > On 10/11/06, Bill Baxter < [EMAIL PROTECTED]

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Greg Willden
On 10/12/06, Charles R Harris <[EMAIL PROTECTED]> wrote: And here is the location of the problem in numpy/linalg/linalg.py :def lstsq(a, b, rcond=1.e-10): The 1e-10 is a bit conservative. On the other hand, I will note that the condition number of the dot(V^T ,V) matrix is somewhere around 1e22, wh

Re: [Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Charles R Harris
On 10/12/06, Bill Baxter <[EMAIL PROTECTED]> wrote: On 10/12/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote:> On Thu, Oct 12, 2006 at 08:58:21AM -0500, Greg Willden wrote:> > On 10/11/06, Bill Baxter < [EMAIL PROTECTED]> wrote:> I tried to explain the argument at>> http://www.scipy.org/NegativeS

[Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Bill Baxter
On 10/12/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > On Thu, Oct 12, 2006 at 08:58:21AM -0500, Greg Willden wrote: > > On 10/11/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > I tried to explain the argument at > > http://www.scipy.org/NegativeSquareRoot > The proposed fix for those who want

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread David Goldsmith
I find that acceptable for my purposes, but is there some way we can minimize the "surprise(s)" for newbies? (I know some suggestions have been put forward in this thread, but I don't know enough to cast a vote one way or another for any of those, just a vote for "please do it".) And, in clo

[Numpy-discussion] rcond in polyfit

2006-10-12 Thread Charles R Harris
Hi all,I note that polyfit looks like it should work for single and double, real and complex, polynomials. On the otherhand, the default rcond needs to depend on the underlying precision. On the other, other hand, all the svd computations are done with dgelsd or zgelsd, i.e., double precision. Eve

Re: [Numpy-discussion] Providing array interface from SWIG-wrapped C struct

2006-10-12 Thread vallis . 35530053
Wonderful, it works, thanks! Michele --- Discussion of Numerical Python wrote: > > Does anybody here have experience about offering the array interface > > from a SWIG-wrapped C struct? > > I have. > > > I have tried the following, borrowing code from numpy's arrayobject.c: > > > >

[Numpy-discussion] numpy on centos4.4?

2006-10-12 Thread Neal Becker
Has anyone built numpy-1.0rc2/scipy-0.5.1 on centos4.4? It seems that a fortran90+ compiler is required, so I installed gcc4-gfortran-4.1.0-18.EL4 libgfortran-4.1.0-18.EL4 Didn't quite work though. Built numpy+scipy OK, but then: Warning: FAILURE importing tests for /usr/lib/python2.3/site-pac

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Charles R Harris
On 10/12/06, Charles R Harris <[EMAIL PROTECTED]> wrote: On 10/12/06, Charles R Harris < [EMAIL PROTECTED]> wrote: On 10/12/06, Greg Willden < [EMAIL PROTECTED]> wrote: On 10/12/06, Charles R Harris <[EMAIL PROTECTED] > wrote: I'm guessing that the rcond number in the lstsq version (default 1e-10)

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Charles R Harris
On 10/12/06, Charles R Harris <[EMAIL PROTECTED]> wrote: On 10/12/06, Greg Willden < [EMAIL PROTECTED]> wrote: On 10/12/06, Charles R Harris <[EMAIL PROTECTED] > wrote: I'm guessing that the rcond number in the lstsq version (default 1e-10) is the difference. Generally the lstsq version should wor

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Charles R Harris
On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote: On 10/12/06, Charles R Harris <[EMAIL PROTECTED] > wrote: I'm guessing that the rcond number in the lstsq version (default 1e-10) is the difference. Generally the lstsq version should work better than the MPL version because at*a is not as well c

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Greg Willden
On 10/12/06, Charles R Harris <[EMAIL PROTECTED]> wrote: I'm guessing that the rcond number in the lstsq version (default 1e-10) is the difference. Generally the lstsq version should work better than the MPL version because at*a is not as well conditioned and vandermonde matrices are notoriously il

Re: [Numpy-discussion] More SVN testing

2006-10-12 Thread Rob Hetland
>>>numpy.test(10,10) : : : Ran 512 tests in 0.995s OK >>> numpy.__version__ '1.0.dev3320' on Intel Mac OS X 10.4.8, macpython 2.5 [Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)] -Rob On Oct 12, 2006, at 2:24 PM, Tim Hochberg wrote: > > I just checked in a couple of changes to SVN. I was

Re: [Numpy-discussion] Polyfit

2006-10-12 Thread Charles R Harris
On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote: Hi All,I'm using numpy.polyfit and it is giving me some really strange results when evaluated near 0.  So I compared it with polyfit in matplotlib and the code and docstrings are nearly identical.  However the slight differences in the code make

Re: [Numpy-discussion] More SVN testing

2006-10-12 Thread Tim Hochberg
Albert Strasheim wrote: > Hello all > > >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:numpy- >> [EMAIL PROTECTED] On Behalf Of Tim Hochberg >> Sent: 12 October 2006 21:24 >> To: numpy-discussion >> Subject: [Numpy-discussion] More SVN testing >> >> >> I just checked in a coupl

[Numpy-discussion] Polyfit

2006-10-12 Thread Greg Willden
Hi All,I'm using numpy.polyfit and it is giving me some really strange results when evaluated near 0.  So I compared it with polyfit in matplotlib and the code and docstrings are nearly identical.  However the slight differences in the code make a huge difference on my data. Here is the Numpy versi

Re: [Numpy-discussion] More SVN testing

2006-10-12 Thread Albert Strasheim
Hello all > -Original Message- > From: [EMAIL PROTECTED] [mailto:numpy- > [EMAIL PROTECTED] On Behalf Of Tim Hochberg > Sent: 12 October 2006 21:24 > To: numpy-discussion > Subject: [Numpy-discussion] More SVN testing > > > I just checked in a couple of changes to SVN. I was going to che

Re: [Numpy-discussion] multiarray tests skipped under py2.5

2006-10-12 Thread Tim Hochberg
Travis Oliphant wrote: > Tim Hochberg wrote: > > >>> >>> >>> >>> >> Still there with a clean checkout. Blech! I hate weird import problems. >> I'll try to look into it, but if anyone has any good ideas, let me know >> >> >> > Show us the errors, I may be able to help. It's

Re: [Numpy-discussion] multiarray tests skipped under py2.5

2006-10-12 Thread Travis Oliphant
Tim Hochberg wrote: >> >> >> >Still there with a clean checkout. Blech! I hate weird import problems. >I'll try to look into it, but if anyone has any good ideas, let me know > > Show us the errors, I may be able to help. It's possible some recent changes messed things up. -Travis -

[Numpy-discussion] More SVN testing

2006-10-12 Thread Tim Hochberg
I just checked in a couple of changes to SVN. I was going to check in errstate, but it looks like Travis beat me to it, so I contented myself with adding a docstring and some tests. These tests are only run under 2.5; things seem to work fine here, but if someone on a Linux box whose running

Re: [Numpy-discussion] Compiling Numpy with py2exe

2006-10-12 Thread Travis Oliphant
Charles Hanot wrote: > Hello, > > I’ve a program using Numpy and I would like to compile it with Py2exe > but I’ve some problems. When I try to compile my program, some modules > generated by numpy are not loaded. I’ve already asked to the py2exe > community if they have a solution for that and

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Travis Oliphant
David Goldsmith wrote: >Got it. And if I understand correctly, the import order you specify in >the little mynumpy example you included in your latest response to >Fernando will result in any "overlap" between numpy and >numpy.lib.scimath to call the latter's version of things rather than the

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Paul Dubois
Historical note. When Cleve Moler first created 'matlab' as a tool for teaching at the University of New Mexico, all numbers were complex. And, in fact, there was a limit of 10,000 numbers. There was a fixed array where these 10,000 numbers were stored. I got pretty excited about his project and wa

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Sebastian Haase
Hi, On Thursday 12 October 2006 10:49, Christopher Barker wrote: > As someone on this list (sorry to quick with the delete button) said: I think I might agree with everything (!) you that - very well written . > Travis Oliphant wrote: > > Now, it would be possible to give ufuncs a dtype keyword

Re: [Numpy-discussion] Providing array interface from SWIG-wrapped C struct

2006-10-12 Thread Lisandro Dalcin
On 10/12/06, Michele Vallisneri <[EMAIL PROTECTED]> wrote: > Does anybody here have experience about offering the array interface > from a SWIG-wrapped C struct? I have. > I have tried the following, borrowing code from numpy's arrayobject.c: > > %extend real_vec_t { >PyObject *__array_struct

Re: [Numpy-discussion] multiarray tests skipped under py2.5

2006-10-12 Thread Tim Hochberg
Tim Hochberg wrote: > Gerard Vermeulen wrote: > >> On Thu, 12 Oct 2006 11:04:55 -0700 >> Tim Hochberg <[EMAIL PROTECTED]> wrote: >> >> >> >>> Is any one else seeing the multiarray tests all get skipped because of >>> an import error when compiling under python 2.5. Everything else seems

[Numpy-discussion] numpy-1.0 problem with install --skip-build

2006-10-12 Thread Neal Becker
It appears the problem with getting a numpy-1.0 built with RPM is caused by using 2 step process: python setup.py build python setup.py install --skip-build --root $RPM_BUILD_ROOT This doesn't seem to work correctly! If I change it to just do: python setup.py install it works OK. ---

Re: [Numpy-discussion] gcc/fortran compilers for building extensions with Tiger/MacPython

2006-10-12 Thread David M. Cooke
On Thu, 12 Oct 2006 14:03:31 -0400 Tom Loredo <[EMAIL PROTECTED]> wrote: > Hi folks, > > I've just upgraded my G4 (PPC) from Pather to Tiger, and just > installed MacPython. I now need to build a slew of numerical extensions. > I'm building them from source (I have lots of custom extensions > to

Re: [Numpy-discussion] multiarray tests skipped under py2.5

2006-10-12 Thread Tim Hochberg
Gerard Vermeulen wrote: > On Thu, 12 Oct 2006 11:04:55 -0700 > Tim Hochberg <[EMAIL PROTECTED]> wrote: > > >> Is any one else seeing the multiarray tests all get skipped because of >> an import error when compiling under python 2.5. Everything else seems >> to work and all the tests go fine un

Re: [Numpy-discussion] multiarray tests skipped under py2.5

2006-10-12 Thread Gerard Vermeulen
On Thu, 12 Oct 2006 11:04:55 -0700 Tim Hochberg <[EMAIL PROTECTED]> wrote: > > Is any one else seeing the multiarray tests all get skipped because of > an import error when compiling under python 2.5. Everything else seems > to work and all the tests go fine under 2.4. Everything looks fine he

[Numpy-discussion] multiarray tests skipped under py2.5

2006-10-12 Thread Tim Hochberg
Is any one else seeing the multiarray tests all get skipped because of an import error when compiling under python 2.5. Everything else seems to work and all the tests go fine under 2.4. -tim - Using Tomcat but need to do

[Numpy-discussion] gcc/fortran compilers for building extensions with Tiger/MacPython

2006-10-12 Thread Tom Loredo
Hi folks, I've just upgraded my G4 (PPC) from Pather to Tiger, and just installed MacPython. I now need to build a slew of numerical extensions. I'm building them from source (I have lots of custom extensions to build from source in any case). I see the binaries available for Tiger are built w

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Christopher Barker
As someone on this list (sorry to quick with the delete button) said: "numpy is closer to the metal than MATLAB" MATLAB aside, numpy is somewhat "close to the metal". I think this is clearly part of its design philosophy, and also something I personally like about out. Getting back to MATLAB (

[Numpy-discussion] Providing array interface from SWIG-wrapped C struct

2006-10-12 Thread Michele Vallisneri
Does anybody here have experience about offering the array interface from a SWIG-wrapped C struct? I have tried the following, borrowing code from numpy's arrayobject.c: %extend real_vec_t { PyObject *__array_struct__() { /* From numpy/arrayobject.c/array_struct_get */ PyArrayInte

Re: [Numpy-discussion] Please test the SVN branch

2006-10-12 Thread Christopher Barker
Travis Oliphant wrote: > I made some fixes to the "asbuffer" code which let me feel better about > exposing it in NumPy (where it is now named int_asbuffer). > > This code takes a Python integer and a size and returns a buffer object > that points to that memory. If I understand this correctly,

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread David Goldsmith
Greg Willden wrote: > May I suggest the following change to generate_umath.py? > > > 'sqrt' : > Ufunc(1, 1, None, > 'square-root elementwise. For real x, the domain is > restricted to x>=0.\n\ > For complex results for x<0 see numpy.scimath.sqrt', > TD(inexact, f

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than?nan?

2006-10-12 Thread Stefan van der Walt
On Thu, Oct 12, 2006 at 10:53:12AM -0400, Alan G Isaac wrote: > On Thu, 12 Oct 2006, Stefan van der Walt apparently wrote: > > I tried to explain the argument at > > http://www.scipy.org/NegativeSquareRoot > > Helpful. But you start off by saying: > In mathematics, the above assumption

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread A. M. Archibald
On 12/10/06, David Goldsmith <[EMAIL PROTECTED]> wrote: > I don't use scipy (and don't want to because of the overhead) but it > sounds like I should because if I'm taking the square root of a variable > whose value at run time happens to be real but less than zero, I *want* > the language I'm usi

[Numpy-discussion] PATCH build numpy-1.0rc2

2006-10-12 Thread Neal Becker
I have not been able to build any of the numpy-1.0 series. Finally I bit the bullet and fixed it. Here is the patch: diff -u numpy-1.0rc2/numpy/numarray/setup.py{~,} --- numpy-1.0rc2/numpy/numarray/setup.py~ 2006-07-26 16:04:32.0 -0400 +++ numpy-1.0rc2/numpy/numarray/setup.py

Re: [Numpy-discussion] Things to address for Py3K

2006-10-12 Thread Rob Hetland
On Oct 11, 2006, at 1:41 PM, Travis Oliphant wrote: >a) an extra multiplication operator to distinguish between > element-by-element and dot One of the things I like about numpy is that element-by-element multiplication is default. Really, most of what I do is element by element, punctu

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Andrew Jaffe
Tim Hochberg wrote: > Travis Oliphant wrote: >> Tim Hochberg wrote: >> >> >>> With python 2.5 out now, perhaps it's time to come up with a with >>> statement context manager. Something like: >>> >>>a = numpy.arange(10) >>>a/a # ignores divide by zero >>>with errstate(divide='raise')

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Greg Willden
May I suggest the following change to generate_umath.py?'sqrt' :    Ufunc(1, 1, None,  'square-root elementwise. For real x, the domain is restricted to x>=0.\n\   For complex results for x<0 see numpy.scimath.sqrt',  TD(inexact, f='sqrt'),  TD(M, f='sqrt'), 

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Greg Willden
I'll try to quit being a pain and just work around it.Those wiki pages are really good to capture this information.  I need to read all of them to know what other gotchas are out there.Thanks and Sorry,Greg On 10/12/06, Alan G Isaac <[EMAIL PROTECTED]> wrote: That's fine, but be sure to treat the e

Re: [Numpy-discussion] Should numpy.sqrt(-1) ret urn 1j rather than nan?

2006-10-12 Thread Alan G Isaac
On Thu, 12 Oct 2006, Stefan van der Walt apparently wrote: > I tried to explain the argument at > http://www.scipy.org/NegativeSquareRoot Helpful. But you start off by saying: In mathematics, the above assumption is true -- that the square root of -1 is 1j. Since square root

Re: [Numpy-discussion] Please test the SVN branch

2006-10-12 Thread Tim Hochberg
Travis Oliphant wrote: > I made some fixes to the "asbuffer" code which let me feel better about > exposing it in NumPy (where it is now named int_asbuffer). > > This code takes a Python integer and a size and returns a buffer object > that points to that memory. A little test is performed by tr

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Tim Hochberg
Travis Oliphant wrote: >> Personally I think that the default error mode should be tightened >> up. >> Then people would only see these sort of things if they really care >> about them. Using Python 2.5 and the errstate class I posted earlier: >> >> # This is what I like for

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Stefan van der Walt
On Thu, Oct 12, 2006 at 08:58:21AM -0500, Greg Willden wrote: > On 10/11/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote: > > Speed should not take precedence over correctness. > > Unless your goal is speed. Then speed should take pr

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Tim Hochberg
Travis Oliphant wrote: > Travis Oliphant wrote: > >> Now, it would be possible to give ufuncs a dtype keyword argument that >> allowed you to specify which underlying loop was to be used for the >> calculation. That way you wouldn't have to convert inputs to complex >> numbers before calling

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Tim Hochberg
Mark Bakker wrote: > My vote is for consistency in numpy. > But it is unclear what consistency is. > > What is truly confusing for newbie Python users (and a source for > error even after 5 years of Python programming) is that > > >>> 2/3 > 0 I recommend that you slap "from __future__ import divis

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread James Graham
Greg Willden wrote: > On 10/11/06, *Bill Baxter* <[EMAIL PROTECTED] > > wrote: > > On 10/12/06, Greg Willden <[EMAIL PROTECTED] > > wrote: > > Speed should not take precedence over correctness. > > Unless your goal is speed. T

Re: [Numpy-discussion] Should numpy.sqrt(-1) ret urn 1j rather than nan?

2006-10-12 Thread Alan G Isaac
On Thu, 12 Oct 2006, Greg Willden apparently wrote: > I'm having serious doubts about my conversion to Numpy. That's fine, but be sure to treat the explanations you are receiving with the same seriousness that you treat your doubts. For example, in the speed vs. correctness discussion, be su

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Greg Willden
On 10/11/06, Bill Baxter <[EMAIL PROTECTED]> wrote: On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote:> Speed should not take precedence over correctness.Unless your goal is speed.  Then speed should take precedence over correctness. Huh?Person 1:  "Hey you should use function X."Person 2:  "No,

[Numpy-discussion] Compiling Numpy with py2exe

2006-10-12 Thread Charles Hanot
Hello,   I’ve a program using Numpy and I would like to compile it with Py2exe but I’ve some problems. When I try to compile my program, some modules generated by numpy are not loaded. I’ve already asked to the py2exe community if they have a solution for that and the answer was that it w

[Numpy-discussion] arraysetops update

2006-10-12 Thread Robert Cimrman
I have just added 'See also' to all docstrings in arraysetops functions, replaced old numpy idioms with new ones (aka modernizing) and improved speed of numpy.unique1d, which now reflects numpy.unique. hoping no bugs were introduced, regards, r. --

[Numpy-discussion] Klaipeda Narva also comes

2006-10-12 Thread National
Grocery local Traffic am Maps Greater Orange co of Inland Empire Ventura Diego is Weather a Rain in.Smallest Four Yearswest is School Recalls in Exstudent is Disputes Claim war Deada Younger Unfazed Outrage Over.Slipups am sam Howe in Verhovek Using cheap video cameras a they shadow is oppos

Re: [Numpy-discussion] Please test the SVN branch

2006-10-12 Thread Stefan van der Walt
On Thu, Oct 12, 2006 at 12:38:51AM -0600, Travis Oliphant wrote: > > I made some fixes to the "asbuffer" code which let me feel better about > exposing it in NumPy (where it is now named int_asbuffer). > > This code takes a Python integer and a size and returns a buffer object > that points to

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Stefan van der Walt
I've summarised this thread at http://www.scipy.org/NegativeSquareRoot Feel free to make adjustments, in case I missed something. Regards Stefan - Using Tomcat but need to do more? Need to support web services, security? Ge

[Numpy-discussion] Casting

2006-10-12 Thread Cristian Codorean
Hello list,   I got some old code that uses Scientific and Numeric. Recently, these two packages were updated to the latest versions together with python and my code started failing. The first major problem I have is when downcasting. Code that used to work now fails because the array cannot be saf

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Mark Bakker
My vote is for consistency in numpy.But it is unclear what consistency is.What is truly confusing for newbie Python users (and a source for error even after 5 years of Python programming) is that>>> 2/3 0In that respect, I would think>>> numpy.sqrt(2)should give 1, but it gives 1.4142135623730951So

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread David Goldsmith
Travis Oliphant wrote: > David Goldsmith wrote: > >>> >>> >>> >> I don't use scipy (and don't want to because of the overhead) but it >> sounds like I should because if I'm taking the square root of a variable >> whose value at run time happens to be real but less than zero, I *

Re: [Numpy-discussion] Compile with atlas 3.7.17 fails

2006-10-12 Thread Hanno Klemm
Travis, thank you, setting the -fPIC option indeed solved my problem. Just for future reference (if anybody else needs it), I added the -fPIC flag to the compiler flags in Make.inc in the atlas build directory, as setting CCFLAGS somehwo didn't seem to be successful. This might not be elegant bu

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Travis Oliphant
Travis Oliphant wrote: > Now, it would be possible to give ufuncs a dtype keyword argument that > allowed you to specify which underlying loop was to be used for the > calculation. That way you wouldn't have to convert inputs to complex > numbers before calling the ufunc, but could let the ufun

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Fernando Perez
On 10/12/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > > I'd like to pitch in (again) on this issue, but I'll try to make sure > > that it's clear that I'm NOT arguing about sqrt() in particular, one > > > > way or another. > > > > Fernando, > > I don't disagree with you in principle. I don't

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread pearu
PS: I am still sending this message to numpy list only because the proposal below affects numpy code, not scipy one. I think Fernando points make sense, numpy.foo(x) != scipy.foo(x) can cause confusion and frustration both among new numpy/scipy users and developers (who need to find explanati

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Travis Oliphant
David Goldsmith wrote: >> >> > I don't use scipy (and don't want to because of the overhead) but it > sounds like I should because if I'm taking the square root of a variable > whose value at run time happens to be real but less than zero, I *want* > the language I'm using to return an i

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Travis Oliphant
> I'd like to pitch in (again) on this issue, but I'll try to make sure > that it's clear that I'm NOT arguing about sqrt() in particular, one > > way or another. > Fernando, I don't disagree with you in principle. I don't think anybody does. I think we should try to keep the interfaces

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread David Goldsmith
(Very) well said, Fernando. Thanks! DG Fernando Perez wrote: > On 10/12/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > >> Why in the world does it scare you away. This makes no sense to me. >> If you don't like the scipy version don't use it. NumPy and SciPy are >> not the same thing.

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread David Goldsmith
Travis Oliphant wrote: > David Goldsmith wrote: > >> Travis Oliphant wrote: >> >> >>> What could be simpler? ;-) >>> >>> >> Having sqrt(-1) return 1j (without having to remember that in order to >> get this, you have to write sqrt(-1+0j) instead). >> >> >> > That's e

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread David Goldsmith
Travis Oliphant wrote: > David Goldsmith wrote: > >> Travis Oliphant wrote: >> >> >>> [EMAIL PROTECTED] wrote: >>> >>> >>> >>> Could sqrt(-1) made to return 1j again? >>> Not in NumPy. But, in scipy it could. >>> >>> >>>

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Scott Sinclair
Fernando Perez wrote: > Please note that I see a valid reason for scipy.foo != numpy.foo when > the scipy version uses code with extra features, is faster, has > additional options, etc. But as I said in a previous message, I think > that /for the same input/, we should really try to satisfy that

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Travis Oliphant
> > Personally I think that the default error mode should be tightened > up. > Then people would only see these sort of things if they really care > about them. Using Python 2.5 and the errstate class I posted earlier: > > # This is what I like for the default error state >