Function Jet::Utilities::UnravelIndex¶
Defined in File Utilities.hpp
Function Documentation¶
-
inline std::vector<size_t>
Jet::Utilities
::
UnravelIndex
(unsigned long long index, const std::vector<size_t> &shape)¶ Converts a linear index into a multi-dimensional index.
The multi-dimensional index is written in row-major order.
Example: To compute the multi-index (i, j) of an element in a 2x2 matrix given a linear index of 2,
shape
would be {2, 2} and the result would be{1, 0}
.std::vector<size_t> multi_index = UnravelIndex(2, {2, 2}); // {1, 0}
- Parameters
index – Linear index to be unraveled.
shape – Size of each index dimension.
- Returns
Multi-index associated with the linear index.
api/function_Utilities_8hpp_1a7c95b2bc824c688083d2e0ec6f800833
Download Python script
Download Notebook
View on GitHub