[Numpy-discussion] Update to Array-Interface PEP

2007-01-04 Thread Travis E. Oliphant
Here is a new update. I added the PY_POINTER, and PY_ARRAYOF specifications to simplify the extended specification and allow memory that is a pointer to another memory. This should be the last update today. -Travis PEP: unassigned Title: Extending the buffer protocol to include the array

Re: [Numpy-discussion] numpy build fails on powerpc ydl

2007-08-31 Thread Travis E. Oliphant
Vincent Broman wrote: My build of numpy fails under Yellow Dog Linux 2.1, running on a powerpc multiprocessor board from Curtiss-Wright. Its kernel is 2.4.19-Asmp tailored by the vendor. The gcc compiler is configured as ppc-yellowdog-linux with version number 2.95.3 20010111. The python

Re: [Numpy-discussion] von mises distribution in numpy.random biased

2007-09-08 Thread Travis E. Oliphant
killian koepsell wrote: hi, the von mises distribution in numpy.random seems to be biased towards a higher concentration (kappa). given a concentration of 2, it produces data that has a concentration of 2.36. i compared the distribution to the one produced by the CircStats[1] package of R[2]

Re: [Numpy-discussion] how to include numpy headers when building an extension?

2007-09-11 Thread Travis E. Oliphant
Christopher Barker wrote: [OT: why the heck do none of the SWIG docs give examples (or even suggest) using distutils for building SWIG extensions???] I'm pretty sure this is because the people who contributed to the SWIG docs the most are not currently using numpy.distutils (but probably

Re: [Numpy-discussion] numpy.ndarrays as C++ arrays (wrapped with boost)

2007-09-11 Thread Travis E. Oliphant
nd to copy hundres of MB around unnecessarily. I think it is a real shame that boost currently doesn't properly support numpy out of the box, although numpy has long obsoleted both numarray and Numeric (which is both buggy and completely unsupported). All the more so since writing

Re: [Numpy-discussion] Slicing/selection in multiple dimensions simultaneously

2007-09-11 Thread Travis E. Oliphant
Timothy Hochberg wrote: On 9/11/07, *Robert Kern* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Mike Ressler wrote: The following seems to be a wart: is it expected? Set up a 10x10 array and some indexing arrays: a=arange(100) a.shape=(10,10)

Re: [Numpy-discussion] Requesting svn write access to numpy ?

2007-09-14 Thread Travis E. Oliphant
David Cournapeau wrote: Hi, I would like to know whether I could request svn write access to numpy svn. There are several things I would like to work on which are big enough so that just patch would be difficult, and branches more appropriate, and my understanding is that svn branches

Re: [Numpy-discussion] NotImplementedType

2007-09-14 Thread Travis E. Oliphant
Tom Denniston wrote: Sometimes numpy operationrs result in NotImplementedType. It makes it a little hard to debug because the problem then crops up later when you try to do an operation with the NotImplementedType. Does anyone know of a way to get numpy to raise instead of returning not

Re: [Numpy-discussion] Segfault on wrong use of indexing

2007-09-17 Thread Travis E. Oliphant
Arnar Flatberg wrote: However, when I tried to to insert a 1-dim array with a 'two-dim' index things went wrong: a[[0],:] = [2,2] Segmentation fault I do not see this error in latest trunk of numpy (I suspect it's also not there in the latest release). Am I just a

Re: [Numpy-discussion] latest svn version fails on Solaris

2007-09-19 Thread Travis E. Oliphant
Christopher Hanley wrote: Hi, The latest version of numpy has a unit test failure on big endian machines. Thanks Chris, Do you know which version last succeeded? -Travis ___ Numpy-discussion mailing list Numpy-discussion@scipy.org

Re: [Numpy-discussion] Bitting the bullet: using scons to build extensions inside distutils ?

2007-09-19 Thread Travis E. Oliphant
David Cournapeau wrote: Hi, Starting thinking over the whole distutils thing, I was thinking what people would think about using scons inside distutils to build extension. The more I think about it, the more I think than distutils not being maintained, and numpy/scipy building needs being

Re: [Numpy-discussion] Compilation failure on python2.4 win32

2007-09-19 Thread Travis E. Oliphant
Jörgen Stenarson wrote: Hi, I cannot compile numpy (rev 2042) for python2.4 on win32, it works on python2.5. It looks like the call to function get_build_architecture in distutils.misc_util.py is python2.5 specific. Yes. This needs to be fixed. I'll do it. Can you try the current

Re: [Numpy-discussion] Use of PyArray FromAny() with a PyArrayInterface object

2007-10-12 Thread Travis E. Oliphant
Neal Becker wrote: Matthieu Brucher wrote: 2007/10/12, Alan G Isaac [EMAIL PROTECTED]: On Fri, 12 Oct 2007, Matthieu Brucher apparently wrote: I'm trying to understand (but perhaps everything is in the numpy book in which case I'd rather buy the book immediately) how to

