[f2py] scipy 0.4.8 and f2py, continued
fabien.wahl at snecma.fr
fabien.wahl at snecma.fr
Mon Apr 24 18:23:38 EEST 2006
Bonjour,
made some research here...
running on win2k, python 2.3.5, f2py as in scipy 0.4.8
Conclusion : f2py fails to run with numpy 0.9.6, fails to run with Numeric
24.2, runs fine with 23.8. See below for details.
I use the following fortran file (a f2py classic)
C FILE: STRING.F
SUBROUTINE FOO(A,B,C,D)
CHARACTER*5 A, B
CHARACTER*(*) C,D
Cf2py intent(in) a,c
Cf2py intent(inout) b,d
PRINT*, "A=",A
PRINT*, "B=",B
PRINT*, "C=",C
PRINT*, "D=",D
PRINT*, "CHANGE A,B,C,D"
A(1:1) = "A"
B(1:1) = "B"
C(1:1) = "C"
D(1:1) = "D"
PRINT*, "A=",A
PRINT*, "B=",B
PRINT*, "C=",C
PRINT*, "D=",D
END
SUBROUTINE FOO2(A)
CHARACTER, dimension(2) ::A*5
Cf2py intent(in) a
PRINT*, "A(1)=",A(1)
PRINT*, "A(2)=",A(2)
END
C END OF FILE STRING.F
the following f2py command
f2py.py -c --fcompiler=compaqv -m mystring_new string.f
results are
* numpy 0.9.6 only : failed
>>> from numpy import array
>>> import mystring_new
>>> mystring_new.foo('abcde','vwxyz','c','d')
A=abcde
B=vwxyz
C=c
D=d
CHANGE A,B,C,D
A=Abcde
B=Bwxyz
C=C
D=D
>>> mystring_new.foo2(array(('abcde','vwxyz')))
1-th dimension must be 5 but got 0 (not defined).
Traceback (most recent call last):
File "<stdin>", line 1, in ?
mystring_new.error: failed in converting 1st argument `a' of
mystring_new.foo2 to C/Fortran array
>>> array(('abcde','vwxyz'))
array([abcde, vwxyz],
dtype='|S5')
* Numeric 24.2 : failed
>>> from Numeric import array
>>> import mystring_new
>>> mystring_new.foo('abcde','vwxyz','c','d')
A=abcde
B=vwxyz
C=c
D=d
CHANGE A,B,C,D
A=Abcde
B=Bwxyz
C=C
D=D
>>> mystring_new.foo2(array(('abcde','vwxyz')))
A(1)=êð¡ É
A(2)=?t Ó?
* Numeric 23.8 : success
>>> from Numeric import array
>>> import mystring_new
>>> mystring_new.foo('abcde','vwxyz','c','d')
A=abcde
B=vwxyz
C=c
D=d
CHANGE A,B,C,D
A=Abcde
B=Bwxyz
C=C
D=D
>>> mystring_new.foo2(array(('abcde','vwxyz')))
A(1)=abcde
A(2)=vwxyz
--------------------
Fabien WAHL
Ingénieur Etudes Nouvelles
Unité de conception de Turbomachines
SNECMA, Division Moteur Spatiaux
Direction Grosse Propulsion à Liquides
Forêt de Vernon BP 802
27208 VERNON
FRANCE
Tel +33 (0)2 32 21 72 77
Fax +33 (0)2 32 21 76 30
mailto:fabien.wahl at snecma.fr
#
This e-mail and any attached documents may contain confidential or proprietary information. If you are not the intended recipient, please advise the sender immediately and delete this e-mail and all attached documents from your computer system. Any unauthorised disclosure, distribution or copying hereof is prohibited.
Ce courriel et les documents qui y sont attaches peuvent contenir des informations confidentielles. Au cas ou vous ne seriez pas le destinataire de ce courriel, vous etes prie d'en informer l'expediteur immediatement et de le detruire ainsi que tous les documents attaches de votre systeme informatique. Toute divulgation, distribution ou copie du present courriel et des documents attaches sans autorisation prealable de son emetteur est interdite.
#
More information about the f2py-users
mailing list