Re: [Numpy-discussion] mysql -> record array

2006-11-14 Thread Travis Oliphant
John Hunter wrote: >>"John" == John Hunter <[EMAIL PROTECTED]> writes: >> >> > > > >>"Erin" == Erin Sheldon <[EMAIL PROTECTED]> writes: >> >> >Erin> The question I have been asking myself is "what is the >Erin> advantage of such an approach

Re: [Numpy-discussion] 32bit integers as list indices

2006-11-14 Thread Travis Oliphant
Neilen Marais wrote: >Hi, > >I'm not sure if the following is expected to work on a 64bit machine: > >In [381]: import numpy as N >In [382]: l = range(3) >In [383]: i32 = N.array([0,2], N.int32) >In [384]: i64 = N.array([0,2], N.int64) >In [385]: l[i32[0]] >

Re: [Numpy-discussion] "Slicing" recarrays

2006-11-07 Thread Travis Oliphant
Christopher Barker wrote: >Hi all, > >I'm using a recarray to read a bunch of binary data out of a file. It's >working great, but it seems there should be a more efficient way to >"slice" the data. Here's what I've got: > >The binary data is essentially a dump of a 2-d array of structs. So I >r

[Numpy-discussion] Scholarly contribution of NumPy : request for review

2006-11-06 Thread Travis Oliphant
to a tenure-review committee, could you please email me your assessment by Friday morning (Nov. 10). Please include information about your position in the mail. I welcome all assessments (both positive and negative). Thank you very much. Travis Oliphant Assistant Professor Brigham

Re: [Numpy-discussion] Reading records from file and sorting

2006-11-03 Thread Travis Oliphant
George Sakkis wrote: > Albert Strasheim wrote: > > >> Check the thread "Strange results when sorting array with fields" from >> about a week back. Travis made some changes to sorting in the presence >> of fields that should solve your problem, assuming your fields appear in >> the order you want

[Numpy-discussion] I won't be as visible for a few weeks

2006-11-03 Thread Travis Oliphant
I'm writing this to indicate that I won't be as visible on the lists for a few weeks as I have some pressing matters to attend to that will take more of my time. I apologize for not being able to help more right now. Best regards, -Travi

Re: [Numpy-discussion] Reading records from file and sorting

2006-11-02 Thread Travis Oliphant
George Sakkis wrote: >Charles R Harris wrote: > > > >>On 11/1/06, George Sakkis <[EMAIL PROTECTED]> wrote: >> >> >>>Albert Strasheim wrote: >>> >>> >>> Check the thread "Strange results when sorting array with fields" from about a week back. Travis made some changes to sorting

Re: [Numpy-discussion] numpy book

2006-11-02 Thread Travis Oliphant
Fernando Perez wrote: >On 11/2/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > >>>Note that this is not a request to Travis to send me the latest version >>>by private email. That would be inefficient and my need is not that >>>urgent. Neverth

Re: [Numpy-discussion] Argmax and max inconsistent for object types

2006-11-02 Thread Travis Oliphant
Jonathan Wang wrote: > On numpy version 1.0, argmax and max give inconsistent results for an > array of objects. I've seen this problem in both Python native > datetime and mx.DateTime types: There is a bug in argmax for OBJECT arrays in 1.0 (it's fixed in SVN and will be in 1.0.1) -Travis

Re: [Numpy-discussion] Converting bool to float

2006-11-02 Thread Travis Oliphant
Robert Kern wrote: >Tim Hochberg wrote: > > >>Travis Oliphant wrote: >> >> >>>Robert Kern wrote: >>> >>> >>>>Travis Oliphant wrote: >>>> >>>> >>>>>It looks like 1.0-x i

Re: [Numpy-discussion] numpy book

2006-11-02 Thread Travis Oliphant
>Note that this is not a request to Travis to send me the latest version >by private email. That would be inefficient and my need is not that >urgent. Nevertheless I think that issue should be settled. > > There will be an update, soon. I'm currently working on the index, corrections, and forma

[Numpy-discussion] dgesdd error

