Mir Slice Column or Row Major
9il
ilyayaroshenko at gmail.com
Thu May 28 00:51:50 UTC 2020
On Wednesday, 27 May 2020 at 16:53:37 UTC, jmh530 wrote:
> On Wednesday, 27 May 2020 at 16:07:58 UTC, welkam wrote:
>> On Wednesday, 27 May 2020 at 01:31:23 UTC, data pulverizer
>> wrote:
>>> column major
>>
>> Cute puppies die when people access their arrays in column
>> major.
>
> Not always true...many languages support column-major order
> (Fortran, most obviously). The Eigen C++ library allows the
> user to specify row major or column major. I had brought this
> up with Ilya early on in mir and he thought it would increase
> complexity to allow both and could also require more memory. So
> mir is row major.
Actually it is a question of notation. For example, mir-lapack
uses ndslice as column-major Fortran arrays. This may cause some
headaches because the data needs to be transposed in mind. We can
think about ndslice as about column-major nd-arrays with the
reversed order of indexing.
The current template looks like
Slice(Iterator, size_t N = 1, SliceKind kind = 1)
If we add a special column-major notation, then it will look like
Slice(Iterator, size_t N = 1, SliceKind kind = Contiguous,
PayloadOrder = RowMajor)
A PR that adds this feature will be accepted.
More information about the Digitalmars-d-learn
mailing list