www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - ndslice summary please

reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
I haven't played with ndslice nor followed its deprecation discussions. 
Could someone summarize it for us please. Also, is it still used outside 
Phobos or is Ilya or someone else rewriting it?

Ali
Apr 13 2017
next sibling parent 9il <ilyayaroshenko gmail.com> writes:
On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote:
 I haven't played with ndslice nor followed its deprecation 
 discussions. Could someone summarize it for us please. Also, is 
 it still used outside Phobos or is Ilya or someone else 
 rewriting it?

 Ali
Hello Ali, ndslice was removed from Phobos because it is to hard to maintain Phobos and Mir at the same time. It is better to have dub packages instead of big Phobos, IMHO. ndslice was completely rewritten and extended in mir-algorithm package [0, 1] since ndslice was deprecated in Phobos. Its API is stable enough and includes all kinds of tensors. New ndslice is used in two Tamediadigital's projects [3, 4]. See also its README for more details. The old ndslice (like in Phobos) is located in parent Mir package [2]. The last Mir version with old ndslice is v0.22.1. [0] http://docs.algorithm.dlang.io [1] https://github.com/libmir/mir-algorithm [2] https://github.com/libmir/mir [3] https://github.com/tamediadigital/lincount [4] https://github.com/tamediadigital/hll-d If you have any questions about ndslice I would be happy to answer. Best regards, Ilya
Apr 13 2017
prev sibling next sibling parent reply 9il <ilyayaroshenko gmail.com> writes:
On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote:
 I haven't played with ndslice nor followed its deprecation 
 discussions. Could someone summarize it for us please. Also, is 
 it still used outside Phobos or is Ilya or someone else 
 rewriting it?

 Ali
The reasons to use mir-algorithm instead of std.range, std.algorithm, std.functional (when applicable): 1. It allows easily construct one and multidimensional random access ranges. You may compare `bitwise` implementation in mir-algorithm and Phobos. Mir's version few times smaller and do not have Phobos bugs like non mutable `front`. See also `bitpack`. 2. Mir devs are very cary about BetterC 3. Slice is universal, full featured, and multidimensional random access range. All RARs can be expressed through generic Slice struct. 4. It is faster to compile and generates less templates bloat. For example: slice.map!fun1.map!fun2 is the same as slice.map!(pipe!(fun1, fun2)) `map` and `pipe` are from mir-algorithm.
Apr 13 2017
parent reply Dejan Lekic <dejan.lekic gmail.com> writes:
On Thursday, 13 April 2017 at 10:00:43 UTC, 9il wrote:
 On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote:
 I haven't played with ndslice nor followed its deprecation 
 discussions. Could someone summarize it for us please. Also, 
 is it still used outside Phobos or is Ilya or someone else 
 rewriting it?

 Ali
The reasons to use mir-algorithm instead of std.range, std.algorithm, std.functional (when applicable): 1. It allows easily construct one and multidimensional random access ranges. You may compare `bitwise` implementation in mir-algorithm and Phobos. Mir's version few times smaller and do not have Phobos bugs like non mutable `front`. See also `bitpack`. 2. Mir devs are very cary about BetterC 3. Slice is universal, full featured, and multidimensional random access range. All RARs can be expressed through generic Slice struct. 4. It is faster to compile and generates less templates bloat. For example: slice.map!fun1.map!fun2 is the same as slice.map!(pipe!(fun1, fun2)) `map` and `pipe` are from mir-algorithm.
It is all good, but I am sure many D programmers, myself included, would appreciate if shortcomings of Phobos are fixed instead of having a completely separate package with set of features that overlap... I understand ndslice was at some point in the `experimental` package, but again - it would be good if you improve existing Phobos stuff instead of providing a separate library that provides better implementation(s).
Apr 13 2017
parent Ilya Yaroshenko <ilyayaroshenko gmail.com> writes:
On Thursday, 13 April 2017 at 15:00:16 UTC, Dejan Lekic wrote:
 On Thursday, 13 April 2017 at 10:00:43 UTC, 9il wrote:
 On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote:
 [...]
The reasons to use mir-algorithm instead of std.range, std.algorithm, std.functional (when applicable): 1. It allows easily construct one and multidimensional random access ranges. You may compare `bitwise` implementation in mir-algorithm and Phobos. Mir's version few times smaller and do not have Phobos bugs like non mutable `front`. See also `bitpack`. 2. Mir devs are very cary about BetterC 3. Slice is universal, full featured, and multidimensional random access range. All RARs can be expressed through generic Slice struct. 4. It is faster to compile and generates less templates bloat. For example: slice.map!fun1.map!fun2 is the same as slice.map!(pipe!(fun1, fun2)) `map` and `pipe` are from mir-algorithm.
It is all good, but I am sure many D programmers, myself included, would appreciate if shortcomings of Phobos are fixed instead of having a completely separate package with set of features that overlap... I understand ndslice was at some point in the `experimental` package, but again - it would be good if you improve existing Phobos stuff instead of providing a separate library that provides better implementation(s).
Work on Phobos is useless for me because when I need something and I am ready to write / fix it I have few days, but not few months until LDC release. DUB is more flexible, it allows to override version with local path for example. Finally, I think Phobos should be deprecated and be split into dub packages.
Apr 13 2017
prev sibling parent reply Martin Tschierschke <mt smartdolphin.de> writes:
On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote:
 I haven't played with ndslice nor followed its deprecation 
 discussions. Could someone summarize it for us please. Also, is 
 it still used outside Phobos or is Ilya or someone else 
 rewriting it?

 Ali
We should additionally mention sometimes, that the naming of ndslice is derived from ndarray and this is from N-dimensional Array. No one searching for N - dimensional Array OR Matrix will find ndslice, without this info easily. Just try a google search: "dlang n dimesional array" Regards mt.
Apr 13 2017
next sibling parent 9il <ilyayaroshenko gmail.com> writes:
On Thursday, 13 April 2017 at 15:22:46 UTC, Martin Tschierschke 
wrote:
 On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote:
 I haven't played with ndslice nor followed its deprecation 
 discussions. Could someone summarize it for us please. Also, 
 is it still used outside Phobos or is Ilya or someone else 
 rewriting it?

 Ali
We should additionally mention sometimes, that the naming of ndslice is derived from ndarray and this is from N-dimensional Array. No one searching for N - dimensional Array OR Matrix will find ndslice, without this info easily. Just try a google search: "dlang n dimesional array" Regards mt.
The first link for me in incognito mode is: https://wiki.dlang.org/Dense_multidimensional_arrays It contained example for std.experimental.ndslice. But thanks for the idea. Reworked for Mir now. Thanks, Ilya
Apr 13 2017
prev sibling parent 9il <ilyayaroshenko gmail.com> writes:
On Thursday, 13 April 2017 at 15:22:46 UTC, Martin Tschierschke 
wrote:
 On Thursday, 13 April 2017 at 08:47:16 UTC, Ali Çehreli wrote:
 I haven't played with ndslice nor followed its deprecation 
 discussions. Could someone summarize it for us please. Also, 
 is it still used outside Phobos or is Ilya or someone else 
 rewriting it?

 Ali
We should additionally mention sometimes, that the naming of ndslice is derived from ndarray and this is from N-dimensional Array. No one searching for N - dimensional Array OR Matrix will find ndslice, without this info easily. Just try a google search: "dlang n dimesional array" Regards mt.
... plus link in the spec https://github.com/dlang/dlang.org/pull/1634
Apr 13 2017