summaryrefslogtreecommitdiff
path: root/numpy/polynomial/polyutils.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2010-08-11 01:18:21 +0000
committerCharles Harris <charlesr.harris@gmail.com>2010-08-11 01:18:21 +0000
commit1994e4ae0f9e98c419793c7d3e6a079aa0c23010 (patch)
tree9c273e37488906d389b0ac496beb98378dbaf336 /numpy/polynomial/polyutils.py
parent01362e33c84a2fb03d8b6ff66de866c2d1f9da95 (diff)
downloadnumpy-1994e4ae0f9e98c419793c7d3e6a079aa0c23010.tar.gz
BUG: Make mapdomain work for multidimensional arrays as advertized in
the documentation. Fixes ticket #1554.
Diffstat (limited to 'numpy/polynomial/polyutils.py')
-rw-r--r--numpy/polynomial/polyutils.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/numpy/polynomial/polyutils.py b/numpy/polynomial/polyutils.py
index 5c65e03c2..25d50837a 100644
--- a/numpy/polynomial/polyutils.py
+++ b/numpy/polynomial/polyutils.py
@@ -289,8 +289,8 @@ def mapparms(old, new) :
Parameters
----------
old, new : array_like
- Each domain must (successfully) convert to a 1-d array containing
- precisely two values.
+ Domains. Each domain must (successfully) convert to a 1-d array
+ containing precisely two values.
Returns
-------
@@ -330,13 +330,14 @@ def mapdomain(x, old, new) :
"""
Apply linear map to input points.
- The linear map ``offset + scale*x`` that maps `old` to `new` is applied
- to the points `x`.
+ The linear map ``offset + scale*x`` that maps the domain `old` to
+ the domain `new` is applied to the points `x`.
Parameters
----------
x : array_like
- Points to be mapped.
+ Points to be mapped. If `x` is a subtype of ndarray the subtype
+ will be preserved.
old, new : array_like
The two domains that determine the map. Each must (successfully)
convert to 1-d arrays containing precisely two values.
@@ -388,6 +389,6 @@ def mapdomain(x, old, new) :
array([-1.0+1.j , -0.6+0.6j, -0.2+0.2j, 0.2-0.2j, 0.6-0.6j, 1.0-1.j ])
"""
- [x] = as_series([x], trim=False)
+ x = np.asanyarray(x)
off, scl = mapparms(old, new)
return off + scl*x