On Wednesday, 6 September 2017 at 21:44:01 UTC, jmh530 wrote:
On Wednesday, 6 September 2017 at 20:24:05 UTC, Enamex wrote:
Similarly, a[0] has _strides [4, 1] for universal, [4] for canonical, and [] for contiguous. Mir is written in such a way that a[0] the same regardless of the SliceKind. For the most part, this means that it isn't really obvious that there is a difference between them. It matters in some underlying functions, but I haven't needed to do much other than sometimes convert a contiguous slice to universal (though it's not always clear to me why, I just do it).

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

Reply via email to