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!
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With