Jump to page: 1 2
Thread overview
Finally full multidimensional arrays support in D
Mar 17, 2014
Denis Shelomovskij
Mar 17, 2014
watcher
Mar 17, 2014
H. S. Teoh
Mar 17, 2014
Jared Miller
Mar 17, 2014
bearophile
Apr 17, 2014
CJS
Apr 17, 2014
H. S. Teoh
Mar 17, 2014
Christof Schardt
Mar 20, 2014
Denis Shelomovskij
Mar 17, 2014
Denis Shelomovskij
Mar 17, 2014
H. S. Teoh
Mar 17, 2014
Mason McGill
Apr 16, 2014
Stefan Frijters
Apr 16, 2014
bearophile
Jun 10, 2014
Stefan Frijters
Jun 11, 2014
Stefan Frijters
Jun 10, 2014
Benjamin Thaut
March 17, 2014
Multidimensional arrays indexing and slicing syntax is finally added [1] (thanks to Kenji Hara). So it was a good cause to update my multidimensional arrays library implementation and add support for the new syntax. So here we are: [2].

Also should we add it to the standard library?

[1] https://github.com/D-Programming-Language/dmd/pull/443
[2] http://denis-sh.bitbucket.org/unstandard/unstd.multidimarray.html

-- 
Денис В. Шеломовский
Denis V. Shelomovskij
March 17, 2014
+100



On Monday, 17 March 2014 at 17:39:41 UTC, Denis Shelomovskij wrote:
> Multidimensional arrays indexing and slicing syntax is finally added [1] (thanks to Kenji Hara). So it was a good cause to update my multidimensional arrays library implementation and add support for the new syntax. So here we are: [2].
>
> Also should we add it to the standard library?
>
> [1] https://github.com/D-Programming-Language/dmd/pull/443
> [2] http://denis-sh.bitbucket.org/unstandard/unstd.multidimarray.html

March 17, 2014
On Mon, Mar 17, 2014 at 09:39:40PM +0400, Denis Shelomovskij wrote:
> Multidimensional arrays indexing and slicing syntax is finally added [1] (thanks to Kenji Hara). So it was a good cause to update my multidimensional arrays library implementation and add support for the new syntax. So here we are: [2].
> 
> Also should we add it to the standard library?
> 
> [1] https://github.com/D-Programming-Language/dmd/pull/443
> [2] http://denis-sh.bitbucket.org/unstandard/unstd.multidimarray.html
[...]

Let's do it! Put it up for review!

I almost gave up hope that this day would come, but this morning I looked at the dmd commit log and saw Kenji's pull was merged. You couldn't believe how happy I was. Finally, sane multidimensional array support!!


T

-- 
Almost all proofs have bugs, but almost all theorems are true. -- Paul Pedersen
March 17, 2014
Good news and kudos to Kenji.

And yes, I think that a matrix / linear algebra library, as well as NumPy-style ND-Arrays are great candidates for future Phobos modules.

We've done a good bit of work with matrices at my workplace (EMSI), so I bet someone here could find time to contribute a bit. As a start, we've got some basic BLAS and MKL bindings that we really should clean up and get into Deimos.

On Monday, 17 March 2014 at 17:39:41 UTC, Denis Shelomovskij wrote:
> Multidimensional arrays indexing and slicing syntax is finally added [1] (thanks to Kenji Hara). So it was a good cause to update my multidimensional arrays library implementation and add support for the new syntax. So here we are: [2].
>
> Also should we add it to the standard library?
>
> [1] https://github.com/D-Programming-Language/dmd/pull/443
> [2] http://denis-sh.bitbucket.org/unstandard/unstd.multidimarray.html

March 17, 2014
Jared Miller:

> And yes, I think that a matrix / linear algebra library, as well as NumPy-style ND-Arrays are great candidates for future Phobos modules.

I suggest to not put such library in Phobos before few years of usage in the wild.

Bye,
bearophile
March 17, 2014
I looked to the doku-page and expected to see, how some basic
matrix-operations could be performed.
Like e.g. (basic syntax) this:

 Dim  a(10,12)
 a(3,4) = 7
 a(i,j) = a(j,i) * 12

Instead I found exotic assignments and calculations.
Did I expect the wrong thing?





March 17, 2014
17.03.2014 21:39, Denis Shelomovskij пишет:
> Multidimensional arrays indexing and slicing syntax is finally added [1]
> (thanks to Kenji Hara). So it was a good cause to update my
> multidimensional arrays library implementation and add support for the
> new syntax. So here we are: [2].
>
> Also should we add it to the standard library?
>
> [1] https://github.com/D-Programming-Language/dmd/pull/443
> [2] http://denis-sh.bitbucket.org/unstandard/unstd.multidimarray.html
>

An important note:
My proposal is just a sliceable multidimensional array implementation, a try to provide the same effort we have for simple arrays for multidimensional ones. It isn't aimed to be a dedicated matrix / linear algebra module.


-- 
Денис В. Шеломовский
Denis V. Shelomovskij
March 17, 2014
On Tue, Mar 18, 2014 at 01:55:31AM +0400, Denis Shelomovskij wrote:
> 17.03.2014 21:39, Denis Shelomovskij пишет:
> >Multidimensional arrays indexing and slicing syntax is finally added [1] (thanks to Kenji Hara). So it was a good cause to update my multidimensional arrays library implementation and add support for the new syntax. So here we are: [2].
> >
> >Also should we add it to the standard library?
> >
> >[1] https://github.com/D-Programming-Language/dmd/pull/443
> >[2] http://denis-sh.bitbucket.org/unstandard/unstd.multidimarray.html
> >
> 
> An important note:
> My proposal is just a sliceable multidimensional array implementation,
> a try to provide the same effort we have for simple arrays for
> multidimensional ones. It isn't aimed to be a dedicated matrix /
> linear algebra module.
[...]

It will be a good low-level module that will allow a linear algebra module to be built on.

I am against the idea of conflating multidimensional arrays with matrices; the operations and interpretations are not the same, and it leads to poor designs (I've tried it before, and the results were not so good). Better have a general multidimensional array with per-element operations, and then build matrix algebra as a separate module by using multidimensional array as underlying storage implementation.


T

-- 
Answer: Because it breaks the logical sequence of discussion. / Question: Why is top posting bad?
March 17, 2014
> It will be a good low-level module that will allow a linear algebra
> module to be built on.

Agreed.  In fields like graphics and computer vision, large multidimensional arrays aren't always matrices/tensors in the linear algebra sense.  And it's always possible to specialize.  NumPy got this right.
March 20, 2014
18.03.2014 1:35, Christof Schardt пишет:
> I looked to the doku-page and expected to see, how some basic
> matrix-operations could be performed.
> Like e.g. (basic syntax) this:
>
>   Dim  a(10,12)
>   a(3,4) = 7
>   a(i,j) = a(j,i) * 12
>
> Instead I found exotic assignments and calculations.
> Did I expect the wrong thing?

Sorry for that. Do you mead there is a lack of simple indexing examples or lack of some matrix functionality? The latter case is if you meant "transpose and multiply by 12" with `a(i,j) = a(j,i) * 12`.

-- 
Денис В. Шеломовский
Denis V. Shelomovskij
« First   ‹ Prev
1 2