summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_shape_base.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-10-09 07:47:06 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-10-09 07:47:06 +0000
commit9c9f739d4589ed7ad5469bda7269e79e90d843cb (patch)
tree896c30a4b4c5fa234df3f03367d0f320428e05b1 /numpy/lib/tests/test_shape_base.py
parentb7f719aac1d6ff56cf58cb915ca7453820357a11 (diff)
downloadnumpy-9c9f739d4589ed7ad5469bda7269e79e90d843cb.tar.gz
Fix kron for multiple-dimensions. kron is defined so tile(b, s) is the same as kron(ones(s,b.dtype), b)
Diffstat (limited to 'numpy/lib/tests/test_shape_base.py')
-rw-r--r--numpy/lib/tests/test_shape_base.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py
index 2d09e86c3..b43b08664 100644
--- a/numpy/lib/tests/test_shape_base.py
+++ b/numpy/lib/tests/test_shape_base.py
@@ -11,8 +11,6 @@ class test_apply_along_axis(NumpyTestCase):
a = ones((20,10),'d')
assert_array_equal(apply_along_axis(len,0,a),len(a)*ones(shape(a)[1]))
def check_simple101(self,level=11):
- # This test causes segmentation fault (Numeric 23.3,23.6,Python 2.3.4)
- # when enabled and shape(a)[1]>100. See Issue 202.
a = ones((10,101),'d')
assert_array_equal(apply_along_axis(len,0,a),len(a)*ones(shape(a)[1]))
@@ -370,6 +368,7 @@ class test_kron(NumpyTestCase):
assert_equal(type(kron(a,ma)), ndarray)
assert_equal(type(kron(ma,a)), myarray)
+
class test_tile(NumpyTestCase):
def check_basic(self):
a = array([0,1,2])
@@ -380,7 +379,19 @@ class test_tile(NumpyTestCase):
assert_equal(tile(b, 2), [[1,2,1,2],[3,4,3,4]])
assert_equal(tile(b,(2,1)),[[1,2],[3,4],[1,2],[3,4]])
assert_equal(tile(b,(2,2)),[[1,2,1,2],[3,4,3,4],[1,2,1,2],[3,4,3,4]])
-
+
+ def check_kroncompare(self):
+ import numpy.random as nr
+ reps=[(2,),(1,2),(2,1),(2,2),(2,3,2),(3,2)]
+ shape=[(3,),(2,3),(3,4,3),(3,2,3),(4,3,2,4),(2,2)]
+ for s in shape:
+ b = nr.randint(0,10,size=s)
+ for r in reps:
+ a = ones(r, b.dtype)
+ large = tile(b, r)
+ klarge = kron(a, b)
+ assert_equal(large, klarge)
+
# Utility
def compare_results(res,desired):