Example of append & rectangualar arrays?

Robert M. Münch robert.muench at saphirion.com
Tue May 28 06:46:21 UTC 2019


On 2019-05-27 13:14:47 +0000, 9il said:

> 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[])[].

And to have appenders on both dimensions?

Appenders!(T[])Appenders!(T[])  --- not tested.

I'm using dynamic arrays at the moment which works. As the amount of 
data is not very high, the overhead shouldn't be critical. My idea to 
use an appender instead of dynamic arrays was efficency.


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

I took a look at mir, but as I understands it, it needs known dimension 
sizes (matrix). I don't have these, it's all dynamic.

> 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.

Yes, as said I don't have a matrix more a collection of differently 
sized dynamic arrays.

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list