[f2py] Create working memory on the fly

Pearu Peterson pearu.peterson at gmail.com
Tue Aug 12 10:46:32 EEST 2008



Uwe Schmitt wrote:
> 
> Am 12.08.2008 um 07:53 schrieb Pearu Peterson:
> 
>>
>>
>> Uwe Schmitt wrote:
>>> Hi,
>>>
>>> when wrapping Fortran code one often has to allocate
>>> some working memory which is passed to the fortran
>>> routine and free'd when returning from it.
>>>
>>> Is there a way to handle this task via .pyf files ?
>>> I think of something like
>>>
>>>        integer optional,check(shape(a,0)==m),depend(a) ::  m=shape(a,0)
>>>        double precision dimension(n) :: w = zeros(n)
>>
>> Try:
>>  double precision dimension(n), intent(cache, hide) :: w
>>
>> If you you need w filled with zeros, then
>>  double precision dimension(n), optional :: w = 0.0
> 
> Thanks, that's cool. I looked at the docs but
> did not see it.

It may be hard to find, but its there:

http://cens.ioc.ee/projects/f2py2e/usersguide/index.html#c-expressions

Pearu



More information about the f2py-users mailing list