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

DJ Luscher djl at lanl.gov
Fri May 6 10:55:21 EDT 2011

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. 


        subroutine trans(x,y)
          implicit none
          real, intent(in), dimension(:,:) :: x
          real, intent(out), dimension( size(x,2), size(x,1) ) :: y
          integer :: N, M, i, j
          N = size(x,1)
          M = size(x,2)
          DO i=1,N
            do j=1,M
              y(j,i) = x(i,j)
            END DO
          END DO
        end subroutine trans

For this example the autogenerated fortran wrapper is:
      subroutine f2pywraptrans (x, y, f2py_x_d0, f2py_x_d1)
      integer f2py_x_d0
      integer f2py_x_d1
      real x(f2py_x_d0,f2py_x_d1)
      real y(shape(x,-1+2),shape(x,-1+1))
      subroutine trans(x,y) 
          real, intent(in),dimension(:,:) :: x
          real, intent(out),dimension( size(x,2), size(x,1) ) :: y
      end subroutine trans
      end interface
      call trans(x, y)

which (inappropriately?) translates the fortran SIZE(var,dim) into fortran
SHAPE(var, kind).  Please let me know if it is poor form for me to follow on
with this secondary issue, but it seems like it is related and a
straight-forward fix.  

Thanks again for your previous fix.


More information about the NumPy-Discussion mailing list