I have data from a sensor I need to put into a 3D matrix, the data comes in a 1d buffer of uint16.
I am provided with meta data informing me of the dimensions P, R, D such that the 1d buffer is of length PRD and the resulting 3D matrix should be of size PxRxD. The length of the buffer will typically be on the order of 1e6 points.
I'd like to access, store, and manipulate this using C++. But I'm not entirely sure how best to go about doing so. I feel there must be a library for this already, so I'd like to avoid having to implement some C-array or std::vector custom implementation. Perhaps Eigen could be possible, (given they have reshaping from Vector to Matrix implemented) but I'm not sure how well it will handle these sizes.
I have made a python script to demo out this functionality, and in python the data comes in as tuples, so an approach which works is np.asarray(tuples, dtype=np.uint16).reshape(P, R, D)
. I'll just eventually need to move away from python for speed, so a 100% C++ implementation is desirable.
Edit: Some extra details I gathered from responses could be useful
- data is coming out of a sensor, so will be read from ethernet connection. So some memory for this container will need to be allocated locally. At least the 1d buffer I think can't be re-used
- Ill need to do signal processing on the data, so formats which enable that are preferred, mostly it'll be processing RxD matrices for each P.
- P is typically ~12, R and D will each be on the order of 1e2.