(self)
| 1447 | np.log(x) |
| 1448 | |
| 1449 | def test_log_strides(self): |
| 1450 | np.random.seed(42) |
| 1451 | strides = np.array([-4, -3, -2, -1, 1, 2, 3, 4]) |
| 1452 | sizes = np.arange(2, 100) |
| 1453 | for ii in sizes: |
| 1454 | x_f64 = np.float64(np.random.uniform(low=0.01, high=100.0, size=ii)) |
| 1455 | x_special = x_f64.copy() |
| 1456 | x_special[3:-1:4] = 1.0 |
| 1457 | y_true = np.log(x_f64) |
| 1458 | y_special = np.log(x_special) |
| 1459 | for jj in strides: |
| 1460 | assert_array_almost_equal_nulp( |
| 1461 | np.log(x_f64[::jj]), |
| 1462 | y_true[::jj], |
| 1463 | nulp=2, |
| 1464 | ) |
| 1465 | assert_array_almost_equal_nulp( |
| 1466 | np.log(x_special[::jj]), |
| 1467 | y_special[::jj], |
| 1468 | nulp=2, |
| 1469 | ) |
| 1470 | |
| 1471 | # Reference values were computed with mpmath, with mp.dps = 200. |
| 1472 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected