On Fri, May 6, 2011 at 5:55 PM, DJ Luscher <d...@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. > > example: > <foo_size.f90> > > 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: > <m-f2pywrappers.f> > 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)) > interface > 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) > end > > 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. >
This issue is now fixed in https://github.com/numpy/numpy/commit/a859492c I 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 corresponding release notes in https://github.com/numpy/numpy/commit/1f2e751b Thanks for testing these new f2py features, Pearu
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion