Re: [Numpy-discussion] fromfunction() bug?

2008-03-13 Thread orionbelt2

On Thu, Mar 13, 2008 at 06:18:30PM -0400, Alan G Isaac wrote:

> This is how I would hope ``fromfunction`` would work
> and it matches the docs. (See below.)  You can fix
> the example ...

Interesting, i thought the output in the Example List page is 
auto-generated...
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] fromfunction() bug?

2008-03-13 Thread Alan G Isaac
This is how I would hope ``fromfunction`` would work
and it matches the docs. (See below.)  You can fix
the example ...

Cheers,
Alan Isaac


>>> help(N.fromfunction)
Help on function fromfunction in module numpy.core.numeric:

fromfunction(function, shape, **kwargs)
Returns an array constructed by calling a function on a tuple of number
grids.

The function should accept as many arguments as the length of shape and
work on array inputs.  The shape argument is a sequence of numbers
indicating the length of the desired output for each axis.

The function can also accept keyword arguments (except dtype), which will
be passed through fromfunction to the function itself.  The dtype argument
(default float) determines the data-type of the index grid passed to the
function.



___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] fromfunction() bug?

2008-03-13 Thread OrionBelt
Hi,

According to the fromfunction() example:

http://www.scipy.org/Numpy_Example_List_With_Doc#head-597e63df5a6d490abd474ffd84d0419468c8329a

fromfunction() should return an array of integers. But when i run the
example, i obtain an array of floats:

>>> from numpy import *
>>> def f(i,j):
... return i**2 + j**2
...
>>> fromfunction(f, (3,3))
array([[ 0.,  1.,  4.],
   [ 1.,  2.,  5.],
   [ 4.,  5.,  8.]])

I am on version 1.0.4, same as the examples.

Is this a bug?
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion