Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

4 dimensional matrix in Armadillo

I started using Armadillo relatively recently, and although I like it a lot, it would be useful if it had ways of storing 4D matrices. Is there something I'm missing, or a workaround for this?

The last dimension would just have a size of three, so in theory I could have something like:

std::vector<arma::cube> 4Dmatrix(3);
for (int index=0; index<3; index++)
  4Dmatrix[index] = cube(size1, size2, size3);

However, it feels like there must be a better way.

Thanks in advance!

like image 338
tiswas Avatar asked Nov 03 '22 23:11

tiswas


1 Answers

You could potentially use the field class which stores arbitrary objects as elements in a vector, matrix or cube structure. E.g. (from the documentation) to create a field containing vec vectors:

// create a field containing vectors
field<vec> F(3,2);
like image 65
Svaberg Avatar answered Nov 11 '22 07:11

Svaberg