Skip to content
Snippets Groups Projects
Commit 22c6276a authored by laurent soulier's avatar laurent soulier
Browse files

[MAJ] getIdx returns an index in number of elements

parent 260e3401
No related branches found
No related tags found
2 merge requests!41Support for any backend storage,!13Refactoring Tensor
......@@ -169,7 +169,7 @@ public:
&& "Coordinates dimensions does not fit the dimensions of the tensor");
flatIdx += (coordIdx[i] * mvLayout[i]);
}
return flatIdx;
return flatIdx / mScalarSize;
}
private:
......
......@@ -441,7 +441,7 @@ public:
template<typename expectedType>
expectedType &get(std::vector<Coord_t> const &coordIdx)
{
return get<expectedType>(getIdx(coordIdx) / GetScalarSize());
return get<expectedType>(getIdx(coordIdx));
}
/// @brief Set teh value of an element identified by its index
......@@ -477,6 +477,7 @@ public:
private:
/// @brief Get the linear index of the first Byte_t of the data at given coordinates
/// @param coordIdx coordinates of the desired data
/// @note The index is expressed in number of elements
/// @return Linear index of the first Byte_t of the data at given coordinates
std::size_t getIdx(std::vector<Coord_t> const &coordIdx) const noexcept;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment