How to use libmir --> mir-algorithm, numir, mir-random?

WebFreak001 at
Wed Sep 2 08:16:35 UTC 2020

On Wednesday, 2 September 2020 at 07:01:48 UTC, Shaleen Chhabra 
> Hi,
> The libmir libraries can be found here: 
> I wish to use mir-algorithm and numir so that i can directly 
> use .npy format from python and perform the required analysis.
> I checked out latest commits of each of the libraries mentioned 
> --> mir-algorithm, mir-random and numir.
> But they don't seem to build together. what are the correct 
> dependencies for each library.
> TASK:  how can i read / write mir.ndslice matrices and in what 
> preferable format, an example should be good. I also wish to 
> read / write in .npy format, how can i do this?

numir seems to be what you are looking for:

You can check the loadNpy and saveNpy examples at the bottom of 
this page:


     auto a1_i4 = loadNpy!(int, 1)("./test/a1_i4.npy");
     assert(a1_i4 == iota(6).map!(to!int));

loadNpy returns a mir.ndslice Slice so you should be able to 
operate on it like usual. You need to specify the dimensions of 
your slice at compile time though, the lengths of each dimension 
do seem to be loaded at runtime.

More information about the Digitalmars-d-learn mailing list