summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2007-10-18 15:18:57 +0000
committerTravis Oliphant <oliphant@enthought.com>2007-10-18 15:18:57 +0000
commit8f7a0f517adc8bd49bbfbf024ae0992269801785 (patch)
treeee0f82690f1b2b47c429f2a9f9a7c6a34f88a836 /numpy/lib/function_base.py
parentbee10707e0d6537981458f4d75eb9a198a7728bc (diff)
downloadnumpy-8f7a0f517adc8bd49bbfbf024ae0992269801785.tar.gz
Fix vectorize to work with strings. Fix where 64-bit looks for X11 libraries. Fix comment.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 3dcac3d7e..3d04a0258 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -914,6 +914,7 @@ class vectorize(object):
raise ValueError, "mismatch between python function inputs"\
" and received arguments"
+ # we need a new ufunc if this is being called with more arguments.
if (self.lastcallargs != nargs):
self.lastcallargs = nargs
self.ufunc = None
@@ -935,14 +936,17 @@ class vectorize(object):
otypes.append(asarray(theout[k]).dtype.char)
self.otypes = ''.join(otypes)
+ # Create ufunc if not already created
if (self.ufunc is None):
self.ufunc = frompyfunc(self.thefunc, nargs, self.nout)
+ # Convert to object arrays first
+ newargs = [asarray(arg,dtype=object) for arg in args]
if self.nout == 1:
- _res = array(self.ufunc(*args),copy=False).astype(self.otypes[0])
+ _res = array(self.ufunc(*newargs),copy=False).astype(self.otypes[0])
else:
_res = tuple([array(x,copy=False).astype(c) \
- for x, c in zip(self.ufunc(*args), self.otypes)])
+ for x, c in zip(self.ufunc(*newargs), self.otypes)])
return _res
def cov(m, y=None, rowvar=1, bias=0):