Jump to page: 1 2
Thread overview
std.multidimarray
May 24, 2015
Dennis Ritchie
May 24, 2015
Dennis Ritchie
May 24, 2015
Laeeth Isharc
May 24, 2015
Dennis Ritchie
May 25, 2015
Vlad Levenfeld
May 25, 2015
Dennis Ritchie
May 25, 2015
Vlad Levenfeld
May 25, 2015
Dennis Ritchie
May 25, 2015
Vlad Levenfeld
May 26, 2015
Dennis Ritchie
May 25, 2015
Dennis Ritchie
May 25, 2015
Vlad Levenfeld
May 25, 2015
Dennis Ritchie
May 24, 2015
Hello everyone!

I want to know whether there are any plans for the inclusion of such a module in Phobos?

Documentation:
http://denis-sh.bitbucket.org/unstandard/unstd.multidimarray.html

Source:
https://bitbucket.org/denis-sh/unstandard/src/ab5e199797e809ba4668affdc4fc8e84f40d2440/unstd/multidimarray.d?at=master

I think that the foreach loop with Multi-iterators bring many new and exciting designs in D:

foreach(z, y, x, ref el; matrices) // using opApply
    el = cast(int) (z * 100 + y * 10 + x);

Of course, embedded in the language is not necessary, but why not create a separate module std.multidimarray.
May 24, 2015
Another good attempt to simplify operations with multidimensional arrays and matrices:
https://github.com/k3kaimu/carbon/blob/master/source/carbon/linear.d
May 24, 2015
On Sunday, 24 May 2015 at 17:46:40 UTC, Dennis Ritchie wrote:
> Another good attempt to simplify operations with multidimensional arrays and matrices:
> https://github.com/k3kaimu/carbon/blob/master/source/carbon/linear.d

You might take a look at Vlad Levenfeld's work too, although I think he would say that it is still at an early stage (if I understand correctly - looks very interesting to me, although I have not yet properly had time to explore it in depth)

https://github.com/evenex/autodata
May 24, 2015
On Sunday, 24 May 2015 at 20:45:56 UTC, Laeeth Isharc wrote:
> You might take a look at Vlad Levenfeld's work too, although I think he would say that it is still at an early stage (if I understand correctly - looks very interesting to me, although I have not yet properly had time to explore it in depth)
>
> https://github.com/evenex/autodata

Yes, at the moment it looks all pretty damp, but very interesting. For example, this really is not enough:

https://github.com/evenex/autodata/blob/master/source/spaces/matrix.d#L53-L68

The fact that no library will not arrange me. I need the tools to work with multidimensional arrays, which will necessarily be built into Phobos!
May 25, 2015
On Sunday, 24 May 2015 at 22:42:12 UTC, Dennis Ritchie wrote:
> On Sunday, 24 May 2015 at 20:45:56 UTC, Laeeth Isharc wrote:
>> You might take a look at Vlad Levenfeld's work too, although I think he would say that it is still at an early stage (if I understand correctly - looks very interesting to me, although I have not yet properly had time to explore it in depth)
>>
>> https://github.com/evenex/autodata
>
> Yes, at the moment it looks all pretty damp, but very interesting. For example, this really is not enough:
>
> https://github.com/evenex/autodata/blob/master/source/spaces/matrix.d#L53-L68
>
> The fact that no library will not arrange me. I need the tools to work with multidimensional arrays, which will necessarily be built into Phobos!

The matrix implementation is really just a placeholder, when I have more time I would like to fill it out with compile-time swappable backend implementations using the same matrix frontend (eg forwarding arithmetic operations to gsl routines).

So yes, the matrix example is very raw (I assume by damp you meant "siroi"). The other structures are much more fleshed out and provide much better examples of what I'm going for (ie any of the reimplemented Phobos adaptors: cycle, stride, etc).

The library itself is meant to generate consistent, safe interfaces for all manner of multidimensional structures (or, at least those that resemble cartesian products of half open intervals).

I can drop in a naive backend later this week as a concrete demonstration.

