()
| 141 | aview.swapaxes(0, 1).ravel(order='C')) |
| 142 | |
| 143 | def test_iter_f_order(): |
| 144 | # Test forcing F order |
| 145 | |
| 146 | # Test the ordering for 1-D to 5-D shapes |
| 147 | for shape in [(5,), (3, 4), (2, 3, 4), (2, 3, 4, 3), (2, 3, 2, 2, 3)]: |
| 148 | a = arange(np.prod(shape)) |
| 149 | # Test each combination of positive and negative strides |
| 150 | for dirs in range(2**len(shape)): |
| 151 | dirs_index = [slice(None)] * len(shape) |
| 152 | for bit in range(len(shape)): |
| 153 | if ((2**bit) & dirs): |
| 154 | dirs_index[bit] = slice(None, None, -1) |
| 155 | dirs_index = tuple(dirs_index) |
| 156 | |
| 157 | aview = a.reshape(shape)[dirs_index] |
| 158 | # C-order |
| 159 | i = nditer(aview, order='F') |
| 160 | assert_equal(list(i), aview.ravel(order='F')) |
| 161 | # Fortran-order |
| 162 | i = nditer(aview.T, order='F') |
| 163 | assert_equal(list(i), aview.T.ravel(order='F')) |
| 164 | # Other order |
| 165 | if len(shape) > 2: |
| 166 | i = nditer(aview.swapaxes(0, 1), order='F') |
| 167 | assert_equal(list(i), |
| 168 | aview.swapaxes(0, 1).ravel(order='F')) |
| 169 | |
| 170 | def test_iter_c_or_f_order(): |
| 171 | # Test forcing any contiguous (C or F) order |
nothing calls this directly
no test coverage detected
searching dependent graphs…