summaryrefslogtreecommitdiff
path: root/numpy
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
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')
-rw-r--r--numpy/core/include/numpy/ndarrayobject.h2
-rw-r--r--numpy/distutils/system_info.py13
-rw-r--r--numpy/lib/function_base.py8
3 files changed, 19 insertions, 4 deletions
diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h
index a37b5edf9..62986a9eb 100644
--- a/numpy/core/include/numpy/ndarrayobject.h
+++ b/numpy/core/include/numpy/ndarrayobject.h
@@ -1282,7 +1282,7 @@ typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);
and WRITEABLE. */
#define NPY_ENSURECOPY 0x0020
-/* Make sure the returned array is an ndarray or a bigndarray */
+/* Make sure the returned array is a base-class ndarray */
#define NPY_ENSUREARRAY 0x0040
/* Make sure that the strides are in units of the element size
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index 7a1373442..c68308690 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -143,7 +143,18 @@ else:
'/opt/include', '/usr/include',
'/opt/local/include', '/sw/include']
default_src_dirs = ['.','/usr/local/src', '/opt/src','/sw/src']
- default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib']
+
+ try:
+ platform = os.uname()
+ bit64 = platform[-1].endswith('64')
+ except:
+ bit64 = False
+
+ if bit64:
+ default_x11_lib_dirs = ['/usr/lib64']
+ else:
+ default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib']
+
default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include',
'/usr/include']
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):