kaneplusplus / bigmemory

126 stars 24 forks source link

Support for n-dimensional arrays? #54

Open noamross opened 7 years ago

noamross commented 7 years ago

I was wondering if you would consider supporting n-dimensional arrays in your package. It seems it would be relatively straightforward to do so. ff does this, but it doesn't provide a C++-level interface that would allow me to work with ff objects from Rcpp, as bigmemory does.

privefl commented 7 years ago

From when I thought of this problem, the more straightforward way to do so for me was to make a function that convert multiple indices to one: 1,1,1 -> 1 1,1,2 -> 2 etc. Did you try this? I'm interested to know the performances, even if it must really depends on the use you have. Can you provide an example?

kaneplusplus commented 7 years ago

I wrote about how to do this in my dissertation. It's essentially the scheme that @privefl describes and it can be done in C++ by creating a new matrix accessor type or, in R, subclassing big.matrix and overriding the bracket operator.