Example of append & rectangualar arrays?

9il ilyayaroshenko at gmail.com
Mon May 27 13:14:47 UTC 2019


On Saturday, 25 May 2019 at 14:17:43 UTC, Robert M. Münch wrote:
> Does anyone has an example using Appender with a rectangual 
> array?

Appender!(T[][]) can append rows of type T[]. It does not check 
their lengths, the T[][] is an array of arrays, not a matrix.

To append columns one needs an array of Appenders, 
Appenders!(T[])[].

T[][] can be converted to Slice!(T*, 2) (ndslice matrix) using 
the mir.ndslice.fuse module [1].

Then the matrix can be transposed. Zero cost transposition can be 
found in the second example at [1].

`ndarray` function can be used [2] to convert matrix back to an 
array of array.

http://mir-algorithm.libmir.org/mir_ndslice_fuse.html#.fuse
http://mir-algorithm.libmir.org/mir_ndslice_allocation.html#ndarray



More information about the Digitalmars-d-learn mailing list