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