<br><br><div class="gmail_quote">On Thu, May 5, 2011 at 11:51 PM, DJ Luscher <span dir="ltr"><<a href="mailto:djl@lanl.gov">djl@lanl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><br>
Ralf Gommers <ralf.gommers <at> <a href="http://googlemail.com" target="_blank">googlemail.com</a>> writes:<br>
<br>
><br>
> Hi,<br>
><br>
> I am pleased to announce the availability of the second release<br>
> candidate of NumPy 1.6.0.<br>
><br>
> Compared to the first release candidate, one segfault on (32-bit<br>
> Windows + MSVC) and several memory leaks were fixed. If no new<br>
> problems are reported, the final release will be in one week.<br>
><br>
> Sources and binaries can be found at<br>
> <a href="http://sourceforge.net/projects/numpy/files/NumPy/1.6.0rc2/" target="_blank">http://sourceforge.net/projects/numpy/files/NumPy/1.6.0rc2/</a><br>
> For (preliminary) release notes see below.<br>
><br>
> Enjoy,<br>
> Ralf<br>
><br>
> =========================<br>
> NumPy 1.6.0 Release Notes<br>
> =========================<br>
><br>
</div><div class="im">> Fortran assumed shape array and size function support in ``numpy.f2py``<br>
> -----------------------------------------------------------------------<br>
><br>
> F2py now supports wrapping Fortran 90 routines that use assumed shape<br>
> arrays.  Before such routines could be called from Python but the<br>
> corresponding Fortran routines received assumed shape arrays as zero<br>
> length arrays which caused unpredicted results. Thanks to Lorenz<br>
> Hüdepohl for pointing out the correct way to interface routines with<br>
> assumed shape arrays.<br>
><br>
> In addition, f2py interprets Fortran expression ``size(array, dim)``<br>
> as ``shape(array, dim-1)`` which makes it possible to automatically<br>
> wrap Fortran routines that use two argument ``size`` function in<br>
> dimension specifications. Before users were forced to apply this<br>
> mapping manually.<br>
><br>
<br>
<br>
</div>Regarding the f2py support for assumed shape arrays:<br>
<br>
I'm just struggling along trying to learn how to use f2py to interface with<br>
fortran source, so please be patient if I am missing something obvious.  That<br>
said, in test cases I've run the new f2py assumed-shape-array support in Numpy<br>
1.6.0.rc2 seems to conflict with the support for f90-style modules.  For example:<br>
<br>
<foo_mod.f90><br>
<br>
       ! -*- fix -*-<br>
<br>
       module easy<br>
<br>
       real, parameter :: anx(4) = (/1.,2.,3.,4./)<br>
<br>
       contains<br>
<br>
       subroutine sum(x, res)<br>
         implicit none<br>
         real, intent(in) :: x(:)<br>
         real, intent(out) :: res<br>
<br>
         integer :: i<br>
<br>
         !print *, "sum: size(x) = ", size(x)<br>
<br>
         res = 0.0<br>
<br>
         do i = 1, size(x)<br>
           res = res + x(i)<br>
         enddo<br>
<br>
       end subroutine sum<br>
<br>
       end module easy<br>
<br>
<br>
when compiled with:<br>
f2py -c --fcompiler=intelem foo_mod.f90  -m e<br>
<br>
then:<br>
<br>
python<br>
import e<br>
print e.easy.sum(e.easy.anx)<br>
<br>
returns: 0.0<br>
<br>
Also (and I believe related) f2py can no longer compile source with assumed<br>
shape array valued functions within a module.  Even though the python wrapped<br>
code did not function properly when called from python, it did work when called<br>
from other fortran code.  It seems that the interface has been broken.  The<br>
previous version of Numpy I was using was 1.3.0 all on Ubuntu 10.04, Python 2.6,<br>
and using Intel fortran compiler.<br>
<br>
thanks for your consideration and feedback.<br>
<font color="#888888"><br></font></blockquote><div><br>Thanks for the bug report!<br><br>These issues are now fixed in:<br><br>  <a href="https://github.com/numpy/numpy/commit/f393b604">https://github.com/numpy/numpy/commit/f393b604</a>  <br>
<br>Ralf, feel free to apply this changeset to 1.6.x branch if appropriate.<br><br>Regards,<br>Pearu<br></div></div>