[SciPy-dev] pynotes

Arnd Baecker arnd.baecker at web.de
Fri Nov 19 05:05:21 CST 2004


On Fri, 19 Nov 2004, Pearu Peterson wrote:

> On Fri, 19 Nov 2004, Arnd Baecker wrote:
>
> > Is there a better way to get the type of routines
> > in flapack (and clapack)?
> > ((Note that the types of the routines in lapack and clapack which
> > seem to be different:
> > In [6]: type(scipy.linalg.flapack.zgesv)==type(scipy.linalg.clapack.zgetri)
> > Out[6]: False
>
> That's interesting:
>
> In [10]: type(scipy.linalg.flapack.zgesv),
> type(scipy.linalg.clapack.zgetri)
> Out[10]: (<type 'fortran'>, <type 'fortran'>)
>
> In [11]: type(scipy.linalg.flapack.zgesv) is
> type(scipy.linalg.flapack.zgetri)
> Out[11]: True
>
> The reason why flapack and clapack (or of any other f2py generated
> extension module) fortran types are different is that each f2py
> extension module implements its own fortran type. So, to check for a
> fortran type, you should probably use:
>
> def isfortrantype(obj):
>    return repr(type(obj))=="<type 'fortran'>"

Many thanks Pearu - this of course much better, more robust
and shorter than the stuff I used before.
This allowed to shorten the whole checks substantially
(updated version on the web).

Many thanks,

Arnd




More information about the Scipy-dev mailing list