diff options
author | Gengxin Xie <gengxin.xie@intel.com> | 2020-06-15 10:12:46 +0800 |
---|---|---|
committer | Gengxin Xie <gengxin.xie@intel.com> | 2020-06-15 11:09:17 +0800 |
commit | 334b59dfcc1e5b9ba6d28647b8002d5c7cfa2765 (patch) | |
tree | 11914c0c66b9c343432d1e0666647468f2f3d5c3 | |
parent | c457a755744ee6cc279561a272f04c3ed5ce263c (diff) | |
download | numpy-334b59dfcc1e5b9ba6d28647b8002d5c7cfa2765.tar.gz |
TEST: Add log strided input test
-rw-r--r-- | numpy/core/tests/test_umath.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index 91acd6ac3..aab6aca11 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -657,6 +657,19 @@ class TestLog: yf = np.array(y, dtype=dt)*log2_ assert_almost_equal(np.log(xf), yf) + def test_log_strides(self): + np.random.seed(42) + strides = np.array([-4,-3,-2,-1,1,2,3,4]) + sizes = np.arange(2,100) + for ii in sizes: + x_f64 = np.float64(np.random.uniform(low=0.01, high=100.0,size=ii)) + x_special = x_f64.copy() + x_special[3:-1:4] = 1.0 + y_true = np.log(x_f64) + y_special = np.log(x_special) + for jj in strides: + assert_array_almost_equal_nulp(np.log(x_f64[::jj]), y_true[::jj], nulp=2) + assert_array_almost_equal_nulp(np.log(x_special[::jj]), y_special[::jj], nulp=2) class TestExp: def test_exp_values(self): |