patch numarray.fromfuntion with optional type argument
![](https://secure.gravatar.com/avatar/6194b135cba546afa82516de1537de49.jpg?s=120&d=mm&r=g)
Hi, Please tell if this patch is a good idea. (Use: For large image data we always use Float32 and I thought it would be extra overhead if I first create everything in Float64 and then have to convert to Float32 afterwards, myself) haase@gorilla:~: diff -p ~/myCVS/numarray/Lib/generic.py ~/myCVS/numarray/Lib/generic.py.~1.74.~ *** /home/haase/myCVS/numarray/Lib/generic.py Thu Jun 16 11:04:10 2005 --- /home/haase/myCVS/numarray/Lib/generic.py.~1.74.~ Fri Apr 22 13:35:26 2005 *************** def indices(shape, type=None): *** 1167,1179 **** a = a.astype(type) return a ! def fromfunction(function, dimensions, type=None): # from Numeric """fromfunction() returns an array constructed by calling function on a tuple of number grids. The function should accept as many arguments as there are dimensions which is a list of numbers indicating the length of the desired output for each axis. """ ! return apply(function, tuple(indices(dimensions,type))) def _broadcast_or_resize(a, b): try: --- 1167,1179 ---- a = a.astype(type) return a ! def fromfunction(function, dimensions): # from Numeric """fromfunction() returns an array constructed by calling function on a tuple of number grids. The function should accept as many arguments as there are dimensions which is a list of numbers indicating the length of the desired output for each axis. """ ! return apply(function, tuple(indices(dimensions))) def _broadcast_or_resize(a, b): try: Thanks, - Sebastian Haase
![](https://secure.gravatar.com/avatar/6194b135cba546afa82516de1537de49.jpg?s=120&d=mm&r=g)
Hi, (this is regarding my post from 16 June 2005) Todd, maybe you can confirm that this patch is a good idea and that you will put it into upcoming numarray versions !? I would like to streamline my code - but only of course if you OK this. Sebastian On Thursday 16 June 2005 11:12, Sebastian Haase wrote:
![](https://secure.gravatar.com/avatar/6194b135cba546afa82516de1537de49.jpg?s=120&d=mm&r=g)
Hi, (this is regarding my post from 16 June 2005) Todd, maybe you can confirm that this patch is a good idea and that you will put it into upcoming numarray versions !? I would like to streamline my code - but only of course if you OK this. Sebastian On Thursday 16 June 2005 11:12, Sebastian Haase wrote:
participants (2)
-
Sebastian Haase
-
Todd Miller