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

Shaleen Chhabra chhabrashaleen at gmail.com
Wed Sep 9 11:30:58 UTC 2020


On Wednesday, 2 September 2020 at 08:19:30 UTC, 9il wrote:
> 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



Hi I ran dub build on the numir library, it fetched some 
dependencies from dub.json.
But there was an error

../../.dub/packages/mir-core-1.1.10/mir-core/source/mir/conv.d(9,15): Error: module lifetime is in file 'core/lifetime.d' which cannot be read

when i do dub build.

Also, do i need to upgrade my dmd version in order to get it 
working?


More information about the Digitalmars-d-learn mailing list