-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to choose the indexes of the MultiDimensionalArray
to map into the Eigen Matrix in theto_eigen
method
#88
Comments
Just a shot in the dark, but it could be possible to just expose the MultiDimensionalArray as TensorMap and then do any further manipulation of the array just with Eigen? |
At the moment Another direction would be to consider those cases in which only two dimensions are effectively different from 1. I could also check if it is possible to have a squeeze method for MultiDimensionalArray. |
It is not possible directly, but maybe I can edit the internal |
Discussing with @xela-95, another option can even be to exploit the Map stride. This would have the added value of giving the user with the possibility of slicing an actual 3D array into a 2D eigen map |
Just a comment: perhaps we can refer to order 3 and order 2 (or something like that?). I am afraid that 3D array may be confused with a first order 3 dimensional vector. Other terms to refer to that are degree or rank, but I think those are more ambiguous. |
Yeah, I would say to slice a generic MultiDimensionalArray in an Eigen Matrix |
As mentioned in person, indeed the |
Thanks @traversaro. Nonetheless, I got intrigued by how to handle the slicing. Here is what I came up with. Let's start considering that we store the elements in column-major order. This means that the element Here it can be noticed that each index is multiplied by the product of the previous sizes (using 1 as the size of the dimension before the first). Let's call these components Now, if we want to slice the tensor into a matrix, we need to define 3 elements:
In order to slice we need to define which dimensions are fixed. Then,
|
Hi,
I am working in loading some complex MAT file in C++ using matioCpp and then obtaining their corresponding Eigen Matrix. One of the data structure I need loaded is of type
MultiDimensionalArray
with dimension (3,1,15000).Up to now is not possible to directly use the
to_eigen
methodmatio-cpp/include/matioCpp/impl/EigenConversions.tpp
Lines 13 to 19 in 1a846dc
to convert it to an Eigen Matrix since the array's dimensions are > 2.
It would be nice if I could select the indices of the dimensions I need when calling this method (in this case they are the 1st and 3rd dimension).
The text was updated successfully, but these errors were encountered: