[SciPy-dev] f2py + f90 file

dmitrey dmitrey.kroshko at scipy.org
Tue Feb 26 04:38:51 EST 2008


Pearu, I have spent several days trying to connect bvls.f and/or 
bvls.f90 routines (linear least squares, box-bounded), but it still 
doesn't yield correct results: they are different according to input 
precision (float32, float64, float128) and noone yields correct solution 
- neither for finite nor for infinite bounds.

Could you take a look at the files?
http://www.box.net/shared/1gaauhrcoo

This problem is the one of big importance (and very urgent), because
1) lots of users are interested in constrained LLS problems (AFAIK there 
are no Python-connected solvers for the ones, at least, free solvers)
2) it could essentially enhance scikits.openopt lincher and ralg solvers.

The attached script yields:

using bvls.f
Type: float32 ; xf= [ 0.  0.] ; type(xf[0])= <type 'numpy.float32'>
Type: float64 ; xf= [  1. -Inf] ; type(xf[0])= <type 'numpy.float64'>
Type: float128 ; xf= [0.0 0.0] ; type(xf[0])= <type 'numpy.float128'>

using bvls.f90
Type: float32 ; xf= [ 0. -0.] ; type(xf[0])= <type 'numpy.float32'>
Type: float64 ; xf= [ 0. -0.] ; type(xf[0])= <type 'numpy.float32'>
Type: float128 ; xf= [ 0. -0.] ; type(xf[0])= <type 'numpy.float32'>

(while xf should be [15,15])

Thank you in advance,
D.

Pearu Peterson wrote:
> On Thu, February 21, 2008 8:36 pm, dmitrey wrote:
>   
>> hi all,
>> I have an .f90 file with a routine that I intend to connect to Python
>> via f2py
>>
>> (the file is http://users.bigpond.net.au/amiller/bvls.f90 )
>>
>> I have gfortran and f95 installed (KUBUNTU 7.10), *no f90* (f90 is
>> absent in KUBUNTU software update channel as well).
>>
>> Both they work with the file correctly, so I can get both a.out and
>> bvlc.o (however I don't know how to get *.so files)
>>
>> So f2py -c -m bvls bvls.f90 yields:
>> ...
>> Fortran f77 compiler: /usr/bin/g77 -g -Wall -fno-second-underscore -fPIC
>> -O3 -funroll-loops -march=athlon64 -mmmx -m3dnow -msse2 -msse
>> compile options: '-I/tmp/tmpK2eM1Z/src.linux-x86_64-2.5
>> -I/usr/lib/python2.5/site-packages/numpy/core/include
>> -I/usr/include/python2.5 -c'
>> error: f90 not supported by GnuFCompiler needed for bvls.f90
>>
>> if I rename the file extension to f95 I have the same problem:
>> error: f90 not supported by GnuFCompiler needed for bvls.f95
>>
>> Any suggestions?
>>     
>
> You need to specify F90 complier explicitly (default compiler
> for f2py is g77):
>
>   f2py -c -m bvls bvls.f90 --fcompiler=gnu95
>
> HTH,
> Pearu
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
>
>
>   




More information about the SciPy-Dev mailing list