The larray template class provides a common container interface for both fixed and dynamic multi-dimensional data storage represented in an orthogonal structure and mapped in a contiguous region in memory. The interface is trying to stay as close to the STL containers interface as possible, while extending some concepts as they naturally scale to higher dimensions.
There have been various implementations of multi-dimensional arrays for C++ with probably the most popular one the one found in boost libraries. Although this implementation fits well in programs that require dynamic data storage, it suffers when small fixed storage is desired. Examples of those arrays are small vectors in 3d or 2d space, small matrices (i.e. a projection matrix) etc.
On the other hand there are situations when an implementation can be benefited by requiring that some of the dimensions are fixed and others are not. Examples include the representation of color images and the representation of vectors as matrices with a single row (or column).
Because of the differences between fixed and dynamic arrays, a lot of libraries have been developed to deal with each of the two cases. A class that provides a common interface for multi-dimensional fixed, dynamic, and even "mixed" storage can provide the basis of generic functions and algorithms that can operate on any type of orthogonal containers.
Such thoughts intrigued us to design a multi-dimensional array class that adopts and interface like:
larray <double, dyn, dyn, 3> rgbimage1;
rgbimage1( 5,5,0) = ...;
...
and
larray <double, dyn, dyn> matrix;
larray <double, dyn, 1> vec1, vec2;
larray <double, 1, dyn > row_vec;
// Fill matrix and vec1;
....
// Assuming you have a product implementation for matrices
vec2 = matrix*vec1;
double inner_product = row_vec*vec1;
To download, install and start using larray please see the [GettingStarted] page.
Anonymous