[Numpy-discussion] ANN: Numpy 1.6.0 release candidate 2

DJ Luscher djl at lanl.gov
Fri May 6 15:18:16 EDT 2011

Pearu Peterson <pearu.peterson <at> gmail.com> writes:
> On Fri, May 6, 2011 at 5:55 PM, DJ Luscher <djl <at> lanl.gov> wrote:
> Pearu Peterson <pearu.peterson <at> gmail.com> writes:
> >
> >
> > Thanks for the bug report!These issues are now fixed
in: https://github.com/numpy/numpy/commit/f393b604  Ralf, feel free to apply this
> changeset to 1.6.x branch if appropriate.Regards,Pearu
> >
> Excellent! Thank you.
> I'll cautiously add another concern because I believe it is related.  Using
> f2py to compile subroutines where dimensions for result variable are derived
> from two argument usage of size of an assumed shape input variable does not
> compile for me.
> This issue is now fixed in  https://github.com/numpy/numpy/commit/a859492cI
had to implement size function in C that can be called both as size(var) and
size(var, dim).
> The size-to-shape mapping feature is now removed. I have updated the
correspondingrelease notes
inhttps://github.com/numpy/numpy/commit/1f2e751bThanks for testing these new
f2py features,Pearu

I greatly appreciate how promptly you provide support for f2py.  Thank you. 

I have encountered another minor hangup.  For assumed-shape array-valued
functions defined within a fortran module there seems to be some trouble in the
autogenerated subroutine wrapper interface.  I think it has to do with the order
in which variables are declared in the interface specification.

for example:
      ! -*- fix -*-
      module foo
      function outer(a,b)
        implicit none
        real, dimension(:), intent(in)   :: a, b
        real, dimension(size(a),size(b)) :: outer
        outer = spread(a,dim=2,ncopies=size(b) ) *
     &          spread(b,dim=1,ncopies=size(a) )   
      end function outer
      end module 

when compiled by f2py creates the file:
!     -*- f90 -*-
!     This file is autogenerated with f2py (version:2)
!     It contains Fortran 90 wrappers to fortran functions.

      subroutine f2pywrap_foo_outer (outerf2pywrap, a, b, f2py_a_d0, f2p&
      use foo, only : outer
      integer f2py_a_d0
      integer f2py_b_d0
      real a(f2py_a_d0)
      real b(f2py_b_d0)
      real outerf2pywrap(size(a),size(b))
      outerf2pywrap = outer(a, b)
      end subroutine f2pywrap_foo_outer
      subroutine f2pyinitfoo(f2pysetupfunc)
      subroutine f2pywrap_foo_outer (outerf2pywrap, outer, a, b, f2py_a_&
     &d0, f2py_b_d0)
      integer f2py_a_d0
      integer f2py_b_d0
      real outer(size(a),size(b))
      real a(f2py_a_d0)
      real b(f2py_b_d0)
      real outerf2pywrap(size(a),size(b))
      end subroutine f2pywrap_foo_outer
      end interface
      external f2pysetupfunc
      call f2pysetupfunc(f2pywrap_foo_outer)
      end subroutine f2pyinitfoo

in the subroutine interface specification the size(a) and size(b) are used to
dimension outer above (before) the declaration of a and b themselves.  This
halts my compiler.  The wrapper seems to compile OK if a and b are declared
above outer in the interface.
thanks again for your help,

More information about the NumPy-Discussion mailing list