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

9il ilyayaroshenko at
Wed Sep 2 08:19:30 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.

You can just import numir, it will automatically include 
mir-algorithm, mir-core, and mir-random.

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

import std.stdio;
import mir.ndslice;

void main() {
      auto mat = [[1, 2, 3],
                  [4, 5, 6],
                  [7, 8, 9]].fuse;

      writefln("%(%(%d %)\n%)", mat);

      writefln("[%(%(%d %)\n %)]", mat);

      writefln("[%([%(%d %)]%|\n %)]", mat);

See also

More information about the Digitalmars-d-learn mailing list