[Numpy-discussion] patch numarray.fromfuntion with optional type argument

Sebastian Haase haase at msg.ucsf.edu
Tue Jul 5 16:06:27 CDT 2005


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:
> 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 at 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
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion




More information about the Numpy-discussion mailing list