Avatar for the xtensor-stack user
xtensor-stack
xtensor
BlogDocsChangelog

Performance History

Latest Results

Fix xview::element when a newaxis precedes an integral slice make_index maps each dimension i of the underlying expression to its slice k, then to the position of that slice in the view index: k minus the number of integral slices before it. It counted the integral slices before i instead of before k. The two differ when a newaxis comes before an integral slice, so the wrong index was read: xt::xarray<int> a = {{0, 1, 2}, {3, 4, 5}}; auto v = xt::view(a, xt::newaxis(), 1, xt::all()); v[{0, 2}]; // returned 3 instead of 5 operator() already used the slice position. element(), and the operator[] and at-style accesses built on it, now do too.
gouarin:fix-xview-element-newaxis
3 days ago
Fix xview_stepper on broadcast and reverse traversals xview_stepper is the stepper of views that are not strided, such as views with keep or drop slices. It had three bugs. step() and reset() received a dimension of the iterated shape but used it as a view dimension. When the view is broadcast to a higher rank, the first m_offset dimensions of that shape are not view dimensions, so the stepper moved along the wrong axes. reset() did not even skip them. With a = {{0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11}}, zeros({2, 2, 2}) + view(a, keep(0, 2), keep(1, 3)) gave {{1, 1}, {3, 3}} twice instead of {{1, 3}, {9, 11}}, and other shapes read the strides of the underlying container out of bounds. m_index_keeper is indexed like the slices in the constructor and in to_end(), but step() and reset() indexed it by view dimension. The two differ when an integral slice comes first, so view(a, 1, keep(0, 2, 3)) iterated backward from an uninitialized entry and crashed. to_end() stepped back from the end of the underlying expression, which leaves the stepper one past the last element along the last underlying axis. That is not the innermost axis of the view when the last slice is integral, when it is a newaxis or when the view has fewer slices than dimensions, so rbegin() started at the wrong element or past the end. The stepper now subtracts m_offset like xstepper, indexes m_index_keeper by slice, delegates the dimensions without a slice to the underlying stepper, and builds the end position from the begin position, the way increment_stepper reaches it. to_begin() also moves to the first element of the view, not of the underlying expression. The reverse column major check in test_view_iter, disabled because it failed for keep slices, now passes and is enabled again. The new xview tests fail on master and pass with the fix, also under AddressSanitizer and UBSan. This also removes the GCC -Warray-bounds warnings reported in common_step_forward and common_reset.
gouarin:fix-xview-stepper
3 days ago

Latest Branches

CodSpeed Performance Gauge
0%
Fix xview::element when a newaxis precedes an integral slice#2958
3 days ago
4b4e548
gouarin:fix-xview-element-newaxis
CodSpeed Performance Gauge
0%
3 days ago
4dccb74
gouarin:fix-pad-tile-validation
CodSpeed Performance Gauge
0%
3 days ago
93fd3ac
gouarin:fix-xfixed-test-uninit
© 2026 CodSpeed Technology
Home Terms Privacy Docs