## digitalmars.D - Dynamic Matrices

- Brian Waters <Brian_member pathlink.com> Dec 07 2004
- Ilya Minkov <minkov cs.tum.edu> Dec 08 2004

In D, a dynamic matrix is an array of pointers to arrays (or a "jagged array"). While this is great and all, I am not aware of any way to dynamically implement a flat matrix (that is, a pointer to a true square matrix with no internal pointers). This would be an effeciency gain (and lead to cleaner code) in particular situations. If this has not yet been implemented, than I think it is a feature worthy of some discussion, and, if it has been, than I would be interested to know how to do it. For now, I'll just have to implement this as a big vector with some multiplication and addition to get the right index.

Dec 07 2004

Brian Waters schrieb:In D, a dynamic matrix is an array of pointers to arrays (or a "jagged array"). While this is great and all, I am not aware of any way to dynamically implement a flat matrix (that is, a pointer to a true square matrix with no internal pointers). This would be an effeciency gain (and lead to cleaner code) in particular situations. If this has not yet been implemented, than I think it is a feature worthy of some discussion, and, if it has been, than I would be interested to know how to do it.

This is a feature for consideration for a future version of the language, not the current one. See this proposal: http://homepages.uni-regensburg.de/~nen10015/documents/D-multidimarray.html Right now it is a priority to get the language stable in its curent shape, then add features.For now, I'll just have to implement this as a big vector with some multiplication and addition to get the right index.

I just loooked at the template libraries, none of them has that ready made, but a nice array-acess syntax would also be possible. -eye

Dec 08 2004