Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread Paul Anton Letnes
On 4. juli 2012, at 02:23, Sturla Molden wrote: > Den 03.07.2012 20:38, skrev Casey W. Stark: >> >> Sturla, this is valid Fortran, but I agree it might just be a bad >> idea. The Fortran 90/95 Explained book mentions this in the >> allocatable dummy arguments section and has an example using a

Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread Sturla Molden
Den 04.07.2012 01:59, skrev Sturla Molden: > But neither was the case here. The allocatable was a dummy variable in > a subroutine's interface, declared with intent(out). That is an error > the compiler should trap, because it is doomed to segfault. Ok, so the answer here seems to be: In Fortra

Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread Sturla Molden
Den 03.07.2012 20:38, skrev Casey W. Stark: > > Sturla, this is valid Fortran, but I agree it might just be a bad > idea. The Fortran 90/95 Explained book mentions this in the > allocatable dummy arguments section and has an example using an array > with allocatable, intent(out) in a subrountine

Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread Sturla Molden
Den 03.07.2012 19:24, skrev Pearu Peterson: > > One can have allocatable arrays in module data block, for instance, where > they a global In Fortran 2003 one can also have allocatable arrays as members in derived types. But neither was the case here. The allocatable was a dummy variable in a su

Re: [Numpy-discussion] "import numpy" performance

2012-07-03 Thread Paul Ivanov
On Mon, Jul 2, 2012 at 2:59 PM, Nathaniel Smith wrote: > On Mon, Jul 2, 2012 at 10:06 PM, Robert Kern wrote: >> On Mon, Jul 2, 2012 at 9:43 PM, Benjamin Root wrote: >>> >>> On Mon, Jul 2, 2012 at 4:34 PM, Nathaniel Smith wrote: >> I think this ship has sailed, but it'd be worth looking int

Re: [Numpy-discussion] Buildbot status

2012-07-03 Thread Stéfan van der Walt
On Mon, Jul 2, 2012 at 6:31 PM, Travis Oliphant wrote: > Ondrej should have time to work on this full time in the coming days. That's great; having Ondrej on this full time will help a great deal. > NumFocus can provide some funding needed for maintaining servers, etc, but > keeping build bots

Re: [Numpy-discussion] Would a patch with a function for incrementing an array with advanced indexing be accepted?

2012-07-03 Thread Frédéric Bastien
Hi, Here is code example that work only with different index: import numpy x=numpy.zeros((5,5)) x[[0,2,4]]+=numpy.random.rand(3,5) print x This won't work if in the list [0,2,4], there is index duplication, but with your new code, it will. I think it is the most used case of advanced indexing. A

Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread Casey W. Stark
Hi all. Thanks for the speedy responses! I'll try to respond to all... The first idea is to split up the routine into two -- one to compute the final size of the arrays, and the second to fill them in. I might end up doing this, because it is simplest, but it means creating the initial conditions

Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread Pearu Peterson
On Tue, Jul 3, 2012 at 5:20 PM, Sturla Molden wrote: > > As for f2py: Allocatable arrays are local variables for internal use, > and they are not a part of the subroutine's calling interface. f2py only > needs to know about the interface, not the local variables. > One can have allocatable array

Re: [Numpy-discussion] "import numpy" performance

2012-07-03 Thread Chris Barker
On Mon, Jul 2, 2012 at 12:17 PM, Andrew Dalke wrote: > In this email I propose a few changes which I think are minor > and which don't really affect the external NumPy API but which > I think could improve the "import numpy" performance by at > least 40%. +1 -- I think I remember that thread -- a

Re: [Numpy-discussion] Change in memmap behaviour

2012-07-03 Thread Nathaniel Smith
On Tue, Jul 3, 2012 at 10:35 AM, Thouis (Ray) Jones wrote: > On Mon, Jul 2, 2012 at 11:52 PM, Sveinung Gundersen > wrote: >> >> On 2. juli 2012, at 22.40, Nathaniel Smith wrote: >> >>> On Mon, Jul 2, 2012 at 6:54 PM, Sveinung Gundersen >>> wrote: [snip] Your actual mem

Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread Sturla Molden
Den 03.07.2012 11:54, skrev George Nurser: >> module zp >>implicit none >>contains >>subroutine ics(..., num_particles, particle_mass, positions, velocities) >> use data_types, only : dp >> implicit none >> ... inputs ... >> integer, intent(out) :: num_particles >>

Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread Jim Vickroy
On 7/2/2012 7:17 PM, Casey W. Stark wrote: Hi numpy. Does anyone know if f2py supports allocatable arrays, allocated inside fortran subroutines? The old f2py docs seem to indicate that the allocatable array must be created with numpy, and dropped in the module. Here's more background to expla

Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread Andreas Hilboll
> Hi numpy. > > Does anyone know if f2py supports allocatable arrays, allocated inside > fortran subroutines? The old f2py docs seem to indicate that the > allocatable array must be created with numpy, and dropped in the module. > Here's more background to explain... > > I have a fortran subroutine

Re: [Numpy-discussion] f2py with allocatable arrays

2012-07-03 Thread George Nurser
Can you interface your fortran program twice? First time return the number of particles, dimensions etc to python python then creates work array of right size Second interface pass work array as in/out array, dimension in fortran argument list, to fortran fortran copies allocatable arrays to arg

Re: [Numpy-discussion] Change in memmap behaviour

2012-07-03 Thread Thouis (Ray) Jones
On Mon, Jul 2, 2012 at 11:52 PM, Sveinung Gundersen wrote: > > On 2. juli 2012, at 22.40, Nathaniel Smith wrote: > >> On Mon, Jul 2, 2012 at 6:54 PM, Sveinung Gundersen >> wrote: >>> [snip] >>> >>> >>> >>> Your actual memory usage may not have increased as much as you think, >>> since memmap obj