Re: [Numpy-discussion] Error in deallocation ?

2007-10-15 Thread Travis E. Oliphant
Matthieu Brucher wrote: Hi I keep on getting this error : *** Reference count error detected: an attempt was made to deallocate 7 (l) *** It happens on numpy calls (multiplications, call to inner(), ...), but I didn't find the real reason. I'm using Numpy ' 1.0.4.dev3875' with Python

Re: [Numpy-discussion] Error in deallocation ?

2007-10-15 Thread Travis E. Oliphant
Matthieu Brucher wrote: The problem is that there is a data-type reference counting error some where that is attempting to deallocate the built-in data-type 'l' That's what I supposed, but I couldn't find the reason why it wanted to do this It's not really a Python error

Re: [Numpy-discussion] Request for advice: project to get NumPy working in IronPython

2007-10-15 Thread Travis E. Oliphant
Giles Thomas wrote: Hi, At Resolver Systems, we have a product that is written in IronPython - the .NET Python implementation - and allows users to use that language to script a spreadsheet-like interface. Because they're using IronPython, they can access their existing .NET objects and

Re: [Numpy-discussion] setting the attributes of an array of object

2007-10-16 Thread Travis E. Oliphant
Sebastian Haase wrote: Hi, there is a way of doing this. As far as I know, you have to create your own version of numpy arrays. E. g. try this: class myNumpy(numpy.ndarray): pass Then creating an instance as in a = myNumpy(otherNumpyArray) would make `a` behave just like any other

Re: [Numpy-discussion] NumPy 1.0.4 release

2007-10-18 Thread Travis E. Oliphant
David Cournapeau wrote: Hi Jarrod, Would it be possible to merge some of the work I have done recently concerning cleaning configuration and so on (If nobody is against it, of course) ? If this is considerer too big of a change, what is the plan for a 1.1 release, if any ?

Re: [Numpy-discussion] NumPy 1.0.4 release

2007-10-18 Thread Travis E. Oliphant
Travis E. Oliphant wrote: We can't change the C-API for PyArray_FromAny to accept an alignment flag, and I'm pretty loath to do that even for 1.1. Ooops! Pleas read that as can't accept an alignment *argument* -Travis ___ Numpy-discussion

Re: [Numpy-discussion] NumPy 1.0.4 release

2007-10-18 Thread Travis E. Oliphant
I've finally caught up with the discussion on aligned allocators for NumPy. In general I'm favorable to the idea, although it is not as easy to implement in 1.0.X because of the need to possibly change the C-API. The Python solution is workable and would just require a function call on the

Re: [Numpy-discussion] fortran array storage question

2007-10-26 Thread Travis E. Oliphant
Anne Archibald wrote: On 26/10/2007, Georg Holzmann [EMAIL PROTECTED] wrote: if in that example I also change the strides: int s = tmp-strides[1]; tmp-strides[0] = s; tmp-strides[1] = s * dim0[0]; Then I get in python the fortran-style array in right order. This is

Re: [Numpy-discussion] Request for advice: project to get NumPy working in IronPython

2007-10-26 Thread Travis E. Oliphant
An IronPython compatible version of NumPy would be great.Of course it could be done by using C# to write NumPy, but I'm not sure that this would really be any less work than creating a glue layer that allowed most (or all) C-Python extensions to work with IronPython. I'm curious

Re: [Numpy-discussion] Memory leak in ndarray, more info

