MCPcopy Create free account
hub / github.com/apache/arrow / CalculateValueOffset

Function CalculateValueOffset

cpp/src/arrow/tensor.h:160–168  ·  view source on GitHub ↗

Return the offset of the given index on the given strides

Source from the content-addressed store, hash-verified

158
159 /// Return the offset of the given index on the given strides
160 static int64_t CalculateValueOffset(const std::vector<int64_t>& strides,
161 const std::vector<int64_t>& index) {
162 const int64_t n = static_cast<int64_t>(index.size());
163 int64_t offset = 0;
164 for (int64_t i = 0; i < n; ++i) {
165 offset += index[i] * strides[i];
166 }
167 return offset;
168 }
169
170 int64_t CalculateValueOffset(const std::vector<int64_t>& index) const {
171 return Tensor::CalculateValueOffset(strides_, index);

Callers 1

tensor.hFile · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected