[SciPy-user] [f2py] bool array...

Robert Kern robert.kern@gmail....
Thu Aug 23 16:40:23 CDT 2007


fred wrote:
> Hi,
> 
> I want to return a boolean array from my fortran code,
> but I get a int32 ?
> 
> What am I doing wrong ?
> 
> Any clue ?

Fortran LOGICAL arrays are usually stored as integers, usually of the same width
as Fortran INTEGER. numpy bool arrays are stored as bytes. The correct mapping
between Fortran LOGICALs and numpy arrays is a numpy int array of some width.

> I could still convert it to bool, of course...

Yup.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the SciPy-user mailing list