From: Todd M. <jm...@st...> - 2003-03-08 11:55:43
|
Sebastian Haase wrote: >Hi, >I am just looking into numarray.fromfuntion. >I have e.g. this: > >def func(x,y,z): > return 1.2*(x+y+z) > >a = na.fromfunction(func, (nz,ny,nx)) >b = a.astype(na.Float32) > >Is there a way to tell fromfunction to _directly_ generate a Float32 typed >array. > I don't think so. Numeric does not have this capability either, although it appears easy enough to add it. >As I see it only "standard" Python type are possible now. >Or: Is there a scalar conversion function like numarray.Float32( 3.141 ) ? > You can create rank-0 numarrays which are essentially typed scalars; these are not, however, widely used. >>> import numarray >>> a = numarray.array(3.141, type=numarray.Float32) > >Thanks, >Sebastian Haase > > > > >------------------------------------------------------- >This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger >for complex code. Debugging C/C++ programs can leave you feeling lost and >disoriented. TotalView can help you find your way. Available on major UNIX >and Linux platforms. Try it free. www.etnus.com >_______________________________________________ >Numpy-discussion mailing list >Num...@li... >https://lists.sourceforge.net/lists/listinfo/numpy-discussion > > |