Its unlikely, even in complete form, that this would be suitable for inclusion in Phobos (it adds a lot of nonstandard idioms), but many of the design issues surrounding multidimensional structures with not-necessarily-integral indices have been carefully addressed; their solutions may prove useful in the effort to build a standard library package.
May 25, 2015
On Monday, 25 May 2015 at 18:11:32 UTC, Vlad Levenfeld wrote:
> The matrix implementation is really just a placeholder, when I have more time I would like to fill it out with compile-time swappable backend implementations using the same matrix frontend (eg forwarding arithmetic operations to gsl routines).
>
> So yes, the matrix example is very raw (I assume by damp you meant "siroi"). The other structures are much more fleshed out and provide much better examples of what I'm going for (ie any of the reimplemented Phobos adaptors: cycle, stride, etc).

Yes crude meaning "raw".

> The library itself is meant to generate consistent, safe interfaces for all manner of multidimensional structures (or, at least those that resemble cartesian products of half open intervals).
>
> I can drop in a naive backend later this week as a concrete demonstration.
>
> Its unlikely, even in complete form, that this would be suitable for inclusion in Phobos (it adds a lot of nonstandard idioms), but many of the design issues surrounding multidimensional structures with not-necessarily-integral indices have been carefully addressed; their solutions may prove useful in the effort to build a standard library package.

Yes, that's what I mean. Some common questions about working with multidimensional arrays need to be addressed. For example, the cycle `foreach` multiple iterators, etc.
May 25, 2015
On Monday, 25 May 2015 at 18:33:57 UTC, Dennis Ritchie wrote:
> Yes, that's what I mean. Some common questions about working with multidimensional arrays need to be addressed. For example, the cycle `foreach` multiple iterators, etc.

Cycle was tough. I was using T[2] to track slice boundaries but had to retrofit the library with an Interval!(L,R) type to admit the possibility of unbounded dimensions. This has resulted in a fairly easy implementation for cycle, though. https://github.com/evenex/autodata/blob/master/source/spaces/cyclic.d

Foreach is something I am still considering. It is straightforward to define a range adaptor that traverses a multidimensional array lexicographically, but another interesting possibility is to define traversable multidim arrays recursively, eg:

2d array = {1d row, 2d remainder}

This is cool, as it may enable us to write generic traversals for n-dim arrays and trees alike... However I have been struggling to find a way to make such a thing work with foreach cleanly.
May 25, 2015
On Monday, 25 May 2015 at 19:14:05 UTC, Vlad Levenfeld wrote:
> Cycle was tough. I was using T[2] to track slice boundaries but had to retrofit the library with an Interval!(L,R) type to admit the possibility of unbounded dimensions. This has resulted in a fairly easy implementation for cycle, though. https://github.com/evenex/autodata/blob/master/source/spaces/cyclic.d

Yes, it would be great to learn how to create recursive iterators for each subarray.

> Foreach is something I am still considering. It is straightforward to define a range adaptor that traverses a multidimensional array lexicographically, but another interesting possibility is to define traversable multidim arrays recursively, eg:
>
> 2d array = {1d row, 2d remainder}
>
> This is cool, as it may enable us to write generic traversals for n-dim arrays and trees alike... However I have been struggling to find a way to make such a thing work with foreach cleanly.

That recursive n-dimensional array, but I think that recursion will not be effective.
http://forum.dlang.org/thread/ulhtlyxxclihaseefrot@forum.dlang.org#post-mihl6m:241che:241:40digitalmars.com
May 25, 2015
On Monday, 25 May 2015 at 19:14:05 UTC, Vlad Levenfeld wrote:
> https://github.com/evenex/autodata/blob/master/source/spaces/cyclic.d

And I think that the symbol `ℕ` in your code you need to replace some words.
May 25, 2015
On Monday, 25 May 2015 at 20:52:33 UTC, Dennis Ritchie wrote:
> On Monday, 25 May 2015 at 19:14:05 UTC, Vlad Levenfeld wrote:
>> https://github.com/evenex/autodata/blob/master/source/spaces/cyclic.d
>
> And I think that the symbol `ℕ` in your code you need to replace some words.

Ok, done.
« First   ‹ Prev
1 2