I found this while working on #480. The ndarray implementation of Array2::from_iterator does not handle column-major input correctly for rectangular matrices.
For example, from_iterator(1..=6, 2, 3, 1) should produce [[1, 3, 5], [2, 4, 6]]. The current implementation first builds a row-major array, reverses its axes, and then tries to reshape it in row-major order. For this input, the reshape fails and the method panics.
The fix is to use column-major order when reshaping the input for axis = 1. I will move that fix from #480 into a separate PR, with tests for both input orders and empty matrices, and a changelog entry.
I found this while working on #480. The ndarray implementation of
Array2::from_iteratordoes not handle column-major input correctly for rectangular matrices.For example,
from_iterator(1..=6, 2, 3, 1)should produce[[1, 3, 5], [2, 4, 6]]. The current implementation first builds a row-major array, reverses its axes, and then tries to reshape it in row-major order. For this input, the reshape fails and the method panics.The fix is to use column-major order when reshaping the input for
axis = 1. I will move that fix from #480 into a separate PR, with tests for both input orders and empty matrices, and a changelog entry.