On Thursday, 7 September 2017 at 12:28:00 UTC, jmh530 wrote:
On Thursday, 7 September 2017 at 12:27:19 UTC, jmh530 wrote:

auto x = data.sliced(2, 3).universal;

Err, (3, 4) not (2, 3)

All kinds of screwed up. This is what I get for not testing things before I post them.

unittest {
    auto data = iota(12);

    auto x = data.sliced(3, 4).universal;
    assert(x.strides == [4, 1]);
    assert(x[1, 2] == data[1 * 4 + 2 * 1]);

    auto y = x.transposed;
    assert(y.strides == [1, 4]);
    assert(y[1, 2] == data[1 * 1 + 2 * 4]);
}

Reply via email to