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

Shaleen Chhabra chhabrashaleen at gmail.com
Wed Sep 9 11:36:56 UTC 2020


On Wednesday, 9 September 2020 at 11:30:58 UTC, Shaleen Chhabra 
wrote:
> 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?

The task which i want to achieve is:

 From scratch, i need numir and mir-algorithm to work on my system 
as a part of one of my repositories.
I need to achieve the following targets as the first go and then 
use mir-algorithm to perform the needful research.

1. Load/save mir.ndslice arrays in NPY format
2. Load/save mir.sparse arrays in coordinate format as NPY files

but i am unable to configure the libraries, have dmd v2.076.1 
installed on my PC.

thanks


More information about the Digitalmars-d-learn mailing list