diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-09-28 09:56:41 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-09-28 09:56:41 +0000 |
commit | 7906451af30f3c29250937863b22199cf9f42dfd (patch) | |
tree | 53463f5e33fb7b7c87b7f6b892c4c280fe36d181 /numpy/numarray/functions.py | |
parent | 483ce064ed954b8b9235f69f06bbbcff35d5fe4d (diff) | |
download | numpy-7906451af30f3c29250937863b22199cf9f42dfd.tar.gz |
Fix the fromfunction routine to use float as default. Update oldnumeric and numarray compatibility modules.
Diffstat (limited to 'numpy/numarray/functions.py')
-rw-r--r-- | numpy/numarray/functions.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/numpy/numarray/functions.py b/numpy/numarray/functions.py index 3a2939d1e..2a6e5317b 100644 --- a/numpy/numarray/functions.py +++ b/numpy/numarray/functions.py @@ -43,7 +43,7 @@ import os, sys, math, operator from numpy import dot as matrixmultiply, dot, vdot, ravel, concatenate, all,\ allclose, any, around, argsort, array_equal, array_equiv,\ array_str, array_repr, CLIP, RAISE, WRAP, clip, concatenate, \ - diagonal, e, pi, fromfunction, indices, inner as innerproduct, nonzero, \ + diagonal, e, pi, indices, inner as innerproduct, nonzero, \ outer as outerproduct, kron as kroneckerproduct, lexsort, putmask, rank, \ resize, searchsorted, shape, size, sort, swapaxes, trace, transpose import numpy as N @@ -67,9 +67,12 @@ def type2dtype(typecode, type, dtype, use_default=True): else: dtype = N.dtype(type) if use_default and dtype is None: - dtype = N.dtype(None) + dtype = N.dtype('int') return dtype - + +def fromfunction(shape, dimensions, type=None, typecode=None, dtype=None): + dtype = type2dtype(typecode, type, dtype, 1) + return N.fromfunction(shape, dimensions, dtype=dtype) def ones(shape, type=None, typecode=None, dtype=None): dtype = type2dtype(typecode, type, dtype, 1) return N.ones(shape, dtype) |