2007-10-28 Thread Travis E. Oliphant
Karol Langner wrote: I opened a ticket for this (#602). Hopefully someone will confirm that adding that Py_DECREF call fixes the leak and someone with write access patches it in svn. Thanks for looking into this and isolating the problem... -Travis O.

Re: [Numpy-discussion] boolean masks lists

2007-11-06 Thread Travis E. Oliphant
John Hunter wrote: A colleague of mine just asked for help with a pesky bug that turned out to be caused by his use of a list of booleans rather than an array of booleans as his logical indexing mask. I assume this is a feature and not a bug, but it certainly surprised him: In [58]: mask =

Re: [Numpy-discussion] Making a minimalist NumPy

2007-11-06 Thread Travis E. Oliphant
Benjamin M. Schwartz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 NumPy is included in the OLPC operating system, which is very constrained in space. Therefore, it would be nice to remove some subpackages to save a few megabytes. For example, the system does not include any Fortran

Re: [Numpy-discussion] Unnecessarily bad performance of elementwise operators with Fortran-arrays

2007-11-08 Thread Travis E. Oliphant
Hans Meine wrote: Hi! I wonder why simple elementwise operations like a * 2 or a + 1 are not performed in order of increasing memory addresses in order to exploit CPU caches etc. C-order is special in NumPy due to the history. I agree that it doesn't need to be and we have taken

Re: [Numpy-discussion] Unnecessarily bad performance of elementwise operators with Fortran-arrays

2007-11-08 Thread Travis E. Oliphant
Christopher Barker wrote: This discussion makes me wonder if the basic element-wise operations could (should?) be special cased for contiguous arrays, reducing them to simple pointer incrementing from the start to the finish of the data block. The same code would work for C and Fortran

Re: [Numpy-discussion] Unnecessarily bad performance of elementwise operators with Fortran-arrays

2007-11-08 Thread Travis E. Oliphant
David Cournapeau wrote: Travis E. Oliphant wrote: I wasn't talking about the min, mean, and max methods specifically. These are all implemented with the reduce method of a ufunc. Ah, my mistake, I wrongly understood only some of them were implemented through ufunc

Re: [Numpy-discussion] Unnecessarily bad performance of elementwise operators with Fortran-arrays

2007-11-09 Thread Travis E. Oliphant
Hans Meine wrote: Fortran order arrays can be preserved but it takes a little extra work because backward compatible expectations had to be met. See for example the order argument to the copy method of arrays. What do you mean exactly (if you have something specific in mind at

Re: [Numpy-discussion] numpy 1.04 numpy.test() hang

2007-11-09 Thread Travis E. Oliphant
Geoffrey Zhu wrote: Very interesting! If I use the MSI file, numpy.test() hangs. If, however, I use the EGG file, it is actually fine. Can you find the md5sum of these files? There is a md5sum.exe at http://www.etree.org/md5com.html It would be good to verify that you have the correct

Re: [Numpy-discussion] Merging new (optional) build system in the trunk ?

2007-11-12 Thread Travis E. Oliphant
David Cournapeau wrote: Hi, I would appreciate to get some comment on whether there is any chance to get my numpy.scons branch merge into the trunk at some near future. I feel to have reached the point where the only big thing missing is more testing. I tried to test it on many

Re: [Numpy-discussion] Warnings as exceptions?

2007-11-13 Thread Travis E. Oliphant
Michael McNeil Forbes wrote: Why are numpy warnings printed rather than issued using the standard warnings library? I know that the behaviour can be controlled by seterr(), but it seem rather unpythonic not to use the warnings library. The warn option explicitly allows you to use the

Re: [Numpy-discussion] Converting char array to float

2007-11-28 Thread Travis E. Oliphant
Sameer DCosta wrote: I'm trying to convert a character array to a floating point array. I'm using one of the recent svn builds. It is surprising that astype does not do the job. However if I first convert the char array to an array and then use astype everything works fine. Is this a bug?

Re: [Numpy-discussion] Minimum and maximum values of numpy datatypes?

2007-12-10 Thread Travis E. Oliphant
Hans Meine wrote: Hi! Is there a way to query the minimum and maximum values of the numpy datatypes? numpy.iinfo (notice the two i's) (integer information) numpy.finfo (floating point information) Example: numpy.iinfo(numpy.uint8).max numpy.iinfo(numpy.int16).min You pass the datatype

Re: [Numpy-discussion] Changing the distributed binary for numpy 1.0.4 for windows ?

2007-12-10 Thread Travis E. Oliphant
Fernando Perez wrote: On Dec 10, 2007 4:41 PM, Robert Kern [EMAIL PROTECTED] wrote: The current situation is untenable. I will gladly accept a slow BLAS for an official binary that won't segfault anywhere. We can look for a faster BLAS later. Just to add a note to this: John

Re: [Numpy-discussion] ndarray.clip only with lower or upper values?

2007-12-11 Thread Travis E. Oliphant
Hans Meine wrote: On Dienstag 11 Dezember 2007, Timothy Hochberg wrote: You mean one of the following? a.clip(min = 10, max = numpy.finfo(a.dtype).max) a.clip(min = 10, max = numpy.iinfo(a.dtype).max) No. I mean: numpy.maximum(a, 10) To correspond to the above example.

Re: [Numpy-discussion] Changing the distributed binary for numpy 1.0.4 for windows ?

2007-12-12 Thread Travis E. Oliphant
Fernando Perez wrote: I will put new binaries on the sourceforge site this weekend for both NumPy 1.0.4 and SciPy 0.6.0. I should be able to find an old PIII WinXP machine around somewhere, which I will devote to building the official non-SSE2 releases from here on out. Great, many

Re: [Numpy-discussion] resize in old Numeric

2007-12-12 Thread Travis E. Oliphant
Christian Meesters wrote: Hi, For compatibility reasons (work with Biopython) I would like to use to Numeric in some code of mine. (Of course, I could make a little detour converting into numpy.array, but first I wonder whether somebody might know a solution for the problem with Numeric.)

[Numpy-discussion] SciPy Sprint results

2007-12-19 Thread Travis E. Oliphant
Hi all, We had a great Sprint at Berkeley over last weekend. Jarrod deserves a huge hand for organizing it and Fernando should be also congradulated for making the Sprint a productive communication session with a lot of different people. Going forward, there will be a relatively informal

Re: [Numpy-discussion] Compiler change for Windows version between 1.0.3.1 and 1.0.4?

2007-12-19 Thread Travis E. Oliphant
Stuart Brorson wrote: Hi -- I have found a bug in numpy-1.0.4. The bug is a crash when doing linalg.inv() on a Windows machine. The machine is an old Pentium 3 machine. The error report indicates an invalid op code. Details about this bug are in the numpy tracker under ticket 635.

[Numpy-discussion] Mailing list was not sending out new mails for awhile.

2007-12-19 Thread Travis E. Oliphant
Hi all, The postfix service on the server hosting several of the mailing lists was down since Monday. Mails to the list were preserved and archived but were not being distributed to subscribers. We restarted the postfix service and messages should now be going out. Apologies for the

Re: [Numpy-discussion] Towards using scons in numpy: 1st step

2007-12-19 Thread Travis E. Oliphant
David Cournapeau wrote: Hi, as discussed with some other numpy developers, in particular Travis, I started to prepare my work related to scons for step-by-step merging into the trunk. The first step is done, and is in cleanconfig_rtm branch (rtm for ready to merge). This branch basically:

Re: [Numpy-discussion] [SciPy-dev] SciPy Sprint results

2007-12-20 Thread Travis E. Oliphant
Stefan van der Walt wrote: Hi Travis, During the sprint I also merged Pierre's MaskedArray code into the maskedarray branch. That is nearly done, with only a few unit tests still failing -- ones brought over from the old numpy.ma. This is mainly due to some changes in the API, for example

Re: [Numpy-discussion] [SciPy-dev] SciPy Sprint results

2007-12-20 Thread Travis E. Oliphant
Pierre GM wrote: All, I'd like to move forward with it sooner (for 1.0.5) if the API changes are not drastic. Although ideally 0 API changes would be desireable, I'm not sure if that is feasible. Are put and putmask the only changes in the API. What are the rest of them?

Re: [Numpy-discussion] ising model: f2py vs cython comparison

2007-12-22 Thread Travis E. Oliphant
Ondrej Certik wrote: Hi, I need to write 2D Ising model simulation into my school, so I wrote it in Python, then rewrote it in Fortran + f2py, and also Cython: http://hg.sharesource.org/isingmodel/ And Cython solution is 2x faster than f2py. I understand, that I am comparing many things -

[Numpy-discussion] Doc-day

2007-12-27 Thread Travis E. Oliphant
Doc-day will start tomorrow (in about 12 hours). It will be Friday for much of America and be moving into Saturday for Europe and Asia. Join in on the irc.freenode.net (channel scipy) to coordinate effort. I imaging people will be in an out. I plan on being available in IRC from about

Re: [Numpy-discussion] [SciPy-dev] Doc-day

2007-12-28 Thread Travis E. Oliphant
Stefan van der Walt wrote: On Thu, Dec 27, 2007 at 09:27:09PM -0800, Jarrod Millman wrote: On Dec 27, 2007 7:42 PM, Travis E. Oliphant [EMAIL PROTECTED] wrote: Doc-day will start tomorrow (in about 12 hours). It will be Friday for much of America and be moving into Saturday

Re: [Numpy-discussion] [SciPy-dev] Doc-day

2007-12-29 Thread Travis E. Oliphant
Charles R Harris wrote: On Dec 29, 2007 7:59 PM, Fernando Perez [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Dec 29, 2007 6:51 PM, Charles R Harris [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: If not, we should definitely decide on the structure of the

Re: [Numpy-discussion] random access iterators

2007-12-30 Thread Travis E. Oliphant
Neal Becker wrote: I'm looking at writing some c++ code to interoperate with numpy. A c++ random access iterator must include a 'distance' function. distance (i1, i2) must return the number of times i1 has to be incremented to reach i2. Is there a way to get this from PyArrayIterObject?

Re: [Numpy-discussion] how to create an array of objects that are sequences?

2008-01-04 Thread Travis E. Oliphant
Charles R Harris wrote: On Jan 4, 2008 11:13 AM, Pearu Peterson [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Fri, January 4, 2008 7:33 pm, Travis E. Oliphant wrote: So, create an empty object array and insert the entries the way you want them

Re: [Numpy-discussion] Moving away from svn ?

2008-01-05 Thread Travis E. Oliphant
David M. Cooke wrote: On Jan 4, 2008, at 13:58 , Fernando Perez wrote: My vote so far is for hg, for performance reasons but also partly because sage and sympy already use it, two projects I'm likely to interact a lot with and that are squarely in line with the

Re: [Numpy-discussion] Moving away from svn ?

2008-01-06 Thread Travis E. Oliphant
Robert Kern wrote: Travis E. Oliphant wrote: I don't think it is time to move wholesale to something like Mercurial or bzr. I would prefer it if all of the Enthought-hosted projects moved to the (new) system at once, which is not going to happen in the short term (but long term

Re: [Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

2008-01-07 Thread Travis E. Oliphant
Bruce Sherwood wrote: Okay, I've implemented the scheme below that was proposed by Scott Daniels on the VPython mailing list, and it solves my problem. It's also much faster than using numpy directly: even with the def and if overhead: sqrt(scalar) is over 3 times faster than the numpy

Re: [Numpy-discussion] CASTABLE flag

2008-01-07 Thread Travis E. Oliphant
Charles R Harris wrote: Hi All, I'm thinking that one way to make the automatic type conversion a bit safer to use would be to add a CASTABLE flag to arrays. Then we could write something like a[...] = typecast(b) where typecast returns a view of b with the CASTABLE flag set so that

Re: [Numpy-discussion] Does float16 exist?

2008-01-07 Thread Travis E. Oliphant
Darren Dale wrote: One of my collaborators would like to use 16bit float arrays. According to http://www.scipy.org/Tentative_NumPy_Tutorial, and references to float16 in numpy.core.numerictypes, it appears that this should be possible, but the following doesnt work: No, it's only

Re: [Numpy-discussion] Is __array_interface__ supposed to work on numpy scalars?

2008-01-07 Thread Travis E. Oliphant
Andrew Straw wrote: Travis E. Oliphant wrote: Andrew Straw wrote: Hi, I'm forwarding a bug from PyOpenGL. The developer, Mike Fletcher, is having troubles accessing a numpy scalar with the __array_interface__. Is this supposed to work? Or should __array_interface__ trigger

Re: [Numpy-discussion] Is __array_interface__ supposed to work on numpy scalars?

2008-01-07 Thread Travis E. Oliphant
Andrew Straw wrote: Hi, I'm forwarding a bug from PyOpenGL. The developer, Mike Fletcher, is having troubles accessing a numpy scalar with the __array_interface__. Is this supposed to work? Or should __array_interface__ trigger an AttributeError on a numpy scalar? Note that I haven't done

Re: [Numpy-discussion] def of var of complex

2008-01-08 Thread Travis E. Oliphant
Robert Kern wrote: Neal Becker wrote: I noticed that if I generate complex rv i.i.d. with var=1, that numpy says: var (real part) - (close to 1.0) var (imag part) - (close to 1.0) but var (complex array) - (close to complex 0) Is that not a strange definition? 2. Take a

Re: [Numpy-discussion] example of ufunc c-code?

2008-01-10 Thread Travis E. Oliphant
Neal Becker wrote: Where can I find a (hopefully simple) example of c-code for a ufunc? Probably in scipy.special and or umathmodule.c in numpy/core/src. The key is to register a 1-d inner loop that performs the basic calculation for a particular data-type. You also need to provide the

Re: [Numpy-discussion] Setting WRITEABLE flag on array scalar

2008-01-10 Thread Travis E. Oliphant
Stefan van der Walt wrote: Hi all, We currently use an array scalar of value False as the mask in MaskedArray. I would like to make sure that the mask value cannot be modified, but when I try import numpy as np x = np.bool_(False) x.flags['WRITEABLE'] = False I am warned that you

Re: [Numpy-discussion] Nose testing for numpy

2008-01-14 Thread Travis E. Oliphant
Matthew Brett wrote: Hi, I've just finished moving the scipy tests over to nose. Thinking about it, it seems to me to be a good idea to do the same for numpy. We talked about this at the SciPy Sprint. Eventually, we will get there. However, if we do it before 1.0.5, it will require

Re: [Numpy-discussion] Ctypes reference counting

2008-01-18 Thread Travis E. Oliphant
Ryan May wrote: Hi, Can someone explain the reference counting wrt using ctypes and numpy. Specifically, I have code like: from ctypes import * import numpy as N class Data(Structure): _fields_=[('var',POINTER(c_float))] d = Data() d.var = N.arange(100.,

Re: [Numpy-discussion] How to build on Solaris 10 (x86) using sunperf?

2008-01-22 Thread Travis E. Oliphant
Peter Ward wrote: Hi, I have been trying to build numpy on an opteron based Solaris 10 machine, with poor results. After skimming over the discussion archives I noticed a branch for numpy.sunperf in the svn repository. Unfortunately this is no longer available, so I was curious as to

Re: [Numpy-discussion] Looking to access C array in numpy.

2008-01-22 Thread Travis E. Oliphant
Clarke, Trevor wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm calling some python code from a C++ app via an intermediary library (i.e. I can't directly create Python C objects like Buffers). I'm passing a void* (cast to a long) to the python method and I'd like to use numpy to

Re: [Numpy-discussion] Looking to access C array in numpy.

2008-01-22 Thread Travis E. Oliphant
Travis E. Oliphant wrote: Clarke, Trevor wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm calling some python code from a C++ app via an intermediary library (i.e. I can't directly create Python C objects like Buffers). I'm passing a void* (cast to a long) to the python method

Re: [Numpy-discussion] __array_interface__ / __array_struct__

2008-01-22 Thread Travis E. Oliphant
Thomas Heller wrote: Travis E. Oliphant schrieb: Thomas Heller wrote: I am experimenting with implementing __array_interface__ and/or __array_struct__ properties for ctypes instances, and have problems to create numpy arrays from them that share the memory. Probably I'm doing

Re: [Numpy-discussion] NPY_FORCECAST

2008-01-25 Thread Travis E. Oliphant
Bill Spotz wrote: Hi, I am currently using PyArray_FromObject() to convert an input argument to a 32-bit integer array. On a 64-bit architecture, it is easy to create an integer array whose default type is 64-bit. When this is sent to PyArray_FromObject(), it raises an error, saying

[Numpy-discussion] Doc-days are today! Come join on irc.freenode.net (#scipy)

2008-01-25 Thread Travis E. Oliphant
___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Problems with long

2008-01-26 Thread Travis E. Oliphant
Tom Johnson wrote: Hi, I'm having some troubles with long. from numpy import log log(8463186938969424928L) 43.5822574833 log(10454852688145851272L) type 'exceptions.AttributeError': 'long' object has no attribute 'log' The problem is that the latter long

Re: [Numpy-discussion] preparing for 1.0.5 release

2008-01-29 Thread Travis E. Oliphant
Matthew Brett wrote: Hi, http://projects.scipy.org/scipy/numpy/browser/branches/build_with_scons/ Excellent idea - and congratulations to David for all his hard work - but this is a large change, and I wonder if we need more time with the scons build system in the svn trunk?

Re: [Numpy-discussion] Median again

2008-01-29 Thread Travis E. Oliphant
Matthew Brett wrote: Hi, median moved mediandim0 implementation of medianwithaxis or similar, with same call signature as mean. But - for the median function change - do we agree that this should be changed? I think it is a significant wart in the numpy API, and has caught

Re: [Numpy-discussion] Median again

2008-01-29 Thread Travis E. Oliphant
Joris De Ridder wrote: On 30 Jan 2008, at 00:32, Travis E. Oliphant wrote: Matthew Brett wrote: Hi, median moved mediandim0 implementation of medianwithaxis or similar, with same call signature as mean. But - for the median function change - do we agree

Re: [Numpy-discussion] Median again

2008-01-30 Thread Travis E. Oliphant
Timothy Hochberg wrote: On Jan 29, 2008 5:48 PM, Travis E. Oliphant [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Joris De Ridder wrote: On 30 Jan 2008, at 00:32, Travis E. Oliphant wrote: Matthew Brett wrote: Hi, median moved

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Travis E. Oliphant
James Philbin wrote: I can't fathom where the comparison functions exist in the code. It seems that the comparison signature is of the form (void*, void*, PyArrayObject*), so it doesn't seem possible at the moment to specify a compare function which can reason about the underlying types of the

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Travis E. Oliphant
James Philbin wrote: I can't fathom where the comparison functions exist in the code. It seems that the comparison signature is of the form (void*, void*, PyArrayObject*), so it doesn't seem possible at the moment to specify a compare function which can reason about the underlying types of the

Re: [Numpy-discussion] round, fix, ceil, and floor for complex args

2008-02-04 Thread Travis E. Oliphant
Stuart Brorson wrote: Anyway, since NumPy is committed to (Re, Im) as the base representation of complex numbers, then it is not unreasonable to implement round, fix, and so on, by operating independently on the Re and Im parts. Or am I wrong? Sounds reasonable to me... -Travis O.

Re: [Numpy-discussion] Problem accessing elements of an array of dtype=O from C

2008-02-05 Thread Travis E. Oliphant
Chris Ball wrote: Hi, I'm having some trouble accessing elements in an array of dtype=O from C code; I hope someone on the list could give me some advice (because I might be doing something stupid). I have an array of simple objects, created as follows: class CF(object): def

Re: [Numpy-discussion] Question for Travis

2008-02-13 Thread Travis E. Oliphant
Charles R Harris wrote: Travis, I notice that you used PyDataMem_NEW, PyDimMem_NEW, and friends to allocate memory in the sort routines. Is there a good reason to use these rather than malloc? Only to allow for the possibility of different allocation routines. There is an option to use

[Numpy-discussion] Matching 0-d arrays and NumPy scalars

2008-02-20 Thread Travis E. Oliphant
Hi everybody, In writing some generic code, I've encountered situations where it would reduce code complexity to allow NumPy scalars to be indexed in the same number of limited ways, that 0-d arrays support. For example, 0-d arrays can be indexed with * Boolean masks * Ellipses

Re: [Numpy-discussion] Matching 0-d arrays and NumPy scalars

2008-02-21 Thread Travis E. Oliphant
Konrad Hinsen wrote: On 21.02.2008, at 08:41, Francesc Altet wrote: Well, it seems like a non-intrusive modification, but I like the scalars to remain un-indexable, mainly because it would be useful to raise an error when you are trying to index them. In fact, I thought that when you

Re: [Numpy-discussion] Matching 0-d arrays and NumPy scalars

2008-02-21 Thread Travis E. Oliphant
Damian Eads wrote: While we are on the subject of indexing... I use xranges all over the place because I tend to loop over big data sets. Thus I try avoid to avoid allocating large chunks of memory unnecessarily with range. While I try to be careful not to let xranges propagate to the

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Travis E. Oliphant
Konrad Hinsen wrote: On 22.02.2008, at 01:10, Alan G Isaac wrote: Someone once pointed out on this list that one might consider a matrix to be a container of 1d vectors. For NumPy, however, it is natural that it be a container of 1d arrays. (See the discussion for the distinction.)

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Travis E. Oliphant
Could you explain to me how you'd like this to be fixed? If the matrix becomes a container of 1-d arrays, then you can no longer expect x[:,0] to return a column vector -- which was one of the reasons the matrix class was created. While not entirely consistent, one workaround would be

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Travis E. Oliphant
On Fri, 22 Feb 2008, Stefan van der Walt apparently wrote: This is exactly what I would expect for matrices: M[0] is the first row of the matrix. Define what first row means! Konrad has shown that do get it right you really have to introduce three separate things (matrices,

Re: [Numpy-discussion] matrix wart

2008-02-22 Thread Travis E. Oliphant
Alan G Isaac wrote: stop believing that M[0][0] and M[0,0] should return the same thing. There is nothing in Python that requires this. I never suggested there is. My question how to guess? does not imply that. My point is: the matrix object could have more intuitive behavior

Re: [Numpy-discussion] ufunc for user-defined type

2008-02-22 Thread Travis E. Oliphant
Neal Becker wrote: Now that I have my user-defined type, I want to add some funcs. According to the numpy book, I need to use: PyUFunc_RegisterLoopForType The book says I first need a ufunc. The only way I see to create one is PyUFunc_FromFuncAndData. Is the the correct procedure?

Re: [Numpy-discussion] numpy 1:1.0.4: numpy.average() returns the wrong result with weights

2008-02-22 Thread Travis E. Oliphant
Ondrej Certik wrote: Hi, more details in this bug report. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=467095 The bug report offers a fix for this problem. It seems to me this is not fixed even in the latest svn. Is there a ticket on the NumPy trac for this? We won't see it if

Re: [Numpy-discussion] FORTRAN compiler detection

2008-02-26 Thread Travis E. Oliphant
Christopher Hanley wrote: Robert Kern wrote: On Tue, Feb 26, 2008 at 12:09 PM, Christopher Hanley [EMAIL PROTECTED] wrote: Robert Kern wrote: On Tue, Feb 26, 2008 at 11:50 AM, Christopher Hanley [EMAIL PROTECTED] wrote: Greetings, I was wondering if within the last 8

Re: [Numpy-discussion] A little help please?

2008-02-27 Thread Travis E. Oliphant
Neal Becker wrote: Travis E. Oliphant wrote: The code for this is a bit hard to understand. It does appear that it only searches for a conversion on the 2nd argument. I don't think that's desirable behavior. What I'm wondering is, this works fine for builtin types. What

Re: [Numpy-discussion] loadtxt broken if file does not end in newline

2008-02-27 Thread Travis E. Oliphant
Lisandro Dalcin wrote: Well, after all that said, I'm also fine with either approach. Anyway, I would say that my personal preference is for the one using 'str.index', as it is the simplest one regarding the old code. Like Christopher, I rarelly (never?) use 'loadtxt'. But this issue made a

Re: [Numpy-discussion] Rename record array fields (with object arrays)

2008-02-28 Thread Travis E. Oliphant
Sameer DCosta wrote: Hi, I'm having trouble renaming record array fields if they contain object arrays in them. I followed the solutions posted by Robert Kern and Stefan van der Walt (Thanks again) but it doesn't look like this method works in all cases. For reference:

Re: [Numpy-discussion] UFUNC_CHECK_STATUS cpu hog

2008-03-01 Thread Travis E. Oliphant
Thomas Grill wrote: Hi all, i did some profiling on OS X/Intel 10.5 (numpy 1.0.4) and was surprised to find calls to the system function feclearexcept to be by far the biggest cpu hog, taking away about 30% of the cpu in my case. Would it be possible to change UFUNC_CHECK_STATUS in

Re: [Numpy-discussion] A little help please?

2008-03-01 Thread Travis E. Oliphant
Travis E. Oliphant wrote: Neal Becker wrote: Travis E. Oliphant wrote: The code for this is a bit hard to understand. It does appear that it only searches for a conversion on the 2nd argument. I don't think that's desirable behavior. What I'm wondering is, this works fine

Re: [Numpy-discussion] fromfile (binary) double free or corruption

2008-03-02 Thread Travis E. Oliphant
Scott Ransom wrote: Hi Travis, That fixes the problem that I reported such that there is no glibc issue anymore. However, it does result in a change in behaviour for fromfile. Previously, when no data was returned an exception was raised. With the new fix there is no exception, and an

Re: [Numpy-discussion] preparing to tag NumPy 1.0.5 on Wednesday

2008-03-03 Thread Travis E. Oliphant
Alan G Isaac wrote: I never got a response to this: URL:http://projects.scipy.org/pipermail/scipy-dev/2008-February/008424.html (Two different types claim to be numpy.int32.) It's not a bug :-) There are two c-level types that are both 32-bit (on 32-bit systems). -Travis

Re: [Numpy-discussion] preparing to tag NumPy 1.0.5 on Wednesday

2008-03-03 Thread Travis E. Oliphant
Charles R Harris wrote: On Mon, Mar 3, 2008 at 10:21 AM, Jarrod Millman [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hello, I would like to tag the 1.0.5 release on Wednesday night and announce the release by Monday (3/10). If you have anything that you would like

Re: [Numpy-discussion] bug report ?

2008-03-05 Thread Travis E. Oliphant
Revaz Yves wrote: Matthieu Brucher wrote: Hi, What type is pos-dimensions in your case ? It may be long (64bits long) instead of the expected int (32bits) or something like that ? yes, pos-dimensions is a 64bits long while PyArray_FromDims expects 32bits int. Why is it so ?

Re: [Numpy-discussion] behavior of masked arrays

2008-03-07 Thread Travis E. Oliphant
Giorgio F. Gilestro wrote: Hi Everybody, I have some arrays that sometimes need to have some of their values masked away or, simply said, not considered during manipulation. I tried to fulfill my purposes using both NaNs and MaskedArray but neither of them really helped completely. Let's

Re: [Numpy-discussion] fromiter + dtype='S' - Python crash

2008-03-14 Thread Travis E. Oliphant
Zbyszek Szmek wrote: On Thu, Mar 13, 2008 at 05:44:54PM -0400, Alan G Isaac wrote: Looks like I misunderstood your question: you want an **array** of strings? In principle you should be able to use ``fromiter``, I believe, but it does not work. BUG? (Crasher.) import numpy as N

Re: [Numpy-discussion] Can't add user defined complex types

2008-03-19 Thread Travis E. Oliphant
Neal Becker wrote: In arrayobject.c, various complex functions (e.g., array_imag_get) use: PyArray_ISCOMPLEX - PyTypeNum_ISCOMPLEX, which is hard coded to 2 predefined types :( If PyArray_ISCOMPLEX allowed user-defined types, I'm guessing functions such as array_imag_get would just work?

  1   2   3   >