How to use libmir --> mir-algorithm, numir, mir-random?
9il
ilyayaroshenko at gmail.com
Wed Sep 2 08:19:30 UTC 2020
On Wednesday, 2 September 2020 at 07:01:48 UTC, Shaleen Chhabra
wrote:
> Hi,
>
> The libmir libraries can be found here:
> https://github.com/libmir
>
> 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.
https://github.com/libmir/numir/blob/master/dub.json#L9
> 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);
writeln();
writefln("[%(%(%d %)\n %)]", mat);
writeln();
writefln("[%([%(%d %)]%|\n %)]", mat);
writeln();
}
See also https://dlang.org/phobos/std_format.html
More information about the Digitalmars-d-learn
mailing list