On Wed, Mar 27, 2013 at 04:22:00PM -0400, Andrei Alexandrescu wrote: [...] > * We need to have a battery of multidimensional array shapes along > with simple iteration and access primitives, at least for interfacing > with scientific libraries that define and expect such formats. I'm > thinking rectangular (generally hyperrectangular) matrices, triangular > matrices, sparse matrices, and band matrices. [...]
Given that different computational needs will require different implementations, it might be a good idea to define a generic set of templates for identifying something as a multi-dimensional array, and adopt some conventions as to how things are named (e.g., .dimensions[i] to retrieve the length of the i'th dimension of the array, or the fact that .opIndex(a,b,c,...) is defined, etc.). The idea is that we want to implement some generic array algorithms that don't care about whether it's a dense array, triangular matrix, sparse array, etc.. These should be independent of the actual storage format. There are, of course, algorithms that will benefit from specific implementations (e.g. algorithms that take advantage of the sparseness of a matrix, say), so those will specificially depend on, say, a sparse array. Generic identification of array types is also necessary to maximize interoperability between computational libraries. For one thing, I do *not* wish to see a repeat of the C++ situation where the multidimensional array types between different libraries are incompatible and require expensive copying and/or layers upon layers of wrappers just to interoperate. The situation in D should be such that any library's array type should be interoperable with any other library's array type, as long as both satisfy the standard array-identification templates. In a nutshell, multidimensional arrays should have a standard API so that any multidimensional array can be used with any algorithm that expects one. T -- Always remember that you are unique. Just like everybody else. -- despair.com
