Similar to np.moveaxis but faster for just a single axis.
(a, source, destination)
| 95 | |
| 96 | |
| 97 | def move_single_axis(a, source, destination): |
| 98 | """Similar to np.moveaxis but faster for just a single axis.""" |
| 99 | order = [n for n in range(a.ndim) if n != source] |
| 100 | order.insert(destination, source) |
| 101 | return a.transpose(order) |
| 102 | |
| 103 | |
| 104 | def apply_dense(matrix, array, axis, out=None): |
no outgoing calls
no test coverage detected