2006-11-01 Thread Travis Oliphant
Apparently some dgesdd libraries don't actually compute the correct value for the work-space size if requested. This results in an ** ILLEGAL value and program termination from LAPACK. I've added code in the latest SVN to that particular wrapper to make sure the query gives back the minimums

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Travis Oliphant
Robert Kern wrote: >Travis Oliphant wrote: > > > >>It looks like 1.0-x is doing the right thing. >> >>The problem is 1.0*x for matrices is going to float64. For arrays it >>returns float32 just like the 1.0-x >> >> > >Why is this the r

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Travis Oliphant
Keith Goodman wrote: >I had a hard time tracing a bug in my code. The culprit was this difference: > > > >>>x >>> >>> > >matrix([[True], >[True], >[True]], dtype=bool) > > >>>1.0 - x >>> >>> > >matrix([[ 0.], >[ 0.], >[ 0.]], dtype=float32) <

Re: [Numpy-discussion] Converting bool to float

2006-11-01 Thread Travis Oliphant
Keith Goodman wrote: >I had a hard time tracing a bug in my code. The culprit was this difference: > > > >>>x >>> >>> > >matrix([[True], >[True], >[True]], dtype=bool) > > >>>1.0 - x >>> >>> > >matrix([[ 0.], >[ 0.], >[ 0.]], dtype=float32) <

Re: [Numpy-discussion] Need more comments from scientific community on python-dev

2006-11-01 Thread Travis Oliphant
Alexander Belopolsky wrote: > On 10/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > ... > >> Please understand what I meant. I meant putting effort into getting >> PyArray_DescrConverter to allow ctypes inputs and convert to the >> appropriate PyArr

Re: [Numpy-discussion] Need more comments from scientific community on python-dev

2006-10-31 Thread Travis Oliphant
Sasha wrote: >On 10/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > > >>Please read my posts about the Python type-object verses normal Python >>Object situation. That really is the crux of the matter. >> >> >> >I read the whole py

Re: [Numpy-discussion] Need more comments from scientific community on python-dev

2006-10-31 Thread Travis Oliphant
Sasha wrote: >On 10/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > >Yes, this is the key. I think we should better understand ctypes >limitations before proposing an alternative. > I already understand it's practical limitations --- type objects as dat

Re: [Numpy-discussion] Need more comments from scientific community on python-dev

2006-10-31 Thread Travis Oliphant
Sasha wrote: >On 10/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > >>I'm recruiting more comments on python-dev regarding my two proposals >>for improving Python's native ability to share ndarray-like information. >> >> >> &g

Re: [Numpy-discussion] Need more comments from scientific community on python-dev

2006-10-31 Thread Travis Oliphant
Sasha wrote: >On 10/31/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > >>I'm recruiting more comments on python-dev regarding my two proposals >>for improving Python's native ability to share ndarray-like information. >> >> >> &g

Re: [Numpy-discussion] [SciPy-user] Need more comments from scientific community on python-dev

2006-10-31 Thread Travis Oliphant
Fernando Perez wrote: >On 10/31/06, Rich Shepard <[EMAIL PROTECTED]> wrote: > > >>On Tue, 31 Oct 2006, Alan Isaac wrote: >> >> >> >>>The easiest access to this discussion for me was >>>http://news.gmane.org/group/gmane.comp.python.devel/ I cannot add to this >>>discussion, but I REALLY hope

Re: [Numpy-discussion] dtype.hasobject value

2006-10-31 Thread Travis Oliphant
Travis Oliphant wrote: >Matthew Brett wrote: > > >>Hi, >> >>I notice that the value for: >> >>zeros((1,), dtype=object).dtype.hasobject >> >>is now 63, whereas previously it had been 1. Is this intended? >> >> >> >&

[Numpy-discussion] Need more comments from scientific community on python-dev

2006-10-31 Thread Travis Oliphant
I'm recruiting more comments on python-dev regarding my two proposals for improving Python's native ability to share ndarray-like information. There is a dearth of scientific-computing and number-crunching-aware people on python-dev. The result is that I sound like a lone voice arguing for so

Re: [Numpy-discussion] matrixdef.py

