2

The FBM function in bigstatsr package allows us to create a 2D matrix with shared memory. For instance, FBM(5, 8) will create a 5 by 8 matrix using shared memory.

However, is there a way to create a 3D matrix with shared memory in a similar manner?

A pseudo-code will be FBM(100, 5, 6), which will give me a 3D array/matrix such that it is comprised of 100 5 x 6 2D matrices. But apparently it doesn't work, because it gives: Error in match.arg(type) : 'arg' must be NULL or a character vector

I am asking this is because if I want to update an array using foreach loop in parallel, I will have to make it a shared memory one, otherwise the foreach loop will make copies of the array and update on those copies, while leaving the original one unchanged. What I am looking for is a way to create a 3D array such that it can be updated in parallel using foreach loop.

Thanks!

Caprikuarius
  • 176
  • 7
  • It would be a lot of work to make accessors available for 3D arrays using `FBM` from {bigstatsr} or `big.matrix` from {bigmemory}. The easiest solution would be to transform your 3D indices into 2D ones, because a matrix or a 3D-array are just simple vectors with dimensions. If you provide a simple foreach code that reproduce what you're trying to do, I can help you adapting it for 3 dimensions. – F. Privé Aug 06 '19 at 04:36

0 Answers0