def fromfunction(function, shape, **kwargs):
    dtype = kwargs.pop('dtype', float)
args = indices(shape, dtype=dtype)
return function(*args, **kwargs)
Populating a numpy matrix using fromfunction and an array