2006-10-30 Thread Travis Oliphant
Colin J. Williams wrote: > Line 71 has: data.view(subtype) > > This appears to involve a call to __array_finalize__. Is this an > unconditional call? > Yes. Every-time an array is constructed the __array_finalize__ method is called unless the __array_finalize__ attribute is None > If not, w

Re: [Numpy-discussion] Strange numpy.argmax behavior on object arrays in numpy 1.0.

2006-10-30 Thread Travis Oliphant
Tom Denniston wrote: > I recently upgraded to numpy 1.0 from 1.0b5. I noticed that > numpy.argmax behavior is very strange on object arrays. See below: > > (Pdb) numpy.__version__ > '1.0' > (Pdb) numpy.argmax(numpy.array([2, 3], dtype=object)) > 0 > (Pdb) numpy.argmax(numpy.array([2, 3], dtyp

Re: [Numpy-discussion] dtype.hasobject value

2006-10-30 Thread Travis Oliphant
Matthew Brett wrote: > Hi, > > I notice that the value for: > > zeros((1,), dtype=object).dtype.hasobject > > is now 63, whereas previously it had been 1. Is this intended? > > Yes. We are using hasobject as an 8-bit flag now and separating out some of the concepts that make object arrays ob

Re: [Numpy-discussion] glibc invalid pointer error

2006-10-30 Thread Travis Oliphant
David Huard wrote: > Ok, > I'll update numpy and give it another try tonight. > I just fixed some reference-count problems in f2py today. These were of the variety that there was a missing decref that would cause the reference count of certain often-used data-types to increase without bound a

Re: [Numpy-discussion] glibc invalid pointer error

2006-10-30 Thread Travis Oliphant
Fernando Perez wrote: >On 10/30/06, David Huard <[EMAIL PROTECTED]> wrote: > > >>Hi, >>I have a script that crashes, but only if it runs over 9~10 hours, with the >>following backtrace from gdb. The script uses PyMC, and repeatedly calls (> >>100) likelihood functions written in fortran and

Re: [Numpy-discussion] glibc invalid pointer error

2006-10-30 Thread Travis Oliphant
Fernando Perez wrote: >On 10/30/06, David Huard <[EMAIL PROTECTED]> wrote: > > >>Hi, >>I have a script that crashes, but only if it runs over 9~10 hours, with the >>following backtrace from gdb. The script uses PyMC, and repeatedly calls (> >>100) likelihood functions written in fortran and

[Numpy-discussion] Conversion about getting array interface into Python

2006-10-30 Thread Travis Oliphant
If anybody has a desire to see the array interface into Python, please help by voicing an opinion on python-dev in the discussion about adding data-type objects to Python. There are a few prominent people who don't get why applications would need to share data-type information about memory a

Re: [Numpy-discussion] recarray.__setattr__ bug?

2006-10-29 Thread Travis Oliphant
Michael McNeil Forbes wrote: > In article <[EMAIL PROTECTED]>, > Travis Oliphant <[EMAIL PROTECTED]> wrote: > >> Hmm I know that the code was changed at some point a few months ago >> specifically to this behavior because of some concerns Perry

Re: [Numpy-discussion] A recarray of arrays

2006-10-28 Thread Travis Oliphant
Pierre GM wrote: > Folks, > What is the easiest way to define a recarray of arrays ? > For example, I'd need something like that: > Given three arrays > x = N.arange(5) y = x+1 z = N.sqrt(x) > and a list of names: > n = ['x','y','z'] > Define a

Re: [Numpy-discussion] recarray.__setattr__ bug?

2006-10-28 Thread Travis Oliphant
Michael McNeil Forbes wrote: > Is the following the desired behaviour for setting recarray attributes? > This seems to clash with the semantics for arrays. > > >>> from numpy import * > >>> a = array([1,2,3]) > >>> b = a.view([('x',int),('y',int),('z',int)]) > >>> r = b.view(recarray) > >>>

Re: [Numpy-discussion] Defining custom types

2006-10-27 Thread Travis Oliphant
Jonathan Wang wrote: > On 10/27/06, *Travis Oliphant* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > > If I redefine the string function, I encounter another, perhaps more > > serious problem leading to a segfault. I've defined my string

Re: [Numpy-discussion] pyaudio, a module to make noise from numpy arrays

2006-10-27 Thread Travis Oliphant
David Cournapeau wrote: > Hi, >I announce the first release of pyaudio, a module to make noise from > numpy arrays (read, write and play audio files with numpy arrays). > Very nice. Thank you. I'd like to see exactly this kind of thing for video files too. We can get a lot of mileage

Re: [Numpy-discussion] dtype() examples that used to work

2006-10-27 Thread Travis Oliphant
Joris De Ridder wrote: > Hi, > > The following did once work in NumPy: > > dtype([int16]) dtype([[int16]]) dtype([uint,int32]) dtype(['f8','S10']) > > but now they all generate a "TypeError: data type not understood". Why? > I could not find the answer in help(d

Re: [Numpy-discussion] Python Enhancement Proposal (PEP) - Current status?

2006-10-27 Thread Travis Oliphant
Christopher Barker wrote: > Travis Oliphant wrote: > >> I'm working on two PEP's after discussing this with Guido at SciPy 2006. >> >> 1) A data-type object PEP >> 2) An extension of the buffer protocol to include the array interface. >> >> T

Re: [Numpy-discussion] Defining custom types

2006-10-27 Thread Travis Oliphant
Jonathan Wang wrote: > On 10/26/06, *Travis Oliphant* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > > Okay, is my understanding here correct? I am defining two type > > descriptors: > > PyArray_Descr mxNumpyType - describes the

Re: [Numpy-discussion] Python Enhancement Proposal (PEP) - Current status?

2006-10-27 Thread Travis Oliphant
Colin J. Williams wrote: > A July posting sets out the intent: > http://scipy.org/BaseArray > Version 3 of the draft: > http://numpy.scipy.org/array_interface.shtml > There is a description, from a C Structure perspective: > http://svn.scipy.org/svn/PEP/PEP_basearray.txt > > What is the current sta

Re: [Numpy-discussion] Defining custom types

2006-10-26 Thread Travis Oliphant
> It's just confusing as the documentation indicates that the setitem > function should return 0 for success and a negative number for > failure. But within Array_FromPyScalar, we have: > > ret->descr->f->setitem(op, ret->data, ret); > > if (PyErr_Occurred()) { >

Re: [Numpy-discussion] numpy-1.0 regress failure on OpenBSD

2006-10-26 Thread Travis Oliphant
Damien Miller wrote: >Hi, > >I have just got around to updating OpenBSD's numpy port from 1.0b1 to >1.0 and am running into the following regress failure: > > > >>.

Re: [Numpy-discussion] Defining custom types

2006-10-26 Thread Travis Oliphant
Jonathan Wang wrote: > I'm trying to write a Numpy extension that will encapsulate mxDateTime > as a native Numpy type. I've decided to use a type inherited from > Numpy's scalar double. However, I'm running into all sorts of > problems. I'm using numpy 1.0b5; I realize this is somewhat out of

Re: [Numpy-discussion] Unit test error with numpy rc3

2006-10-26 Thread Travis Oliphant
Charles R Harris wrote: > > > On 10/26/06, *Travis Oliphant* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Ted Horst wrote: > > On Mac OS X tiger (10.4) ppc, long double has increased > precision but > > the same range

Re: [Numpy-discussion] Unit test error with numpy rc3

2006-10-26 Thread Travis Oliphant
Ted Horst wrote: > On Mac OS X tiger (10.4) ppc, long double has increased precision but > the same range as double (it really is 128 bits not 80, btw), so > e**1000 is inf, so this is not really an error. > > Thanks for the clarification. Long-double is not standard across platforms wit

Re: [Numpy-discussion] vectorize pitfall

2006-10-25 Thread Travis Oliphant
A. M. Archibald wrote: > Hi, > > Vectorize is a very handy function, but it has at least one pitfall: > > def f(x): > if 1.3 return sqrt(x) > else: > return 0 > > Now vectorize(f)(2)=1.41421356237 but vectorize(f)(array([1,2]))=array([0,1]). > > The problem is that, when giv

Re: [Numpy-discussion] array + where return type: scalar vs. array

2006-10-24 Thread Travis Oliphant
Michael McNeil Forbes wrote: > Could someone please explain the semantics of the following. > > from numpy import * a1 = array([1,2,3]) a2 = array([[1,2,3]]) a1[where(a1==3)],a2[where(a2==3)] > (array([3]), 3) > > Why are 1-dimensional fundamentally different th

Re: [Numpy-discussion] Unit test error with numpy rc3

2006-10-24 Thread Travis Oliphant
Mark Hymers wrote: > On Thu, 19, Oct, 2006 at 08:29:26AM -0600, Travis Oliphant spoke thus.. > >> Actually, you shouldn't be getting an INF at all.This is what the >> test is designed to test for (so I guess it's working). The test was >> actually w

Re: [Numpy-discussion] slicing suggestion

2006-10-23 Thread Travis Oliphant
Keith Goodman wrote: > On 10/20/06, JJ <[EMAIL PROTECTED]> wrote: > >> My suggestion is to >> create a new attribute, such as .AR, so that the >> following could be used: M[K.AR,:] >> > > It would be even better if M[K,:] worked. Would such a patch be > accepted? (Not that I know how to mak

Re: [Numpy-discussion] slicing suggestion

2006-10-23 Thread Travis Oliphant
JJ wrote: > Hello. > I have a suggestion that might make slicing using > matrices more user-friendly. I often have a matrix of > row or column numbers that I wish to use as a slice. > If K was a matrix of row numbers (nx1) and M was a nxm > matrix, then I would use ans = M[K.A.ravel(),:] to >

Re: [Numpy-discussion] Release of 1.0 coming

2006-10-23 Thread Travis Oliphant
Albert Strasheim wrote: > Hey Travis > > >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:numpy- >> [EMAIL PROTECTED] On Behalf Of Travis Oliphant >> Sent: Tuesday, October 24, 2006 12:32 AM >> To: Discussion of Numerical Python >&g

Re: [Numpy-discussion] Strange and hard to reproduce crash

2006-10-23 Thread Travis Oliphant
Fernando Perez wrote: > On 10/23/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > >> Fernando Perez wrote: >> >>> Hi all, >>> >>> two colleagues have been seeing occasional crashes from very >>> long-running code which uses

[Numpy-discussion] Release of 1.0 coming

2006-10-23 Thread Travis Oliphant
The long awaited day is coming--- Wednesday is the target. Please submit problems before Tuesday (tomorrow). Nothing but bug-fixes are being changed right now. -Travis - Using Tomcat but need to do more? Need to suppo

Re: [Numpy-discussion] Strange and hard to reproduce crash

2006-10-23 Thread Travis Oliphant
Fernando Perez wrote: > Hi all, > > two colleagues have been seeing occasional crashes from very > long-running code which uses numpy. We've now gotten a backtrace from > one such crash, unfortunately it uses a build from a few days ago: > This looks like a reference-count problem on the data-t

Re: [Numpy-discussion] Strange results when sorting array with fields

2006-10-23 Thread Travis Oliphant
Albert Strasheim wrote: > Hello all > > I'm trying to sort an array with two fields, but I'm getting a result that > doesn't seem to make sense. > > What I tried (first attempt): I have two 2-D arrays. I would like to sort > one based on the sort of the other. I managed to do this with argsort. > H

Re: [Numpy-discussion] Strange results when sorting array with fields

2006-10-23 Thread Travis Oliphant
Albert Strasheim wrote: > Hello all > > I'm trying to sort an array with two fields, but I'm getting a result that > doesn't seem to make sense. > > What I tried (first attempt): I have two 2-D arrays. I would like to sort > one based on the sort of the other. I managed to do this with argsort. > H

Re: [Numpy-discussion] combinatorics

2006-10-23 Thread Travis Oliphant
Mathew Yeates wrote: > Hi > Is there any support for combinatorics in numpy or scipy? Actually, all > I need is to evaluate is (n/m) i.e. n choose m. > > In [3]: scipy.comb(109,54,exact=1) Out[3]: 49263609265046928387789436527216L 109 choose 54 -Travis --

Re: [Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Travis Oliphant
Brian Granger wrote: > Hi, > > i am running numpy on aix compiling with xlc. Revision 1.0rc2 works > fine and passes all tests. But 1.0rc3 and more recent give the > following on import: > Most likely the error-detection code is not working on your platform. The platform dependent stuff i

Re: [Numpy-discussion] Numpy-scalars vs Numpy 0-d arrays: copy or not copy?

2006-10-20 Thread Travis Oliphant
Sebastien Bardeau wrote: >>One possible solution (there can be more) is using ndarray: >> >>In [47]: a=numpy.array([1,2,3], dtype="i4") >>In [48]: n=1# the position that you want to share >>In [49]: b=numpy.ndarray(buffer=a[n:n+1], shape=(), dtype="i4") >> >> >> >Ok thanks. Actually that

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-20 Thread Travis Oliphant
A. M. Archibald wrote: >On 18/10/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > > >>If there are any cases satisfying these rules where a copy does not have >>to occur then let me know. >> >> > >For example, zeros((4,4))[:,1].reshape((2,

Re: [Numpy-discussion] adding an attribute to an nd-array

2006-10-19 Thread Travis Oliphant
Christopher Barker wrote: >Travis Oliphant wrote: > > >>Actually something as simple as >> >>class InfoArray(N.ndarray): >> pass >> >>will allow you to add attributes to InfoArray. >> >> > >Well, sure, but how the h

Re: [Numpy-discussion] adding an attribute to an nd-array

2006-10-19 Thread Travis Oliphant
Stefan van der Walt wrote: >On Wed, Oct 18, 2006 at 09:17:49PM -0400, Pierre GM wrote: > > >>On Wednesday 18 October 2006 20:29, Stefan van der Walt wrote: >> >> >>>A quick question on extending numpy arrays: is it possible to easily >>>add an attribute to an ndarray? >>> >>> >>It migh

Re: [Numpy-discussion] Unit test error with numpy rc3

2006-10-19 Thread Travis Oliphant
Tim Hochberg wrote: >Travis Oliphant wrote: > > >>Tim Hochberg wrote: >> >> >> >>>Rudolph van der Merwe wrote: >>> >>> >>> >>> >>>>I get the following error with RC3 on a RHE Linux box:

Re: [Numpy-discussion] Unit test error with numpy rc3

2006-10-19 Thread Travis Oliphant
Tim Hochberg wrote: > Rudolph van der Merwe wrote: > >> I get the following error with RC3 on a RHE Linux box: >> >> Python 2.4.3 (#4, Mar 31 2006, 12:12:43) >> [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>

Re: [Numpy-discussion] Product of an empty sequence

2006-10-19 Thread Travis Oliphant
Ivan Vilata i Balaguer wrote: > Today I was surprised by this:: > > import numpy numpy.__version__ > '1.0.dev3341' > numpy.prod(()) > 1.0 > > Wouldn't be 0.0 a more natural answer? I understand that 1 is neutral > on product operations, but I still

Re: [Numpy-discussion] adding an attribute to an nd-array

2006-10-19 Thread Travis Oliphant
Stefan van der Walt wrote: > On Wed, Oct 18, 2006 at 09:17:49PM -0400, Pierre GM wrote: > >> On Wednesday 18 October 2006 20:29, Stefan van der Walt wrote: >> >>> A quick question on extending numpy arrays: is it possible to easily >>> add an attribute to an ndarray? >>> >> It might

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
Charles R Harris wrote: > > > On 10/18/06, *Travis Oliphant* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Charles R Harris wrote: > > > Well, I knew that for numeric, but it was a good deal less > obvious in >

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
Charles R Harris wrote: > Well, I knew that for numeric, but it was a good deal less obvious in > combo with the order keyword. For instance, contiguous could change > its meaning to match up with FORTRAN, so that FORTRAN=True and > CONTIGUOUS=True meant Fortran contiguous, which was sort of w

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
Charles R Harris wrote: > > Could we make a few changes ;) > > For printing the flags I would suggest using C-Contiguous and > F-Contiguous so folks don't have to read the book. And at the c level > define alternates, i.e, #define c-contiguous contiguous or whatever. > That way backward compati

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
Tim Hochberg wrote: > One thing that may be confusing the issue is that, as I understand it, > FORTRAN and CONTIGUOUS together represent three states which I'll call > FORTRAN_ORDER, C_ORDER and DISCONTIGUOUS. Yep, that's what they mean. CONTIGUOUS is the name Numeric gave it and it meant C-

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
> > I'm not talking about the keyword in the ravel call, I'm talking about > the flag in a. Ah. Yes, I see. I misunderstood. Of course ravel ignores the FORTRAN flag (actually it doesn't because if a copy is not necessary it doesn't make one).The key is that the Python user doesn't need

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
> > I'm not talking about the keyword in the ravel call, I'm talking about > the flag in a. Ah. Yes, I see. I misunderstood. Of course ravel ignores the FORTRAN flag (actually it doesn't because if a copy is not necessary it doesn't make one).The key is that the Python user doesn't need

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
> > Currently, the key operation is reshape, which only needs to return a > view in fortran order and doesn't even need to mark the resulting > array as fortran order because, well, because it works just fine in > numpy as is, it just isn't contiguous. If the other functions took > shape and o

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
; On 17/10/06, Charles R Harris <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > > > > > On 10/17/06, Travis Oliphant < [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > > > >

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread Travis Oliphant
David Cournapeau wrote: > Sven Schreiber wrote: > >> Yes it's intended; as far as I understand the python/numpy syntax, <+> >> is an operator, and that triggers assignment by copy (even if you do >> something trivial as bar = +foo, you get a copy, if I'm not mistaken), >> >> > So basical

Re: [Numpy-discussion] sort(axis=-1)

2006-10-18 Thread Travis Oliphant
Christian Kristukat wrote: > Hi, > > it seems that -1 as axis parameter is interpreted like in array indexing, i.e. > -1 means the last axis rather than meaning the only axis of the flattened > representation, like for example with take(). > Is that intendend? > > I don't understand the questio

[Numpy-discussion] NumPy 1.0rc3 will be out in a few hours

2006-10-18 Thread Travis Oliphant
I'm going to release NumPy 1.0rc3 in a few hours. It requires a re-build of extension modules from 1.0rc2. This gives us a chance to start fresh with NumPy 1.0 and also test the non-dying version of the version_checking code. So, it's not all bad. Official NumPy 1.0 will be released on Oct

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
> > You are right, it doesn't need to. My check is not general > enough. > > It can be challenging to come up with a general way to > differentiate the > view-vs-copy situation and I struggled with it. In this case, > it's the > fact that

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-18 Thread Travis Oliphant
Stefan van der Walt wrote: > One last case, which confuses me still (probably because it is > 04:16am): > > In [41]: x = N.array([[0,1,2],[3,4,5]],order='F') > > In [42]: x > Out[42]: > array([[0, 1, 2], >[3, 4, 5]]) > > I assume the data is now stored in memory as > > [0 3 1 4 2 5] (colum

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-17 Thread Travis Oliphant
Charles R Harris wrote: > > > On 10/17/06, *Lisandro Dalcin* <[EMAIL PROTECTED] > > wrote: > > I was surprised by this > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > Out[14]: > array([[1, 5], >[4, 3], >[2, 6]]) > >

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-17 Thread Travis Oliphant
Charles R Harris wrote: > > > On 10/17/06, *Lisandro Dalcin* <[EMAIL PROTECTED] > > wrote: > > I was surprised by this > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > Out[14]: > array([[1, 5], >[4, 3], >[2, 6]]) > >

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-17 Thread Travis Oliphant
Stefan van der Walt wrote: > Hi all, > > Some of you may have seen the interesting thread on Fortran-ordering > earlier. I thought it might be fun to set up a short quiz which tests > your knowledge on the topic. > > If you're up for the challenge, take a look at > > http://mentat.za.net/numpy/qui

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-17 Thread Travis Oliphant
Lisandro Dalcin wrote: > I was surprised by this > > In [14]: array([[1,2,3],[4,5,6]]).reshape((3,2),order='F') > Out[14]: > array([[1, 5], >[4, 3], >[2, 6]]) > > In [15]: array([1,2,3,4,5,6]).reshape((3,2),order='F') > Out[15]: > array([[1, 2], >[3, 4], >[5, 6]]) >

Re: [Numpy-discussion] matlab, filter function

2006-10-17 Thread Travis Oliphant
Kenny Ortmann wrote: >just looking for some help, most of the time you guys are good with matlab >code, i am trying to use the filter function under this setting > >y = filter(b,a,X) filters the data in vector X with the filter described by >numerator coefficient vector b and denominator coeffic

Re: [Numpy-discussion] array repr

2006-10-17 Thread Travis Oliphant
Ah!, I get it. You want to be able to reset to the C-defined array_repr function. The one that gets over-written on import.That makes sense. And is definitely do-able. Please file a ticket. -Travis - Using Tomc

Re: [Numpy-discussion] Accessing data buffers in numpy scalars

2006-10-17 Thread Travis Oliphant
Lisandro Dalcin wrote: >On 10/17/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > >>Or you can use the Python C-API >> >>const char *buffer; >>Py_ssize_t buflen; >> >>PyObject_AsReadBuffer(scalar, (const void **)&buffer, &buflen) &g

Re: [Numpy-discussion] array repr

2006-10-17 Thread Travis Oliphant
Andrew MacKeith wrote: >I would like to use the built-in array_repr in numpy, because >I need a fast repr that does not contain new line characters. >I see no way of doing this without editing the code in numeric.py, >and I hate to edit other people's libraries. > >from numpy import array >causes

Re: [Numpy-discussion] Why doesn't array(a, dtype=single, copy=0) downcast a double array.

2006-10-17 Thread Travis Oliphant
Travis Oliphant wrote: >Charles R Harris wrote: > > >>It seems to me that since the behaviour when copy=0 is to make a copy >>only if necessary, it should find it necessary and make the downcast. >>After all, array(a, dtype=single, copy=1) does just that without &g

Re: [Numpy-discussion] What does Fortran order mean?

2006-10-17 Thread Travis Oliphant
Stefan van der Walt wrote: >On Tue, Oct 17, 2006 at 10:01:51AM -0600, Travis Oliphant wrote: > > >>Charles R Harris wrote: >> >> >> >>>Travis, >>> >>>I note that >>> >>> >>> >>>>>>

Re: [Numpy-discussion] Accessing data buffers in numpy scalars

2006-10-17 Thread Travis Oliphant
Francesc Altet wrote: >Hi, > >I'm looking for an easy way to access the data area of the numpy scalars no >matter its type. I've seen that numpy/arrayscalars.h define a structure for >each scalar type, so I'd guess that it will not be possible to find a general >way for accessing the data buff

Re: [Numpy-discussion] What does Fortran order mean?

2006-10-17 Thread Travis Oliphant
Charles R Harris wrote: > Travis, > > I note that > > >>> a = arange(6).reshape(2,3,order='F') > >>> a > array([[0, 1, 2], >[3, 4, 5]]) > > Shouldn't that be 3x2? Or maybe [[0,2,4],[1,3,5]]? Reshape is making a > copy, but flat, flatten, and tostring all show the elements in 'C' > order.

Re: [Numpy-discussion] Why doesn't array(a, dtype=single, copy=0) downcast a double array.

2006-10-16 Thread Travis Oliphant
Charles R Harris wrote: > It seems to me that since the behaviour when copy=0 is to make a copy > only if necessary, it should find it necessary and make the downcast. > After all, array(a, dtype=single, copy=1) does just that without > complaint. Some common code in linalg could be replaced if

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] 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 -

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 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,

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 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 >

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

2006-10-11 Thread Travis Oliphant
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 exactly what scipy.sqrt(-1)

  1   2   3   4   5   6   >