September 07
On Thursday, 7 September 2017 at 09:40:40 UTC, Ilya Yaroshenko wrote:
>
> For example, lets takes `transposed` function. It does not transpose the date. Instead, it swap dimensions.
> Assume you have a canonical matrix with _lengths = [3, 4]. So its strides are [4]. Now we want to swap dimensions, but to do it we need to swap both lengths and strides. So first we need to convert a slice to universal, so it will have both strides we want to swap: [4, 1]. Transposed slice will have _lengths = [4, 3] and _strides = [1, 4].
>
> Best Regards,
> Ilya

I think what's missing from the documentation is a clear explanation of how the strides determine how the iterator moves. Even something like below (assuming I have the math right) would be an improvement, though I'm sure there is a clearer way to express the concept.

auto x = iota(3, 4).universal;
assert(x.strides == [4, 1]);
assert(x[2, 3] == 6); //(2 - 1) * 4 + (3 - 1) * 1

auto y = x.transposed;
assert(y.strides == [1, 4]);
assert(y[2, 3] == 9); //(2 - 1) * 1 + (3 - 1) * 4
September 07
On Thursday, 7 September 2017 at 12:04:12 UTC, jmh530 wrote:
>
> I think what's missing from the documentation is a clear explanation of how the strides determine how the iterator moves. Even something like below (assuming I have the math right) would be an improvement, though I'm sure there is a clearer way to express the concept.
>
> auto x = iota(3, 4).universal;
> assert(x.strides == [4, 1]);
> assert(x[2, 3] == 6); //(2 - 1) * 4 + (3 - 1) * 1
>
> auto y = x.transposed;
> assert(y.strides == [1, 4]);
> assert(y[2, 3] == 9); //(2 - 1) * 1 + (3 - 1) * 4

Hmm, maybe I can express this better as something like

auto data = iota(12);

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

auto y = x.transposed;
assert(y.strides == [1, 4]);
assert(y[2, 3] == data[(2 - 1) * 1 + (3 - 1) * 4]);
September 07
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)
September 07
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]);
}
September 11
On Thursday, 7 September 2017 at 20:46:22 UTC, jmh530 wrote:
> 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]);
> }

Another small difference is slicing:
For example, for contiguous matrix m:
1. m[a .. b]         is contiguous
2. m[i]              is contiguous
3. m[a .. b, i]      is universal (because there are no 1D canonical slices)
4. m[a .. b, c .. d] is canonical

BTW, could you please update the docs or may be write a small article for Mir blog?
I will be happy to answer your questions if any.

Best Regards,
Ilya
September 11
On Monday, 11 September 2017 at 05:41:37 UTC, Ilya Yaroshenko wrote:
>
> Another small difference is slicing:
> For example, for contiguous matrix m:
> 1. m[a .. b]         is contiguous
> 2. m[i]              is contiguous
> 3. m[a .. b, i]      is universal (because there are no 1D canonical slices)
> 4. m[a .. b, c .. d] is canonical
>

Was not aware of this.

> BTW, could you please update the docs or may be write a small article for Mir blog?

I'm happy to do some additional work on the docs, but I was waiting until I had a better understanding of things. I've also been working on some other things and there are only so many hours in the day. I want to add cholesky to mir-lapack/lubeck.

> I will be happy to answer your questions if any.

I think I had asked a question on gitter, but I don't think I had heard back. Not sure how often you check that.
Next ›   Last »
1 2 3 4