Find missing axes. This will store a mapping between the missing axis and the next available axis.
| 1254 | // Find missing axes. This will store a mapping between the missing |
| 1255 | // axis and the next available axis. |
| 1256 | static std::map<std::size_t, std::size_t> |
| 1257 | find_missing_axes(const std::map<std::size_t, std::vector<dimension::sub*>>& axes_map, |
| 1258 | std::size_t rank) |
| 1259 | { |
| 1260 | std::map<std::size_t, std::size_t> missing_axes; |
| 1261 | for(auto axis : range(rank)) |
| 1262 | { |
| 1263 | if(contains(axes_map, axis)) |
| 1264 | continue; |
| 1265 | auto it = axes_map.upper_bound(axis); |
| 1266 | missing_axes[axis] = it == axes_map.end() ? rank : it->first; |
| 1267 | } |
| 1268 | return missing_axes; |
| 1269 | } |
| 1270 | |
| 1271 | // Find broadcasted dimensions. This will store a map from the next axis |
| 1272 | // to the indices of the previous dimensions that are being broadcasted. |